Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-55640 Overview
CVE-2025-55640 is a heap buffer overflow vulnerability in the stbl_AddSize function located in isomedia/stbl_write.c of GPAC MP4Box v2.4. Attackers trigger the flaw by supplying a crafted MP4 file to the parser, resulting in a Denial of Service (DoS) condition. GPAC is an open-source multimedia framework widely used for MP4 container processing, streaming, and media packaging workflows.
Critical Impact
Processing a malicious MP4 file through GPAC MP4Box v2.4 causes a heap buffer overflow in stbl_AddSize, crashing the application and producing a Denial of Service.
Affected Products
- GPAC MP4Box v2.4
- GPAC multimedia framework builds incorporating the vulnerable stbl_write.c logic
- Downstream tools and pipelines that embed MP4Box for ISO base media file parsing
Discovery Timeline
- 2026-10-16 - CVE-2025-55640 published to NVD
- 2026-10-17 - Last updated in NVD database
Technical Details for CVE-2025-55640
Vulnerability Analysis
The vulnerability resides in stbl_AddSize, a routine responsible for maintaining the sample size table (stsz) within the ISO base media file format. The function appends a new sample size and then checks whether all sample sizes in the table are equal, in which case it collapses the array into a single sampleSize field and frees the backing sizes array.
The original logic reused the single_size variable both as a sentinel (set to 0 when sizes differed) and as the collapse value. When all samples legitimately shared a size of 0, the code incorrectly entered the collapse branch, releasing the sizes buffer while leaving stale allocation state behind. Subsequent writes to the freed or reduced allocation produce a heap buffer overflow that terminates the process.
Root Cause
The root cause is overloaded use of a single variable for both state tracking and value storage within the sample-size deduplication logic. The patch introduces a dedicated Bool use_same_size flag and resets stsz->alloc_size = 0 after freeing the sizes array, decoupling the collapse decision from the actual size value and clearing stale allocation metadata.
Attack Vector
Exploitation requires an attacker to deliver a crafted MP4 file that is subsequently parsed by MP4Box or any application linking the vulnerable GPAC code path. The attack is local to the parsing process but can be delivered through any channel that accepts user-supplied MP4 content, including file uploads, media conversion services, and automated transcoding pipelines. A public proof-of-concept MP4 file is referenced in the GitHub PoC repository.
stsz->sampleSize = data_size;
} else {
u32 single_size;
+ Bool use_same_size=GF_TRUE;
stsz->sizes[stsz->sampleCount-1] += data_size;
single_size = stsz->sizes[0];
for (i=1; i<stsz->sampleCount; i++) {
if (stsz->sizes[i] != single_size) {
- single_size = 0;
+ use_same_size = GF_FALSE;
break;
}
}
- if (single_size) {
+ if (use_same_size) {
stsz->sampleSize = single_size;
gf_free(stsz->sizes);
stsz->sizes = NULL;
+ stsz->alloc_size = 0;
}
}
return GF_OK;
Source: GPAC commit 321624f — the patch replaces the overloaded single_size sentinel with a dedicated boolean and clears alloc_size after freeing the backing array.
Detection Methods for CVE-2025-55640
Indicators of Compromise
- Unexpected crashes or SIGABRT/SIGSEGV termination of MP4Box or GPAC-linked processes during MP4 parsing.
- Heap corruption diagnostics from AddressSanitizer or glibc malloc checks referencing stbl_AddSize or stbl_write.c.
- Processing of MP4 files from untrusted sources immediately preceding media service failures.
Detection Strategies
- Monitor media processing hosts for abnormal termination of MP4Box and related GPAC binaries, correlated with inbound file ingestion events.
- Scan file submission pipelines for MP4 containers whose stsz atom contains anomalous sample size patterns, particularly entries that trigger the collapse branch.
- Run GPAC under sanitizer-enabled builds in staging environments to surface heap overflows before production exposure.
Monitoring Recommendations
- Collect process execution and crash telemetry from systems that transcode or inspect user-supplied media.
- Alert on repeated MP4Box crashes within short time windows, which may indicate active DoS attempts.
- Track GPAC version strings across the fleet and flag hosts still running v2.4 or earlier unpatched builds.
How to Mitigate CVE-2025-55640
Immediate Actions Required
- Inventory all systems running GPAC MP4Box v2.4 or embedding GPAC libraries, including container images and build artifacts.
- Restrict MP4Box execution to trusted inputs until the patched commit is deployed.
- Isolate media processing workloads in sandboxed or ephemeral environments to limit the blast radius of a crash.
Patch Information
The upstream fix is available in GPAC commit 321624f28d19a413449fd1718d1eb59037f8f7fc, which resolves GPAC issue #3261. Rebuild GPAC from a source tree that includes this commit, or upgrade to a release that incorporates the fix. Additional disclosure context is available on the Openwall oss-security mailing list.
Workarounds
- Reject or quarantine MP4 files from untrusted sources until the patched GPAC build is deployed.
- Run MP4Box inside a resource-limited sandbox (for example, firejail, bubblewrap, or a container) so that crashes do not disrupt host services.
- Add file-type and structural validation upstream of GPAC to filter malformed stsz atoms before they reach the parser.
# Build GPAC from source including the fix for CVE-2025-55640
git clone https://github.com/gpac/gpac.git
cd gpac
git checkout 321624f28d19a413449fd1718d1eb59037f8f7fc
./configure
make -j$(nproc)
sudo make install
MP4Box -version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

