Junglewise Threat Intelligence

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

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

Vendors: PHP.

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