CVE-2026-66040
Ffmpeg vulnerability analysis and mitigation

Overview

CVE-2026-66040 is a heap out-of-bounds write vulnerability in FFmpeg's native PNG and APNG encoders that allows remote attackers to corrupt heap memory by supplying a crafted PNG image with a malicious eXIf chunk. It affects FFmpeg through version 8.1.2 and was disclosed on July 24, 2026, with a fix available in commit b506faf. The vulnerability carries a CVSS v3.1 base score of 8.8 (High) and a CVSS v4.0 base score of 8.7 (High) (GitHub Advisory, VulnCheck).

Technical details

The root cause is a heap-based buffer overflow (CWE-122) in FFmpeg's PNG/APNG encoder logic. The function add_exif_profile_size() underestimates the required buffer size when multiple IFD entries in a crafted eXIf chunk reference the same large value payload. During canonical serialization, png_write_chunk() writes tens of thousands of bytes past the allocated buffer boundary because the size estimation does not account for repeated large payloads being fully serialized for each referencing IFD entry. Exploitation requires an attacker to supply a specially crafted PNG image to a system running a vulnerable FFmpeg version, with user interaction (passive) needed to trigger processing of the malicious file (GitHub Advisory, VulnCheck).

Impact

Successful exploitation results in deterministic heap corruption, which can cause the FFmpeg process to crash (denial of service) and potentially enables arbitrary code execution in the context of the process handling the malicious image. All three security pillars are affected: confidentiality, integrity, and availability are rated High in the vulnerable system scope. Applications and services that process untrusted PNG or APNG images using FFmpeg — including media transcoding pipelines, web services, and desktop applications — are at risk of compromise or disruption (GitHub Advisory, VulnCheck).

Exploitation steps

  1. Craft malicious PNG: Create a PNG or APNG file containing a specially crafted eXIf chunk where multiple IFD entries reference the same large value payload. Tools such as Python's struct library or custom EXIF manipulation scripts can be used to construct the malformed chunk.
  2. Trigger processing: Deliver the crafted PNG to a target system running a vulnerable FFmpeg version (≤ 8.1.2) — for example, by uploading it to a media processing service, embedding it in a web page, or sending it via a messaging platform that auto-processes images.
  3. Induce buffer overflow: When FFmpeg's PNG/APNG encoder processes the eXIf chunk, add_exif_profile_size() underestimates the required buffer. During canonical serialization, png_write_chunk() writes far beyond the allocated heap buffer.
  4. Achieve heap corruption: The out-of-bounds write corrupts adjacent heap memory, causing a deterministic process crash or, with further exploitation primitives, potentially enabling arbitrary code execution in the FFmpeg process context (GitHub Advisory, VulnCheck).

Indicators of compromise

  • Process: Unexpected crashes or segmentation faults in FFmpeg processes (ffmpeg, ffprobe, or embedding applications) when processing PNG/APNG files; core dump files generated by FFmpeg.
  • Logs: Application or system logs showing FFmpeg process termination with signals such as SIGSEGV or SIGABRT when handling PNG/APNG input; error messages referencing PNG encoder or EXIF processing routines.
  • File System: Presence of unusual or oversized PNG/APNG files with anomalous eXIf chunk structures in upload directories or processing queues; core dump files (e.g., core.*) in FFmpeg working directories.
  • Network: Inbound delivery of PNG/APNG files from untrusted or unexpected sources to media processing endpoints, particularly files with abnormally large eXIf chunks.

Mitigation and workarounds

Update FFmpeg to a version that includes the fix from commit b506fafec9a19fcbc2be5271875fd4a63d6615bc, which corrects the size estimation in add_exif_profile_size(). If immediate patching is not feasible, restrict or disable the processing of untrusted PNG/APNG images, or disable PNG/APNG encoding functionality if it is not required by the application. Organizations should audit any media processing pipelines that accept user-supplied image files and apply network-level controls to limit exposure (GitHub Advisory, VulnCheck).

Community reactions

The vulnerability received coverage from The Hacker Wire shortly after disclosure on July 24, 2026, and was noted on Mastodon via the @thehackerwire account (The Hacker Wire). VulnCheck published a dedicated advisory providing technical context and remediation guidance (VulnCheck). Community reaction has been measured, consistent with the absence of active exploitation or a public PoC at the time of disclosure.

Additional resources


SourceThis report was generated using AI

Related Ffmpeg vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-66040HIGH8.7
  • Ffmpeg logoFfmpeg
  • cpe:2.3:a:ffmpeg:ffmpeg
NoNoJul 24, 2026
CVE-2026-66039HIGH8.7
  • Ffmpeg logoFfmpeg
  • cpe:2.3:a:ffmpeg:ffmpeg
NoNoJul 24, 2026
CVE-2026-66041HIGH7.7
  • Ffmpeg logoFfmpeg
  • cpe:2.3:a:ffmpeg:ffmpeg
NoNoJul 24, 2026
CVE-2026-66038HIGH7.1
  • Ffmpeg logoFfmpeg
  • cpe:2.3:a:ffmpeg:ffmpeg
NoNoJul 24, 2026
CVE-2026-66037HIGH7.1
  • Ffmpeg logoFfmpeg
  • ffmpeg
NoNoJul 24, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management