CVE-2026-135706 in FFmpeg
Summary
by MITRE • 11/24/2026
FFmpeg before 9.1 contains a heap buffer overflow vulnerability in modplug_read_header() in libavformat/libmodplug.c that allocates the buffer using max_size instead of sz. When max_size is set to 0, attackers can supply crafted module files that avio_read() copies into a zero-sized buffer, causing memory corruption, crashes, or possible code execution.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 11/26/2026
The vulnerability identified in FFmpeg versions prior to 9.1 represents a critical heap-based buffer overflow located within the modplug demuxer implementation. Specifically, the flaw resides in the modplug_read_header function found in the libavformat/libmodplug.c source file. This component is responsible for parsing and reading metadata from module files, which are audio formats commonly used in tracker music software. The core technical issue stems from an incorrect allocation strategy where the system allocates a memory buffer based on a variable named max_size rather than the actual size of the data indicated by sz. In normal operational scenarios, these values might align or be handled safely, but under specific conditions involving crafted input, this discrepancy becomes exploitable.
The exploitation vector relies heavily on the manipulation of the max_size parameter during the parsing process. When an attacker supplies a specially crafted module file where max_size is set to zero, the application proceeds to allocate a buffer with a size of zero bytes. Subsequently, the avio_read function attempts to copy data from this malformed input into the newly allocated heap memory region. Since the destination buffer has no capacity, any attempt to write even a single byte results in an out-of-bounds write operation. This action corrupts adjacent heap metadata or other critical structures stored immediately after the allocated block on the heap. Such memory corruption is unpredictable and can lead to immediate application crashes due to segmentation faults or access violations when the corrupted data is later accessed.
Beyond simple denial of service through crashing, this vulnerability poses a severe risk of arbitrary code execution. Heap buffer overflows are among the most dangerous classes of vulnerabilities because they allow attackers to overwrite function pointers, exception handlers, or other control flow mechanisms within the heap structure. By carefully crafting the payload and controlling the data written into the zero-sized buffer, an attacker can achieve precise memory writes that redirect program execution to shellcode injected via the malformed module file. This capability transforms a simple media parsing error into a full remote code execution vector if FFmpeg is used in server-side applications or automated processing pipelines where untrusted input is processed without sufficient validation.
From a classification perspective, this vulnerability aligns with CWE-122, which denotes heap-based buffer overflow, and falls under the broader category of improper memory allocation described by CWE-789. In terms of adversary tactics as defined by MITRE ATT&CK, this exploit technique relates to Tactic TA0004 Privilege Escalation or TA0005 Defense Evasion depending on the specific exploitation method used to maintain persistence or avoid detection after initial access through the compromised media file parser. The lack of bounds checking before memory allocation is a fundamental design flaw that violates secure coding principles regarding input validation and resource management.
To mitigate this risk, organizations must immediately upgrade FFmpeg to version 9.1 or later, where the developers have corrected the logic to ensure that buffer allocations are based on accurate size parameters derived from the file header rather than potentially manipulated maximum limits. For environments unable to patch immediately, implementing strict input validation at the ingestion layer is recommended. This includes validating module files against known safe formats and rejecting any inputs with anomalous header values such as zero-sized allocation requests for non-empty data streams. Additionally, deploying runtime protection mechanisms like heap hardening techniques can help detect or prevent exploitation attempts by randomizing memory layouts and enforcing stricter bounds checking on dynamic allocations.