GNOME Project G Structured File Library (libgsf) Compound Document Binary File Sector Allocation Table integer overflow vulnerability
The compound document parser in libgsf multiplies the sector size by the number of file allocation table sectors in a 32-bit field, so a crafted header can make that product wrap around and allocate a buffer that is too small. The parser then copies sector entries into that undersized heap buffer, causing a heap overflow that can crash the process and may allow code execution.
An integer overflow vulnerability exists in the Compound Document Binary File format parser of v1.14.52 of the GNOME Project G Structured File Library (libgsf). A specially crafted file can result in an integer overflow that allows for a heap-based buffer overflow when processing the sector allocation table.
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
The sector count and sector size are multiplied in a 32-bit integer without an overflow check, so the resulting allocation size can wrap to a small value while the copy loop still writes the full number of entries.
Impact
A crafted file can cause a heap-based buffer overflow that crashes the process and, in certain conditions, may lead to code execution in the context of the application using the library; the tracker-miners service parses files automatically without user interaction.
What the attacker needed
Attacker supplies a crafted file; victim or service opens the file
The fix
The issue was fixed in version 1.14.53.
How it was found
- Create a malformed compound document file with the proof-of-concept script.
- Open the generated file with the library, for example through the bundled gsf tool.
- The header's sector shift and sector count are multiplied and wrap around, producing an undersized allocation.
- The indirection table is read and its entries are copied into the undersized buffer, overflowing the heap and crashing the process.
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.
This library reads a container file format that stores its contents in numbered blocks, and it keeps a table listing which blocks belong together. The program works out how much memory the table needs by multiplying two numbers taken from the file, but it does the maths in a fixed-width slot that can wrap around to a small value. It then writes the real table into that too-small space, which corrupts memory and can crash the program or let an attacker run their own code.
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.