Описание
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:
- The
STREAM_NOTIFY_MIME_TYPE_IS
notification might report an incorrect MIME type, if thecontent-type
header is a folded header. - 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, which specifies:A user agent that receives an obs-fold in a response message that is not within a "message/http" container MUST replace each received obs-fold with one or more SP octets prior to interpreting the field value.
PoC
Running against:
results in:
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.
Пакеты
< 8.1.32
8.1.32
< 8.2.28
8.2.28
< 8.3.18
8.3.19
< 8.4.5
8.4.5
EPSS
CVE ID
Связанные уязвимости
In PHP from 8.1.* before 8.1.32, from 8.2.* before 8.2.28, from 8.3.* before 8.3.19, from 8.4.* before 8.4.5, when http request module parses HTTP response obtained from a server, folded headers are parsed incorrectly, which may lead to misinterpreting the response and using incorrect headers, MIME types, etc.
In PHP from 8.1.* before 8.1.32, from 8.2.* before 8.2.28, from 8.3.* before 8.3.19, from 8.4.* before 8.4.5, when http request module parses HTTP response obtained from a server, folded headers are parsed incorrectly, which may lead to misinterpreting the response and using incorrect headers, MIME types, etc.
In PHP from 8.1.* before 8.1.32, from 8.2.* before 8.2.28, from 8.3.* before 8.3.19, from 8.4.* before 8.4.5, when http request module parses HTTP response obtained from a server, folded headers are parsed incorrectly, which may lead to misinterpreting the response and using incorrect headers, MIME types, etc.
In PHP from 8.1.* before 8.1.32, from 8.2.* before 8.2.28, from 8.3.* ...
EPSS