OpenImageIO Project OpenImageIO TGAInput::decode_pixel() out-of-bounds read vulnerability
An out-of-bounds read exists in OpenImageIO's TGA decoder because the cmap_first header field is not validated against the palette buffer size. A crafted TGA file can cause the decoder to read heap memory beyond the allocated palette, leading to information disclosure.
Originally disclosed on Cisco Talos
An out-of-bounds read vulnerability exists in the TGAInput::decodepixel() functionality of OpenImageIO Project OpenImageIO v2.4.7.1. A specially crafted targa file can lead to 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 cmap_first field from the TGA header is used to index into the palette buffer without any bounds check.
Impact
An attacker could cause an out-of-bounds heap read, potentially disclosing sensitive information from memory.
What the attacker needed
Victim opens a crafted TGA file
How it was found
- Open a specially crafted TGA file with OpenImageIO.
- The TGA header is read, including an unchecked cmap_first value.
- The palette buffer is allocated and filled based on cmap_length.
- During pixel decoding, cmap_first is added to the pixel index and multiplied by palbytespp.
- The resulting offset is used to read from the palette buffer, going out of bounds.
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 program reads a small header that says where the colour palette starts. This program trusts that number without checking it, so a malicious file can make it look far outside the palette data. The program then reads memory it should not, which can leak information.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.