Executive brief
A security vulnerability exists in the pecl_http extension for PHP, which is used by web applications to handle and parse HTTP requests. By sending a specially crafted URL containing non-printable characters, a remote attacker can cause a memory error that allows them to take control of the server and execute unauthorized commands. This could lead to a complete system compromise, data theft, or service disruption.
Technical details
A heap-based buffer overflow exists in the php_http_url_parse function within php_http_url.c of the pecl_http extension. The vulnerability is caused by improper bounds checking when converting non-printable characters into percent-encoded strings; specifically, the parser's offset was not correctly reset during a 'softfail' in scheme parsing, and the state->offset was incremented without verifying the allocated buffer size. An attacker can exploit this by sending a malicious URL to a PHP application using this extension, leading to a partial overwrite of callback function pointers (such as php_stream_ops). This can result in arbitrary code execution with the privileges of the PHP process. The issue is fixed in version 3.0.1.
Affected products
- PHP pecl_http before 3.0.1
Timeline
- 2016-03-05: disclosed: Vulnerability reported to PHP bug tracker
- 2016-06-29: patched: Fixed in pecl_http version 3.0.1
- 2017-01-23: advisory: NVD publication date
References
- http://www.openwall.com/lists/oss-security/2016/06/29/1
- http://www.openwall.com/lists/oss-security/2016/06/29/4
- http://www.securityfocus.com/bid/95863
- https://bugs.php.net/bug.php?id=71719
- https://github.com/m6w6/ext-http/commit/3724cd76a28be1d6049b5537232e97ac
- https://pecl.php.net/package/pecl_http/3.0.1
- https://security.gentoo.org/glsa/201612-17