Skip to content
Memory corruption Write-up Advanced

[1day] [PoC with $rip] Deterministic Linux heap grooming with huge allocations

An integer overflow in the vmnc decoder's canvas allocation allows out-of-bounds writes, and the author shows that huge allocations are placed deterministically by the Linux kernel, enabling control of the instruction pointer. The attacker could redirect execution to a controlled address, but a full exploit was not achieved before a fix.

Chris Evans Follow

Published on scarybeastsecurity.blogspot.com

The original lives on scarybeastsecurity.blogspot.com

We do not hold its text, 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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely an integer overflow in the canvas size calculation leads to a smaller allocation than the decoder expects, so subsequent canvas operations write out of bounds.

Impact

The attacker could redirect the instruction pointer to a controlled address, but a full exploit was not achieved and the crash was limited by the non-execute bit.

What the attacker needed

Victim opens a malicious video file; vulnerable gstreamer vmnc decoder; 64-bit Linux system

The fix

The bug was fixed in gstreamer1-plugins-bad-free-1.10.1-1.fc25, though Fedora 24 remained unpatched at the time of writing.

How it was found

  1. Craft a video file with width and height values that overflow when multiplied, causing a large allocation.
  2. The large allocation is placed just before a thread heap arena containing the decoder metadata.
  3. Use the out-of-bounds copy primitive to overwrite the canvas pointer with a pointer to a GstPad object.
  4. Write a chosen value over a function pointer in the GstPad object.
  5. Trigger the function pointer call to redirect execution.

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 write-up has not been written yet. The Original tab links to the source.

A video decoder has a bug where a very large canvas size wraps around to a small number, so the program writes outside its buffer. The author uses this to overwrite a function pointer, which is an address the program will later jump to, and shows they can make it jump to a chosen value. They did not get a full working exploit before the software was patched.

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 Chris Evans

View all

11 more disclosed reports, best first.

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.