GPAC Project Advanced Content MPEG-4 Decoding multiple integer truncation vulnerabilities
Several integer truncation flaws in GPAC's MPEG-4 atom parsers cause an undersized heap allocation followed by a heap-based buffer overflow when a crafted file is opened. An attacker could convince a user to open a malicious video to corrupt memory, potentially leading to code execution.
Multiple exploitable integer truncation vulnerabilities exist within the MPEG-4 decoding functionality of the GPAC Project on Advanced Content library v1.0.1. A specially crafted MPEG-4 input can cause an improper memory allocation resulting in a heap-based buffer overflow that causes memory corruption.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the atom size is used to compute an element count that is multiplied by the element size without overflow checking, so the allocation wraps to a tiny or zero-sized buffer while the read loop still writes the full count.
Impact
A heap-based buffer overflow occurs that corrupts memory and could result in code execution under the context of the library, though the report only demonstrates a crash under AddressSanitizer.
What the attacker needed
Victim opens a crafted video file; 32-bit build of the library
How it was found
- Craft an MPEG-4 container whose atom declares a very large 64-bit size.
- Open the file with the library so the atom parser runs.
- The parser divides the size to get an attribute count and allocates a buffer from it.
- The allocation wraps to a tiny buffer, and the parser writes each attribute into it, overflowing the heap.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A video file is made of nested chunks called atoms, each with a size field. The library trusts that size when deciding how much memory to reserve, but a huge size wraps around to a tiny number, so it reserves almost nothing and then writes far more data into it, smashing memory. Opening a malicious video is enough to trigger it.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.