An information leak vulnerability exists in PHP. An integer overflow which occurs while performing sanity checks on the input parameters to the substr_compare() function makes it possible to compare offsets outside of the allocated buffer. This allows memory access outside the buffer and the retrieval of sensitive information, leading to a loss of confidentiality.
Classification
Location:
Remote / Network Access
Attack Type:
Information Disclosure
Impact:
Loss of Confidentiality
Exploit:
Exploit Public
Disclosure:
OSVDB Verified
OSVDB:
Concern
Technical
substr_compare() performs two sanity checks on the input parameters:
Sanity Check #1 - ensures that a negative offset is considered relative to the end of the first input string if (offset < 0) { offset = s1_len + offset; offset = (offset < 0) ? 0 : offset; }
Sanity Check #2 - ensures that offset and requested length do not exceed the buffer length, but does not take into account that the addition of two positive signed variables can result in a negative value when an integer overflow occurs if ((offset + len) > s1_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed ..."); RETURN_FALSE; }
Comparing an ASCIIZ char and a ASCII 01 char with an offset outside the buffer and comparing the return values of substr_compare() it is possible to determine ASCII value of the byte outside the buffer.
Solution
Upgrade to version 5.2.2 or higher, as it has been reported to fix this vulnerability. An upgrade is required as there are no known workarounds.
This product uses the Daylife API but is not endorsed or certified by Daylife.
This section lists the latest news and blogs found via the daylife API (and for older items, the technorati API), which mention or otherwise discuss this vulnerability.