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

Simple DirectMedia Layer SDL2_image load_xcf_tile_rle Decompression Code Execution Vulnerability

A heap-based buffer overflow exists in SDL2_image's XCF image parser because the RLE decompression loop does not validate the length value against the allocated buffer size. An attacker can trigger this by displaying a specially crafted XCF image, potentially leading to code execution.

Lilith >_> Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable code execution vulnerability exists in the XCF image rendering functionality of SDL2image-2.0.2. A specially crafted XCF image can cause a heap overflow resulting in 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

The RLE decompression loop subtracts the length from the remaining size but does not verify that the length does not exceed the buffer size before writing, leading to a heap overflow.

Impact

An attacker could execute arbitrary code by convincing a victim to display a malicious XCF image.

What the attacker needed

Victim loads a crafted XCF image

How it was found

  1. Craft an XCF image with controlled bpp, x, and y values.
  2. Embed RLE data with a length value that exceeds the allocated buffer size.
  3. Load the image using SDL2_image, triggering the overflow during decompression.

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 for the decompressed pixels. The decompression code reads a length value from the file and writes that many bytes without checking if it fits in the allocated memory. This can overwrite adjacent memory, which an attacker could exploit to 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 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.