CVE-2026-66036 Overview
CVE-2026-66036 is a heap out-of-bounds write vulnerability in FFmpeg's vf_hqdn3d denoise filter. The flaw affects FFmpeg through version 8.1.2 and is fixed in commit 5d7112c. Attackers can trigger heap memory corruption by supplying a crafted video whose frame resolution increases between frames when filtergraph reinitialization is disabled through the -reinit_filter 0 option. The vf_hqdn3d.config_input() function allocates undersized per-plane line-history buffers based on the initial frame width, and subsequent larger frames cause denoise_spatial() to write beyond the allocation boundary. The vulnerability is classified under [CWE-122] Heap-based Buffer Overflow.
Critical Impact
Processing an attacker-supplied video with -reinit_filter 0 and the hqdn3d filter enables heap memory corruption, potentially leading to arbitrary code execution in the FFmpeg process context.
Affected Products
- FFmpeg through version 8.1.2
- Applications and services embedding vulnerable FFmpeg builds of vf_hqdn3d
- Media pipelines that disable filtergraph reinitialization via -reinit_filter 0
Discovery Timeline
- 2026-07-24 - CVE-2026-66036 published to the National Vulnerability Database
- 2026-07-29 - Last updated in NVD database
Technical Details for CVE-2026-66036
Vulnerability Analysis
The hqdn3d filter is a high-quality 3D denoiser included in FFmpeg's libavfilter. During initialization, vf_hqdn3d.config_input() sizes per-plane line-history buffers using the width of the first frame. FFmpeg normally responds to resolution changes by reinitializing the filtergraph, which reallocates these buffers to match the new dimensions.
When a user passes -reinit_filter 0, this reinitialization is suppressed. Subsequent frames with larger widths continue to reach denoise_spatial(), which iterates across the wider input and writes past the original allocation. The result is heap corruption whose scope depends on the delta between the initial and later frame widths.
The vulnerability affects confidentiality, integrity, and availability when a victim processes untrusted media through a vulnerable pipeline.
Root Cause
The root cause is a missing bounds check between the buffer size established at filter configuration time and the frame dimensions observed at runtime. config_input() fixes the line-history buffer length to the first frame's width, and no runtime validation compares subsequent frame widths against that allocation before denoise_spatial() writes into it.
Attack Vector
Exploitation requires a victim to process an attacker-controlled video with the hqdn3d filter active and -reinit_filter 0 set. The malicious input begins with a small-width frame that determines the buffer allocation, then transitions to a larger-width frame that drives the out-of-bounds write. Delivery is possible over the network wherever FFmpeg ingests remote media, including transcoding services, upload pipelines, and streaming backends. User interaction is required to invoke the vulnerable filter configuration.
The vulnerability manifests inside denoise_spatial() when it processes the wider frame using the undersized per-plane line-history buffers allocated in config_input(). Refer to the FFmpeg Commit Details and the VulnCheck Advisory for FFmpeg for the specific code paths and fix.
Detection Methods for CVE-2026-66036
Indicators of Compromise
- FFmpeg process crashes or heap corruption aborts occurring while the hqdn3d filter is active in the filtergraph.
- Command-line invocations combining -vf hqdn3d (or equivalent filter chain) with the -reinit_filter 0 option.
- Media inputs whose frame width increases mid-stream after being accepted by a transcoder configured to skip reinitialization.
Detection Strategies
- Inventory hosts running FFmpeg through 8.1.2 and identify services that expose transcoding of untrusted media.
- Scan build manifests, container images, and package lockfiles for vulnerable FFmpeg versions and statically linked libavfilter components.
- Audit application code and orchestration scripts for use of reinit_filter 0 in combination with denoise filters.
Monitoring Recommendations
- Alert on unexpected termination signals from FFmpeg workers, particularly SIGABRT and SIGSEGV correlated with hqdn3d in process arguments.
- Log filter graph parameters passed to media workers and flag entries containing reinit_filter=0 alongside spatial denoise filters.
- Track media assets that trigger repeated crashes across a transcoding fleet as a signal of exploitation attempts.
How to Mitigate CVE-2026-66036
Immediate Actions Required
- Upgrade FFmpeg to a build that includes commit 5d7112c from the FFmpeg Pull Request.
- Remove -reinit_filter 0 from production media pipelines unless there is a specific, validated requirement.
- Restrict which users and upstream systems can supply media inputs and filter arguments to FFmpeg workers.
Patch Information
The upstream fix is committed as 5d7112c60e6f0f0742ce47d448e6da0718a70f4c in the FFmpeg repository. See the FFmpeg Commit Details for the code change and the VulnCheck Advisory for FFmpeg for advisory context. Rebuild any statically linked binaries and container images that ship libavfilter after applying the patch.
Workarounds
- Leave filtergraph reinitialization enabled so FFmpeg reallocates hqdn3d buffers when input dimensions change.
- Disable the hqdn3d filter in pipelines that must retain -reinit_filter 0 until patched builds are deployed.
- Validate and normalize media inputs by rejecting streams whose frame dimensions change after the first decoded frame.
# Configuration example: remove -reinit_filter 0 and keep default reinitialization
ffmpeg -i input.mp4 -vf hqdn3d output.mp4
# If -reinit_filter 0 must remain, drop hqdn3d until patched builds are deployed
ffmpeg -reinit_filter 0 -i input.mp4 -vf "scale=1280:720" output.mp4
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

