VulnWatch by ve1ve2
medium 3.1 EPSS 0.58%

GHSA-v8xr-gpvj-cx9g / CVE-2025-1217: Header parser of `http` stream wrapper does not handle folded headers

Source:
PHP releases (GitHub php/php-src tags)
Published:
Fetched:
Updated:
Affects:
php php-src

https://github.com/php/php-src/security/advisories/GHSA-v8xr-gpvj-cx9g ↗

repo-advisorysecurityrepo:php/php-srcstack

Header parser of `http` stream wrapper does not handle folded headers ### Summary The header parser of the `http` stream wrapper does not handle folded headers and passes incorrect MIME types to an attached stream notifier. ### Details The header parser of the `http` stream parser does not understand that a header line beginning with whitespace continues the previous header and instead considers every newline to be a header separator. This has two consequences: 1. The `STREAM_NOTIFY_MIME_TYPE_IS` notification might report an incorrect MIME type, if the `content-type` header is a folded header. 2. The `$http_response_header` array contains the header continuation lines as they appear on-the-wire, requiring userland code to be aware of folded headers and violating [RFC9112#5.2](https://datatracker.ietf.org/doc/html/rfc9112#section-5.2), which specifies: > A user agent that receives an [obs-fold](https://datatracker.ietf.org/doc/html/rfc9112#line.folding) in a response message that is not within a "message/http" container MUST replace each received [obs-fold](https://datatracker.ietf.org/doc/html/rfc9112#line.folding) with one or more [SP](https://datatracker.ietf.org/doc/html/rfc9112#core.rules) octets prior to interpreting the field value. ### PoC ```php "stream_notification_callback")); var_dump(file_get_contents("http://127.0.0.1:8080", false, $ctx)); var_dump($http_response_header); ``` Running against: ``` printf "HTTP/1.0 200 Ok\r\nContent-Type: text/html;\r\n charset=utf-8\r\n\r\nbody\r\n" |nc -l 0.0.0.0 8080 ``` results in: ``` Found the mime-type: text/html; string(6) "body " array(3) { [0]=> string(15) "HTTP/1.0 200 Ok" [1]=> string(24) "Content-Type: text/html;" [2]=> string(17) " charset=utf-8" } ``` being printed (after killing `nc` with Ctrl+C), thus missing the `charset` within the mime type. ### Impact Users of the `http` stream wrapper might interpret the response with an incorrect MIME type and more generally might misparse the response, for example by incorrectly determining which response headers belong to the final response if a redirect happened. Patched: 8.1.32, 8.2.28, 8.3.19, 8.4.5

Linked vulnerabilities (2)

CVE-2025-1217 medium 3.1 EPSS 0.58% (p49) NVDCVE.orgGHSA
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N

php8.2 - security update

Aliases: CVE-2025-1219, CVE-2025-1734, CVE-2025-1736, CVE-2025-1861, GHSA-v8xr-gpvj-cx9g

Header parser of `http` stream wrapper does not handle folded headers

Aliases: CVE-2025-1217