OpenImageIO RLE encoded BMP image out-of-bounds write vulnerability
OpenImageIO's RLE BMP decoder fails to validate the y-coordinate when writing decompressed pixels, allowing a crafted BMP file to write out-of-bounds heap memory. An attacker could achieve arbitrary code execution by providing a malicious file.
Originally disclosed on Cisco Talos
A heap out-of-bounds write vulnerability exists in the way OpenImageIO v2.3.19.0 processes RLE encoded BMP images. A specially-crafted bmp file can write to arbitrary out of bounds memory, which can lead to arbitrary 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
The RLE decoder checks the x-coordinate against the image width but never checks the y-coordinate against the image height before writing to the buffer.
What the attacker needed
Victim opens a malicious BMP file
How it was found
- Craft a BMP file with RLE compression and dimensions that cause the buffer to be small.
- Use the delta opcode repeatedly to increment the y-coordinate beyond the image height.
- Write pixel data at the out-of-bounds y-coordinate, causing a heap buffer 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.
When an image is compressed, the program unpacks it into a memory buffer sized to the image dimensions. The code checks the horizontal position but not the vertical position, so a malicious file can move the write position far below the buffer and overwrite other memory. This 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.