CVE-2026-45066: Symfony: HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URL-Parser Differentials and <area> Misclassification

Published May 27, 2026
·
Updated

Description

symfony/html-sanitizer lets applications sanitise untrusted HTML. The configuration methods allowLinkHosts([...]) and allowLinkSchemes([...]) are intended to restrict <a href> targets to an allowlist of hosts/schemes; allowMediaHosts() / allowMediaSchemes() do the same for <img src> etc.

Three distinct bypasses allow a content author to smuggle off-allowlist URLs past these checks. First, UrlSanitizer::parse() parses the input following RFC-3986, while browsers follow the WHATWG URL Standard which normalises \ to / before parsing the authority of "special" schemes; so an input like https://evil\@trusted.com/ parses with host trusted.com server-side but navigates to https://evil/ in the browser. Second, WHATWG collapses any run of / after the scheme into //, while RFC-3986 does not; so https:/evil.com/ and https:///evil.com/ parse as host-less (skipping the host allowlist) but resolve to evil.com in the browser. Third, UrlAttributeSanitizer checks 'a' === $element to route to the link policy and falls through to the media policy otherwise, but <area> is a navigable hyperlink equivalent to <a>; so <area href> was sanitised against the media policy (which typically allows data: and may have no host allowlist), bypassing allowLinkHosts() / allowLinkSchemes() entirely.

Resolution

UrlSanitizer::sanitize() now rejects URLs that contain a backslash or that use a special scheme (http, https, ftp, ws, wss) followed by a single slash or three slashes before parsing, eliminating the parser-differential bypasses. UrlAttributeSanitizer now applies the link policy to both <a> and <area> elements.

The patch for this issue is available here for branch 5.4.

Credits

Symfony would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.

Other sources

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. From 6.1.0-BETA1 until 6.4.40, 7.4.12, and 8.0.12, HtmlSanitizer URL sanitization can allow off-allowlist URLs through allowLinkHosts() or allowMediaHosts() because UrlSanitizer::parse() follows RFC 3986 while browsers follow WHATWG URL parsing, and because <area href> is checked against the media policy rather than the link policy. This issue is fixed in versions 6.4.40, 7.4.12, and 8.0.12.

MITRE

Affected Software

9 affected componentsFixes available
composer/symfony/symfony>=8.0.0<8.0.12
8.0.12
composer/symfony/symfony>=7.0.0<7.4.12
7.4.12
composer/symfony/symfony>=6.1.0<6.4.40
6.4.40
composer/symfony/html-sanitizer>=8.0.0<8.0.12
8.0.12
composer/symfony/html-sanitizer>=7.0.0<7.4.12
7.4.12
composer/symfony/html-sanitizer>=6.1.0<6.4.40
6.4.40
SensioLabs Symfony>=6.1.0<6.4.40
SensioLabs Symfony>=7.0.0<7.4.12
SensioLabs Symfony>=8.0.0<8.0.12

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 8.0.12
  2. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 7.4.12
  3. Upgrade

    Upgrade composer/symfony/symfony to a version that resolves this vulnerability.

    Fixed in 6.4.40
  4. Upgrade

    Upgrade composer/symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 8.0.12
  5. Upgrade

    Upgrade composer/symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 7.4.12
  6. Upgrade

    Upgrade composer/symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 6.4.40
  7. Upgrade

    Upgrade symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 6.4.40
  8. Upgrade

    Upgrade symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 7.4.12
  9. Upgrade

    Upgrade symfony/html-sanitizer to a version that resolves this vulnerability.

    Fixed in 8.0.12

Event History

May 27, 2026
Advisory Published
via GitHub·08:13 PM
Data Sourced
via GitHub·08:13 PM
DescriptionWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·05:53 PM
Data Sourced
via MITRE·05:53 PM
DescriptionWeakness
Data Sourced
via NVD·06:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-45066?

CVE-2026-45066 has a risk rating of 65, indicating a moderate level of severity.

2

What is the main issue described in CVE-2026-45066?

CVE-2026-45066 concerns improper sanitization of untrusted HTML in the `symfony/html-sanitizer` component, which could allow malicious links in `<a href>` elements.

3

How do I fix CVE-2026-45066?

To fix CVE-2026-45066, ensure that you configure the methods `allowLinkHosts([...])` and `allowLinkSchemes([...])` properly to enforce an allowlist.

4

What components are affected by CVE-2026-45066?

CVE-2026-45066 affects the `composer/symfony/symfony` and `composer/symfony/html-sanitizer` components.

5

Is there a known exploit for CVE-2026-45066?

As of now, there are no publicly disclosed exploits specifically tied to CVE-2026-45066.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203