php_snmp_error() Format String Vulnerability
A format string vulnerability existed in PHP's SNMP error handling function, where an error string was passed directly to an exception-throwing function without a format specifier. An attacker could exploit this to achieve full code execution by abusing PHP's internal format specifiers.
- Fixed in 30 days
- Paid in 30 days
- Disclosed after 30 days
PHP <= 7.0.4/5.5.34 contained a format string vulnerability in php_snmp_error() at ext/snmp/snmp.c:533, because snmp_object->snmp_errstr was passed directly to zend_throw_exception_ex() without a "%s". This issue appears to have been present across all PHP versions. In testing, I have been able to leverage this vulnerability for full code-execution by abusing PHP's internal "%Z" (zval) format specifier. In the interest of good ol' PoC, that exploit is attached. :)
This issue has been patched in PHP v7.0.5 https://bugs.php.net/bug.php?id=71704 https://secure.php.net/ChangeLog-7.php#7.0.5
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
Impact
An attacker could leverage this vulnerability for full code execution.
What the attacker needed
PHP <= 7.0.4 or 5.5.34; SNMP error handling involved
The fix
The issue was fixed in PHP v7.0.5.
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 format string is a template telling a function how to print data. Here an SNMP error string was used as the template, letting an attacker run 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.