Out-of-bounds reads in zif_grapheme_stripos with negative offset
The grapheme_stripos function in PHP's intl extension mishandled negative offset values, allowing out-of-bounds reads from arbitrary memory locations. An attacker could potentially read sensitive memory contents by supplying a crafted negative offset.
- Disclosed after 3.5 years
https://bugs.php.net/bug.php?id=72061
grapheme_stripos from the intl extension had a security issue when handling negative offsets, this allowed to read from arbitrary memory locations.
Reported to developers on 2016-04-24, fixed 2016-04-29 and released at 2016-04-28, affected PHP 5.5 , 5.6 and 7.
http://php.net/ChangeLog-5.php#5.5.35 http://php.net/ChangeLog-5.php#5.6.21 http://php.net/ChangeLog-7.php#7.0.6
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 function did not validate that the offset parameter was non-negative before using it to calculate a memory position, leading to an out-of-bounds read.
Impact
An attacker could read from arbitrary memory locations, potentially disclosing sensitive information.
What the attacker needed
PHP with intl extension; ability to call grapheme_stripos
The fix
The issue was fixed in PHP 5.5.35, 5.6.21, and 7.0.6.
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 function in PHP that searches for text inside other text did not properly check a number called an offset, which tells it where to start looking. By giving a negative offset, someone could make the function read memory outside the intended area, potentially exposing data that should not be visible.
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.