Skip to content
Memory corruption Disclosed report Advanced

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.

rewzilla Follow

Originally disclosed on HackerOne

Bounty$1,000 View original
  • 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

The original report as published on HackerOne, by rewzilla. 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

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.

More by rewzilla

View all

1 more disclosed report, 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.