VulnWatch by ve1ve2
medium 5.3 EPSS 0.75%

GHSA-p3x9-6h7p-cgfc / CVE-2025-1219: libxml streams use wrong `content-type` header when requesting a redirected resource

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

https://github.com/php/php-src/security/advisories/GHSA-p3x9-6h7p-cgfc ↗

repo-advisorysecurityrepo:php/php-srcstack

libxml streams use wrong `content-type` header when requesting a redirected resource ### Summary When requesting a HTTP resource using the DOM or SimpleXML extensions, the wrong `content-type` header is used to determine the charset when the requested resource performs a redirect. ### Details When the HTTP stream wrapper follows a redirect, it does not clear the list of captured headers before performing the following requests. This means in the returned array containing the response headers, the headers of multiple requests are stored one after each other. The final request comes last in this array. The `php_libxml_input_buffer_create_filename()` / `php_libxml_sniff_charset_from_stream()` function scans the header array from top to bottom, returning after finding the first `content-type` header. This `content-type` header does not necessarily belong to the response that corresponds to the HTML body that is being parsed. ### PoC redirect.php ``` querySelector('body')->textContent, 'Example')) { throw new Exception('Refusing to store example content'); } var_dump(\str_contains($document->saveHtml(), 'Example')); // bool(true) ``` ### Impact This allows an attacker to cause a document to be parsed incorrectly, changing its meaning and possibly bypassing validation. When exporting such a document with `->saveHtml()` the document will be returned with the original charset. Users that request documents via HTTP using the DOM or SimpleXML extensions are impacted. Patched: 8.1.32, 8.2.28, 8.3.19, 8.4.5

Linked vulnerabilities (2)

CVE-2025-1219 medium 5.3 EPSS 0.75% (p56) NVDCVE.orgGHSA
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

php8.2 - security update

Aliases: CVE-2025-1217, CVE-2025-1734, CVE-2025-1736, CVE-2025-1861, GHSA-p3x9-6h7p-cgfc

libxml streams use wrong `content-type` header when requesting a redirected resource

Aliases: CVE-2025-1219