CVE-2026-66040: FFmpeg Heap Out-of-Bounds Write via PNG/APNG eXIf Encoder
FFmpeg through 8.1.2, fixed in commit b506faf, contains a heap out-of-bounds write vulnerability in the native PNG and APNG encoders that allows remote attackers to corrupt heap memory by supplying a crafted PNG image with a malicious eXIf chunk. Attackers can craft an eXIf chunk where multiple IFD entries reference the same large value payload, causing canonical serialization to expand the output far beyond the undersized allocation estimated by addexifprofilesize(), resulting in pngwritechunk() writing tens of thousands of bytes past the buffer boundary, leading to deterministic heap corruption, process crash, and potentially arbitrary code execution.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch b506faf - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 8.1.2
Event History
Frequently Asked Questions
What is the severity of CVE-2026-66040?
CVE-2026-66040 has a high severity rating of 8.8.
How do I fix CVE-2026-66040?
To fix CVE-2026-66040, upgrade to FFmpeg version 8.1.2 or later.
What component of FFmpeg is affected by CVE-2026-66040?
CVE-2026-66040 affects the native PNG and APNG encoders in FFmpeg.
What type of attacks can CVE-2026-66040 enable?
CVE-2026-66040 allows remote attackers to corrupt heap memory via a crafted PNG image.
When was CVE-2026-66040 published?
CVE-2026-66040 was published on July 24, 2026.