OpenImageIO Project OpenImageIO IFFOutput alignment padding memory corruption vulnerability
A heap-based buffer overflow exists in OpenImageIO's IFFOutput::close() when writing alignment padding bytes to a scratch buffer that was not resized to accommodate them. An attacker who can control the input image specification could trigger a write of up to three null bytes past the heap buffer, potentially leading to arbitrary code execution.
Originally disclosed on Cisco Talos
Multiple memory corruption vulnerabilities exist in the IFFOutput alignment padding functionality of OpenImageIO Project OpenImageIO v2.4.4.2. A specially crafted ImageOutput Object can lead to arbitrary 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
Root cause
The scratch buffer is sized to the unaligned tile length, but padding bytes are written after aligning the length, without resizing the buffer.
Impact
An attacker could cause a heap buffer overflow, potentially leading to arbitrary code execution, though the CVSS score indicates high attack complexity.
What the attacker needed
Attacker controls input image or specification; victim uses OpenImageIO to convert to IFF
How it was found
- Open an input image file and obtain its specification.
- Create an output ImageOutput object for an .iff file.
- Copy or write the image data to the output, triggering IffOutput::close().
- During close, the code calculates tile sizes and compresses data, then pads to alignment.
- The padding writes null bytes past the end of the scratch buffer, causing a heap 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.
OpenImageIO is a library for reading and writing image files. When it creates an IFF image, it uses a temporary buffer to hold pixel data. A mistake in the code causes it to write a few extra bytes beyond the end of that buffer, which can crash the program or, in some cases, 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.