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

ZIP Integer Overflow leads to writing past heap boundary

An integer overflow in libzip's central directory handling lets a ZIP archive with many entries cause a heap buffer overflow. A remote attacker could crash the application or possibly execute arbitrary code.

libnex Follow

Originally disclosed on HackerOne

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

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

Integer overflow in the _zip_cdir_new function in zip_dirent.c in libzip 0.11.2 and earlier, as used in the ZIP extension in PHP before 5.4.39, 5.5.x before 5.5.23, and 5.6.x before 5.6.7 and other products, allows remote attackers to cause a denial of service (application crash) or possibly execute arbitrary code via a ZIP archive that contains many entries, leading to a heap-based buffer overflow.

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 an integer overflow when calculating the size needed for the central directory entry array, so a large entry count wraps to a small allocation that is then overrun.

Impact

A remote attacker could cause a denial of service (application crash) or possibly execute arbitrary code.

What the attacker needed

Attacker supplies a crafted ZIP archive; victim processes the archive with vulnerable libzip

The fix

Affected versions include libzip 0.11.2 and earlier and PHP before 5.4.39, 5.5.23 and 5.6.7.

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 ZIP file keeps a list of its contents, and the program counts how many items are in that list. If the count is huge, a number used to size memory can wrap around to a small value, so the program writes more data than it reserved. That can crash the program or, in the worst case, 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.