OpenImageIO PSD thumbnail resource code execution vulnerability
A heap-based buffer overflow exists in OpenImageIO's PSD thumbnail parsing because the width field from the file is used as a stride without validation against the allocated buffer size. An attacker could supply a crafted PSD file to cause out-of-bounds writes and potentially achieve arbitrary code execution.
Originally disclosed on Cisco Talos
A heap based buffer overflow vulnerability exists in the PSD thumbnail resource parsing code of OpenImageIO 2.3.19.0. A specially-crafted PSD file 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
Likely the width field read from the PSD thumbnail resource is used as the xstride for get_pixels without any check that it matches the size of the single-row buffer allocated by libjpeg-turbo.
Impact
A crafted PSD file could lead to arbitrary code execution.
What the attacker needed
Victim opens a crafted PSD file
How it was found
- Open a crafted PSD file with OpenImageIO.
- The PSD header and color mode data are loaded.
- Image resource blocks are read and stored in a map.
- A thumbnail resource with id 1033 or 1036 is processed.
- The thumbnail width is read from the file and used as stride.
- Decompressed JPEG scanlines are written into a buffer using that stride, causing an 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 that reads many image formats, including Photoshop PSD files. When it reads a thumbnail inside a PSD, it trusts a size value from the file and writes image data into a buffer that is too small, which can corrupt memory and 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.