OpenImageIO Project OpenImageIO TGAInput::read_tga2_header information disclosure vulnerability
An out-of-bounds read vulnerability exists in OpenImageIO's TGA2 header parsing because a stack buffer is not null-terminated, allowing a crafted TGA file to leak stack memory into image metadata. An attacker can provide a malicious file to disclose sensitive information.
Originally disclosed on Cisco Talos
An information disclosure vulnerability exists in the TGAInput::readtga2header functionality of OpenImageIO Project OpenImageIO v2.4.7.1. A specially crafted targa file can lead to a disclosure of sensitive information.
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 stack buffer used to hold the job name and software fields is not null-terminated after reading exactly its size, so subsequent string operations read beyond the buffer.
What the attacker needed
Victim opens a malicious TGA file
The fix
The buffer should be null-terminated or zeroed before reading, or the read size should be reduced by one to leave room for a null terminator.
How it was found
- Craft a TGA file with a valid TGA 2.0 signature and an extension area size of at least 495 bytes.
- Ensure the job name field (41 bytes) contains no null byte.
- Open the file with OpenImageIO, which triggers read_tga2_header().
- The lack of null termination causes out-of-bounds read when setting the DocumentName attribute.
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 reads text from a file, it usually looks for a special zero byte to know where the text ends. In this case, the program filled a fixed-size buffer with data from the file but did not add that zero byte, so when it later tried to use the buffer as a string, it kept reading past the buffer and picked up other data from memory. That extra data could contain sensitive information, and it gets stored in the image's metadata.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.