CVE-2025-59734
published high CVSS 4.0 · 8.7Heap-buffer-overflow write in FFmpeg SANM process_ftch
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| FFmpeg | — | SANMFFmpeg · 4d7c609be37dc57d31527c8c9e5945dc9491a7cd to < 8.0 · 7.1.1 to < 8.0 · Other versions: unaffected | Affected | Not stated | |
| Alpine Linux | edge | ffmpeg | Fixed | 8.0-r0 | Package fix record |
| Alpine Linux | v3.23 | ffmpeg | Fixed | 8.0-r0 | Package fix record |
| Alpine Linux | v3.24 | ffmpeg | Fixed | 8.0-r0 | Package fix record |
Description
It is possible to cause an use-after-free write in SANM decoding with a carefully crafted animation using subversion <2. When a STOR chunk is present, a subsequent FOBJ chunk will be saved in ctx->stored_frame. Stored frames can later be referenced by FTCH chunks. For files using subversion < 2, the undecoded frame is stored, and decoded again when the FTCH chunks are parsed. However, in process_frame_obj if the frame has an invalid size, there’s an early return, with a value of 0. This causes the code in decode_frame to still store the raw frame buffer into ctx->stored_frame. Leaving ctx->has_dimensions set to false. A subsequent chunk with type FTCH would call process_ftch and decode that frame obj again, adding to the top/left values and calling process_frame_obj again. Given that we never set ctx->have_dimensions before, this time we set the dimensions, calling init_buffers, which can reallocate the buffer in ctx->stored_frame, freeing the previous one. However, the GetByteContext object gb still holds a reference to the old buffer. Finally, when the code tries to decode the frame, codecs that accept a GetByteContext as a parameter will trigger a use-after-free read when using gb. GetByteContext is only used for reading bytes, so at most one could read invalid data. There are no heap allocations between the free and when the object is accessed. However, upon returning to process_ftch, the code restores the original values for top/left in stored_frame, writing 4 bytes to the freed data at offset 6, potentially corrupting the allocator’s metadata. This issue can be triggered just by probing whether a file has the sanm format. We recommend upgrading to version 8.0 or beyond.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 4.0
- Base score
- 8.7 / 10
- Severity
- high
- Provider
- Google · cna
- Vector string
- CVSS:4.0/AV:A/AC:H/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:H/SI:H/SA:N
- Scenarios
- en: GENERAL
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| FFmpeg | FFmpeg | 4d7c609be37dc57d31527c8c9e5945dc9491a7cd to < 8.0 (affected · custom)7.1.1 to < 8.0 (affected · semver)Default: unaffected | Google · cna |
Weaknesses
1- CWE-416 CWE-416 Use After Free
References
1Provider assertions
2Google · cna
Heap-buffer-overflow write in FFmpeg SANM process_ftch
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 349791ae11944249ef1ca17962e6dd9a57e0ff0238483f39364cccbb3d48ce7a
- Ingested
- 23 Sep 2026, 08:54:20 UTC
- Source record
- Official CVE record