Buffer Over-read in unserialize when parsing Phar
A buffer over-read in PHP's phar extension when parsing serialized metadata in a phar archive could let a remote attacker read process memory or crash the application. The flaw is triggered by a crafted length value combined with crafted serialized data.
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 16 days
https://bugs.php.net/bug.php?id=69324
ext/phar/phar.c in PHP before 5.4.40, 5.5.x before 5.5.24, and 5.6.x before 5.6.8 allows remote attackers to obtain sensitive information from process memory or cause a denial of service (buffer over-read and application crash) via a crafted length value in conjunction with crafted serialized data in a phar archive, related to the phar_parse_metadata and phar_parse_pharfile functions.
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 a missing or incorrect bounds check on a length value when parsing serialized metadata in phar archives, leading to an over-read.
Impact
An attacker could obtain sensitive information from process memory or cause a denial of service through an application crash.
What the attacker needed
Ability to supply a crafted phar archive
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 phar archive is a PHP package file that can hold metadata, which PHP reads with a function called unserialize. A mistake in how the length of that metadata was checked meant PHP could read past the end of a buffer, leaking memory contents or crashing the program.
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.