SAIL Image Decoding Library PCX Image Decoding heap-based buffer overflow vulnerability
A heap-based buffer overflow in the SAIL image decoding library's PCX decoder occurs when a crafted PCX file with run-length encoding specifies a fill count that exceeds the allocated scanline buffer. An attacker could exploit this to execute code remotely by convincing a victim to open a malicious image file.
A memory corruption vulnerability exists in the PCX Image Decoding functionality of the SAIL Image Decoding Library v0.9.8. When decoding the image data from a specially crafted .pcx file, a heap-based buffer overflow can occur which allows for remote 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
A remote attacker could execute arbitrary code under the context of the library by convincing a victim to open a malicious PCX file.
What the attacker needed
Victim opens a malicious PCX file
The fix
The vulnerability was fixed by the vendor in a patch release.
How it was found
- Craft a PCX file with run-length encoding enabled and a small image size.
- Set the run-length packet count to a value larger than the allocated buffer.
- Open the crafted file with the SAIL library to trigger the 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 file is opened, the library allocates a small buffer to hold one row of pixels. The PCX format can compress repeated pixels by saying 'repeat this value N times'. If N is larger than the buffer, the library writes past the end of the buffer, corrupting memory. This can let an attacker run their own code on the victim's computer.
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.