Symfony: HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URLs Without a Well-Formed Authority: Incomplete Fix for CVE-2026-45066
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| sensiolabssymfony |
≥ 6.1.0, < 6.4.50→ 6.4.50 ≥ 7.0.0, < 7.4.23→ 7.4.23 ≥ 8.0.0, < 8.1.11→ 8.1.11 |
6.4.50 7.4.23 8.1.11 |
| composersymfony/html-sanitizer |
< 8.1.11→ 8.1.11 |
8.1.11 |
| composersymfony/symfony |
< 8.1.11→ 8.1.11 |
8.1.11 |
| Packagistsymfony/html-sanitizer |
≥ 8.0.0, < 8.1.11→ 8.1.11 |
8.1.11 |
| Packagistsymfony/symfony |
≥ 8.0.0, < 8.1.11→ 8.1.11 |
8.1.11 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Debian DEBIAN-CVE-2026-118517 symfony Fix available
- Ubuntu UBUNTU-CVE-2026-118517 symfony No fixed version in this record
Original description The description as published by the source.
Description
UrlSanitizer parses URLs with league/uri, which follows RFC 3986. For a special scheme written with no authority slashes, such as http:evil.example, RFC 3986 yields scheme http, host null and path evil.example. The sanitizer then skips the host allow-list check because the host is null, and with allowRelativeLinks(true) it also waives the rejection of hostless URLs, so the URL is kept. Browsers parse the same string per the WHATWG URL standard. There, // is optional when the scheme differs from the scheme of the page. The authority is then evil.example, and navigation goes to http://evil.example/. With the scheme of the page, as https:evil.example on an https page, browsers read a relative path instead. So on an https site, the attacker uses http:.
The guard added for CVE-2026-45066 rejects the one-slash and three-slash spellings but not the zero-slash form:
~^(?:https?|ftp|wss?):(/[^/]|///)~i
Proof of concept, with a configuration that allows one host plus relative links, a natural content-management setup:
$c = (new HtmlSanitizerConfig())->allowSafeElements()
->allowLinkHosts(['trusted.example'])->allowRelativeLinks(true);
(new HtmlSanitizer($c))->sanitize('x'); // x, correct
(new HtmlSanitizer($c))->sanitize('x'); // unchanged, bypass
Two more spellings of the same disagreement were found while fixing. A scheme-relative URL with three or more slashes, ///evil.example, is a path for RFC 3986 and…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- package github.com
- REDHAT Red Hat
- web github.com
- web github.com
- web packagist.org
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web symfony.com
- web github.com