SDL_image XCF Image Code Execution Vulnerability
The XCF image parser in SDL2_image calculates a pixel buffer size from the image width and pitch, but later writes tile rows using level width and height values taken from the file. An attacker who supplies a crafted XCF image can make the row pointer land past the end of the heap buffer, causing a heap overflow that may lead to code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the XCF image rendering functionality of SDL2image 2.0.4. A specially crafted XCF image can cause a heap overflow, resulting in code execution.
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 pixel buffer is allocated using the surface width and pitch, but tile rows are written using attacker-controlled level width and height without checking that the resulting offset stays inside the buffer.
Impact
A crafted XCF image can cause a heap buffer overflow, potentially resulting in code execution when the image is displayed.
What the attacker needed
Victim opens a crafted XCF image
The fix
The vendor patched the issue, presumably by validating that tile and level dimensions stay within the allocated surface buffer.
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.
An image library reads a picture file and stores its pixels in a block of memory sized from the picture's declared width. The same file also contains separate width and height numbers for its internal tiles, and the code trusts those when deciding where to write each row of pixels. If the two sets of numbers disagree, the program writes past the end of its memory block, which can crash it 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.