Skip to content
Medium 4.3

Symfony: HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URLs Without a Well-Formed Authority: Incomplete Fix for CVE-2026-45066

CVE-2026-118517 First seen on SecPulse

Affected packages

PackageAffected → 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
composersymfony/html-sanitizer
< 8.1.11→ 8.1.11
composersymfony/symfony
< 8.1.11→ 8.1.11
Packagistsymfony/html-sanitizer
≥ 8.0.0, < 8.1.11→ 8.1.11
Packagistsymfony/symfony
≥ 8.0.0, < 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.

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

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details