CVE-2025-1734

Improper Input Validation (4.16)
Affects
PHP
in
PHP
No items found.
Versions
<8.1.32, >=8.2.0 <8.2.28, >=8.3.0 <8.3.19, >=8.4.0 <8.4.5

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

PHP is a general-purpose scripting language used mostly for web development. It runs behind web servers through server APIs such as Apache mod_php and PHP-FPM, and powers content management systems and frameworks such as WordPress, Drupal, Moodle and Laravel. Its HTTP stream wrapper lets functions such as file_get_contents() and fopen() read http:// and https:// URLs, and exposes the response headers to the script in $http_response_header.

An Improper Input Validation vulnerability (CVE-2025-1734) has been identified in the response header parsing of PHP's HTTP stream wrapper, which allows a server an attacker controls or can impersonate to get malformed header lines, such as lines without a colon, accepted as valid headers, which may confuse applications that act on the response headers. PHP tracks this issue as GHSA-pcmh-g36c-qc44.

Per MITRE CWE-20: The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.

This issue affects PHP 8.1 before 8.1.32, PHP 8.2 before 8.2.28, PHP 8.3 before 8.3.19 and PHP 8.4 before 8.4.5, as well as all releases of the End-of-Life PHP 5.6 through 8.0 release lines.

Details

Module Info

Vulnerability Info

This Medium-severity vulnerability is found in the HTTP stream wrapper of PHP 8.1 before 8.1.32, 8.2 before 8.2.28, 8.3 before 8.3.19 and 8.4 before 8.4.5, and in the End-of-Life PHP 5.6 through 8.0 release lines, which never received the upstream fix. The PHP project scores it 6.3 under CVSS 4.0 (CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N).

After the status line, the wrapper reads the response headers one line at a time, looks for the colon that separates the header name from its value, and acts on a few headers itself, such as Location and Transfer-Encoding. Every line is also added to $http_response_header. RFC 7230 requires a colon in every header line, but in PHP 7.4.33 a line without one was simply given an empty value:

http_header_value = memchr(http_header_line, ':', http_header_line_length);
if (http_header_value) {
    http_header_value++; /* Skip ':' */

    /* Strip leading whitespace */
    while (http_header_value < e
            && (*http_header_value == ' ' || *http_header_value == '\t')) {
        http_header_value++;
    }
} else {
    /* There is no colon. Set the value to the end of the header line, which is
     * effectively an empty string. */
    http_header_value = e;
}

Such a line was then stored in $http_response_header like any other header. Lines with whitespace inside the header name were accepted the same way. Code that parses $http_response_header itself, or other components that read the same response, may interpret those lines differently from PHP, so a malicious server can get a malformed line past checks that rely on the header list, for example to smuggle a header that a stricter parser would have rejected.

Exploitation needs allow_url_fopen enabled and an application that fetches a URL with the HTTP stream wrapper from a server the attacker controls, or can answer for through a redirect, a proxy or a plain-HTTP connection, and that acts on the response headers. Any SAPI is affected. Applications that only fetch from trusted servers over verified HTTPS, or that use another HTTP client such as cURL, are not exposed through this issue.

The fix, by Jakub Zelenka, treats a header line without a colon as an invalid response and fails the request; the NES releases also reject whitespace in the header name, as upstream does. The upstream code now reads:

} else {
    /* There is no colon which means invalid response so error. */
    header_info->error = true;
    php_stream_wrapper_log_error(wrapper, options,
            "HTTP invalid response format (no colon in header line)!");
    zend_string_efree(last_header_line_str);
    return NULL;
}

Mitigation

The PHP project publishes security fixes only for its supported release lines. PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0 are End-of-Life and will not receive any public updates to address this issue.

Until an upgrade is possible, fetch remote resources only from trusted servers over HTTPS with certificate verification, or disable allow_url_fopen where remote URL access is not needed.

Users of the affected components should apply one of the following mitigations:

  • Upgrade to PHP 8.1.32, 8.2.28, 8.3.19, 8.4.5, or later.
  • Leverage a commercial support partner like HeroDevs (NES for PHP) for post-EOL security support.

Credits

Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2025-1734
PROJECT Affected
PHP
Versions Affected
<8.1.32, >=8.2.0 <8.2.28, >=8.3.0 <8.3.19, >=8.4.0 <8.4.5
NES Versions Affected
Published date
March 30, 2025
≈ Fix date
February 27, 2025
Fixed in
Category
Improper Input Validation (4.16)
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
PHP
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.