Home/Research/Post

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

  • Severity: LOW
  • CVE: CVE-2026-118517
  • Ecosystems: composer, composer, composer, composer, composer, composer
  • Packages: symfony/html-sanitizer, symfony/html-sanitizer, symfony/html-sanitizer, symfony/symfony, symfony/symfony, symfony/symfony

### 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:

“`php
~^(?:https?|ftp|wss?):(/[^/]|///)~i
“`

Proof of concept, with a configuration that allows one host plus relative links, a natural content-management setup:

“`php
$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 the aut…

Source: GitHub Security Advisories · 2026-12-01