Skip to content
Memory corruption Advisory Advanced CVE-2019-5086

xcftools flattenIncrementally tiles walk code execution vulnerability

An integer overflow in the flattenIncrementally function of xcftools can cause a heap buffer overflow when processing a crafted XCF file. An attacker could exploit this to corrupt memory and potentially execute arbitrary code.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

High 7.5 View original

An exploitable integer overflow vulnerability exists in the flattenIncrementally function in the xcf2png and xcf2pnm binaries of xcftools, version 1.0.7. An integer overflow can occur while walking through tiles that could be exploited to corrupt memory and execute arbitrary code.

Claudio Bozzato, 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 code calculates tile boundaries without checking for integer overflow, so a large horizontal offset can cause a signed integer to become negative, leading to an infinite loop and out-of-bounds memory write.

Impact

A victim opening a crafted XCF file could have memory corrupted, potentially leading to arbitrary code execution.

What the attacker needed

Victim opens a crafted XCF file; autocrop option (-C) enabled

How it was found

  1. Create a specially crafted XCF file with a layer having a large horizontal offset.
  2. Run xcf2png or xcf2pnm with the autocrop option (-C) on the crafted file.
  3. The integer overflow occurs during tile processing, causing a heap buffer 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 a program reads a file, it uses numbers from the file to decide how much memory to allocate and where to copy data. If those numbers are very large, they can wrap around to negative values, causing the program to write outside the intended memory area. 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 Claudio Bozzato

View all

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