Skip to content
Memory corruption Advisory Advanced CVE-2017-2862

Gdk-Pixbuf JPEG gdk_pixbuf__jpeg_image_load_increment Code Execution Vulnerability

A heap overflow in Gdk-Pixbuf's JPEG parser occurs because the buffer size is calculated assuming only 3 or 4 colour components, but a crafted JPEG can specify 9 components, leading to an out-of-bounds write. An attacker could exploit this to achieve remote code execution by sending a malicious JPEG file or URL.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable heap overflow vulnerability exists in the gdkpixbufjpegimageloadincrement functionality of Gdk-Pixbuf 2.36.6. A specially crafted jpeg file can cause a heap overflow resulting in remote code execution.

Marcin 'Icewall' Noga, 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

The buffer size calculation in gdk_pixbuf__jpeg_image_load_increment assumes the number of colour components is either 3 or 4, but the JPEG header can specify a different value, leading to a mismatch between allocated size and the amount of data written.

What the attacker needed

Victim opens a malicious JPEG file or URL

How it was found

  1. Craft a JPEG file with a Start-of-Frame marker specifying 9 components.
  2. Load the JPEG using a Gdk-Pixbuf-based application.
  3. The application allocates a buffer based on 3 channels but libjpeg writes 9 components per pixel, 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.

When an image is loaded, the program allocates memory based on how many colour channels the image has. The code assumes only 3 or 4 channels, but a malicious JPEG can claim to have 9, causing the program to write past the allocated memory. This can crash the program or 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 Marcin 'Icewall' Noga

View all

146 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.