Simple DirectMedia Layer SDL2_Image IMG_LoadPCX_RW Information Disclosure Vulnerability
A specially crafted PCX image can cause an out-of-bounds heap read in SDL2_image's PCX parser, leading to information disclosure. An attacker can display such an image to leak heap data into the rendered surface.
An exploitable information disclosure vulnerability exists in the PCX image rendering functionality of SDL2image-2.0.2. A specially crafted PCX image can cause an out-of-bounds read on the heap, resulting in information disclosure .
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 code fails to validate that the image width does not exceed the allocated row buffer size (NPlanes * BytesPerLine) before copying data, causing an out-of-bounds read.
Impact
An attacker could disclose heap memory contents by displaying a crafted image, potentially leaking sensitive information.
What the attacker needed
Victim loads a crafted PCX image
The fix
The vendor patched the vulnerability, likely by adding a check to ensure the width does not exceed the allocated buffer size.
How it was found
- Craft a PCX file with BitsPerPixel equal to 8 and NPlanes equal to 3.
- Set the Xmax and Xmin fields so that the computed width is larger than BytesPerLine.
- Load the crafted PCX file using SDL2_image's IMG_Load function.
- The de-interlace loop reads beyond the allocated buffer, copying heap data into the surface pixels.
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 a program loads an image, it reads size values from the file and uses them to allocate memory. Here, the program trusts a width value from the file that can be larger than the buffer it allocated, so it reads past the end of that buffer. The extra bytes it reads are other data from memory, which then get shown as part of the image, leaking information.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.