CVE-2025-59734
Heap-buffer-overflow write in FFmpeg SANM process_ftch
Check your servers for CVE-2025-59734
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-59734 affects sanm, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
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
- Attack vector
- adjacent: the attacker has to be on the same local network or link
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Attack requirements
- none: an attack works without special conditions on the target
- Privileges required
- none: the attacker does not need an account
- User interaction
- passive: a user has to take part without knowing, such as by viewing a page
- Impact on the vulnerable system
- confidentiality high, integrity high, availability none: what an attacker can read, change or stop in the vulnerable component
- Impact on other systems
- confidentiality high, integrity high, availability none: what an attacker can read, change or stop beyond it
Exploitation
EPSS 0.18%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 7.87% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 8 Oct 2025):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Weakness
- CWE-416 Use After Free
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
|
FFmpeg
package
SANM |
affected from 4d7c609be37dc57d31527c8c9e5945dc9491a7cd, before 8.0 affected from 7.1.1, before 8.0
Other versions: unaffected
|
Is my server affected?
Find the installed version of sanm and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i sanm
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2025-59734 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2025-59734RHEL, Rocky, Alma, Fedora
rpm -q sanm
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2025-59734Alpine
apk list --installed | grep -i sanmWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-59734
trivy image --scanners vuln IMAGE | grep CVE-2025-59734
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://issuetracker.google.com/440183164 issuetracker.google.com
Source: the record CVE-2025-59734 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse