Gdk-Pixbuf TIFF tiff_image_parse Code Execution Vulnerability
An integer overflow in the TIFF parser of Gdk-Pixbuf, when compiled with Clang -O3, causes a heap buffer overflow because overflow checks on signed integers are removed as undefined behaviour. An attacker can send a crafted TIFF file to trigger out-of-bounds writes, potentially leading to remote code execution.
Originally disclosed on Cisco Talos
An exploitable integer overflow vulnerability exists in the tiffimageparse functionality of Gdk-Pixbuf 2.36.6 when compiled with Clang. A specially crafted tiff file can cause a heap-overflow resulting in remote 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 integer overflow checks in tiff_image_parse are performed on signed integers, and because signed overflow is undefined behaviour, the compiler (Clang with -O3) removes the checks, allowing a heap overflow.
Impact
A remote attacker could send a crafted TIFF file to cause a heap overflow and potentially execute arbitrary code, though the exploit only works when the library is compiled with Clang -O3.
What the attacker needed
Gdk-Pixbuf compiled with Clang -O3; attacker can supply a TIFF file
How it was found
- Craft a TIFF file with width 0x8020 and height 0xfff7.
- Load the file with Gdk-Pixbuf compiled with Clang -O3.
- The multiplication height * (width * 4) overflows, causing a small buffer to be allocated.
- The buffer is passed to TIFFReadRGBAImageOriented with the original width and height.
- An out-of-bounds write occurs in put1bitbwtile while reading RGB values.
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.
Gdk-Pixbuf is a library that loads images for many programs. When it reads a TIFF image, it calculates how much memory to allocate based on the image's width and height. If those numbers are huge, the calculation can wrap around to a small number, so the program allocates too little memory and then writes past the end of it. This can 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.