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

Simple DirectMedia Layer SDL_image XCF Property Handling Code Execution Vulnerability

The XCF image property reader in SDL_image trusts a length value taken from the file and copies that many bytes into a fixed 24-byte stack field. A crafted XCF file could overflow that buffer and potentially lead to code execution.

Yves Younan Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable buffer overflow vulnerability exists in the XCF property handling functionality of SDLimage 2.0.1. A specially crafted xcf file can cause a stack-based buffer overflow resulting in potential code execution.

Yves Younan, 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 property length read from the file is used directly as the copy size without being checked against the size of the destination buffer.

Impact

A crafted XCF file could cause a stack-based buffer overflow with potential code execution, though the text does not demonstrate a working exploit.

What the attacker needed

Victim opens a crafted XCF file; application uses SDL_image 2.0.1

The fix

The code should be fixed by capping the copy length at the size of the destination buffer before reading, as the supplied patch does.

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.

An image library reads a small piece of an image file called a property. The file also states how long that property is, and the library believes it without checking. If the stated length is bigger than the space reserved, the extra data spills over into nearby memory, which 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 Yves Younan

View all

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