Skip to content
Memory corruption Disclosed report Advanced CVE-2015-3329

Buffer Over flow when parsing tar/zip/phar in phar_set_inode

The phar_set_inode function in PHP contained multiple stack-based buffer overflows when parsing tar, phar, or ZIP archives. A remote attacker could supply a crafted length value in an archive to execute arbitrary code.

libnex Follow

Originally disclosed on HackerOne

Bounty$1,000 View original
  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after under an hour

https://bugs.php.net/bug.php?id=69441

Multiple stack-based buffer overflows in the phar_set_inode function in phar_internal.h in PHP before 5.4.40, 5.5.x before 5.5.24, and 5.6.x before 5.6.8 allow remote attackers to execute arbitrary code via a crafted length value in a (1) tar, (2) phar, or (3) ZIP archive.

The original report as published on HackerOne, by libnex. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Likely the phar_set_inode function did not validate a length value taken from the archive before copying data into a fixed-size stack buffer.

Impact

A remote attacker could execute arbitrary code on the server by getting a crafted tar, phar, or ZIP archive processed.

What the attacker needed

Crafted tar, phar, or ZIP archive; victim processes the archive with PHP

The fix

The issue affected PHP before 5.4.40, 5.5.x before 5.5.24, and 5.6.x before 5.6.8.

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, so nearby memory gets overwritten. Here, PHP's code for reading archive files trusted a length value from the file without checking it, so a malicious archive could overwrite memory and 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 libnex

View all

9 more disclosed reports, best first.

More from Internet Bug Bounty

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.