# CVE-2016-5873: PHP pecl_http buffer overflow in URL parsing

Source: https://junglewise.ai/threats/cve-2016-5873-php-pecl-http-buffer-overflow-in-url-parsing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-01-23. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2016-5873 · Severity: critical · CVSS 9.8 · Published 2017-01-23

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.

Vendors: [PHP](https://junglewise.ai/threats/vendors/php).

## Quick answers

**Is CVE-2016-5873 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-5873 being exploited in the wild.

**How severe is CVE-2016-5873?** Critical severity, with a CVSS score of 9.8, published 23 January 2017.

**Which products and versions are affected?** PHP HTTP Extension before 3.0.1.

**Is there a fix for CVE-2016-5873?** A patch was published on 2016-06-29: Fixed in pecl_http version 3.0.1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2016-5873 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2016-5873?** Check whether you run PHP HTTP Extension or PHP Pecl Http at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## 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/1)
- [http://www.openwall.com/lists/oss-security/2016/06/29/4](http://www.openwall.com/lists/oss-security/2016/06/29/4)
- [http://www.securityfocus.com/bid/95863](http://www.securityfocus.com/bid/95863)
- [https://bugs.php.net/bug.php?id=71719](https://bugs.php.net/bug.php?id=71719)
- [https://github.com/m6w6/ext-http/commit/3724cd76a28be1d6049b5537232e97ac](https://github.com/m6w6/ext-http/commit/3724cd76a28be1d6049b5537232e97ac)
- [https://pecl.php.net/package/pecl_http/3.0.1](https://pecl.php.net/package/pecl_http/3.0.1)
- [https://security.gentoo.org/glsa/201612-17](https://security.gentoo.org/glsa/201612-17)
