Skip to content
Memory corruption Advisory Advanced CVE-2016-4301

Libarchive mtree parse_device Code Execution Vulnerability

A stack-based buffer overflow exists in libarchive's mtree parse_device function because the bounds check occurs after writing to the array, allowing one extra element to be written. An attacker could send a malformed mtree file to cause memory corruption and potentially code execution.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

High 7.8 View original

An exploitable stack based buffer overflow vulnerability exists in the mtree parsedevice functionality of libarchive. A specially crafted mtree file can cause a buffer overflow resulting in memory corruption/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 bounds check is performed after writing to the array, so the array can be overflowed by one element.

Impact

An attacker could cause memory corruption and potentially execute code, though the CVSS vector indicates local access and user interaction are required.

What the attacker needed

Victim opens a crafted mtree file

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.

A buffer overflow happens when a program writes more data into a fixed-size memory area than it can hold, overwriting nearby data. Here, a file parser for the mtree format has a small array meant for three numbers, but a mistake lets it write a fourth number, corrupting memory. This could 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

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