Blender Sequencer imb_loadpng Integer Overflow Code Execution Vulnerability
A crafted PNG file with dimensions whose product overflows a 32-bit calculation causes Blender to allocate an undersized pixel buffer, and decompressing the image then writes past it. An attacker who gets a user to load the file as a sequencer asset could run code in the context of the application.
An exploitable integer overflow exists in the PNG loading functionality of the Blender open-source 3d creation suite version 2.78c. A specially crafted .png file can cause an integer overflow resulting in a buffer overflow which can allow for code execution under the context of the application.
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 pixel buffer size is computed as a 32-bit multiplication of width, height and bytes per pixel, which can wrap around to a small value before being used for allocation.
Impact
A heap-based buffer overflow could allow an attacker to execute code under the context of the application, though the user must open the malicious file.
What the attacker needed
Victim opens a crafted PNG file; file loaded via sequencer or CLI
The fix
The advisory only recommends not using untrusted image files as sequencer assets; it does not describe a code fix.
How it was found
- Create a PNG file whose header dimensions make the size calculation overflow.
- Load the file into Blender, either as a sequencer asset or by passing it as a command-line argument.
- Blender allocates an undersized pixel buffer from the wrapped-around size.
- Decompressing the image data writes past the buffer, causing a heap overflow.
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.
Image files store their width and height as numbers. Blender multiplies width by height to work out how much memory to reserve for the picture, but with huge values that multiplication wraps around to a small number, so too little memory is reserved. When the real image data is then copied in, it spills past the end of that small space and can overwrite other memory, which an attacker may be able to turn into running 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.