Skip to content
Memory corruption Advisory Advanced CVE-2022-41794

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.

Lilith >_> Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

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.

Lilith >_>, on Cisco Talos

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

  1. Open a crafted PSD file with OpenImageIO.
  2. The PSD header and color mode data are loaded.
  3. Image resource blocks are read and stored in a map.
  4. A thumbnail resource with id 1033 or 1036 is processed.
  5. The thumbnail width is read from the file and used as stride.
  6. 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.

More by Lilith >_>

View all

148 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.