Simple DirectMedia Layer SDL2_image Image Palette Population Code Execution Vulnerability
The BMP image parser in SDL2_image reads the colour palette count from the file without validating it, then uses that count to fill a fixed-size stack buffer. A crafted BMP image can overflow the buffer and potentially execute code.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the BMP image rendering functionality of SDL2image-2.0.2. A specially crafted BMP image can cause a stack 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
Impact
An attacker could cause a stack overflow and potentially execute code by getting a victim to display a specially crafted BMP image.
What the attacker needed
Victim opens a crafted BMP image
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 BMP image file contains a header that says how many colours are in its palette. The library trusts this number and copies that many colour entries into a small buffer on the stack, which is a fixed-size area of memory. If the number is too large, the copy spills over into other 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.