Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass
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-121949 symfony Fix available
- Ubuntu UBUNTU-CVE-2026-121949 symfony No fixed version in this record
Original description The description as published by the source.
Description
W3CReference::ATTRIBUTES marks srcset and imagesrcset as allowed attributes, but UrlAttributeSanitizer::getSupportedAttributes() does not list them, so no URL sanitizer is registered for either. The DOM visitor preserves an attribute value verbatim when no sanitizer handles it, so attacker-controlled responsive-image URL lists survive unchanged and the media scheme and host allow-lists are bypassed. The fixes for CVE-2026-45753 and CVE-2026-48761 extended the same attribute list but did not cover these two attributes.
The same policy correctly drops the equivalent img[src] value, so this is not a configuration mistake but a missing sanitizer for two browser-active URL attributes.
$config = (new HtmlSanitizerConfig())->allowSafeElements()
->allowMediaSchemes(['https'])->allowMediaHosts(['trusted.example']);
$sanitizer = new HtmlSanitizer($config);
$sanitizer->sanitize('');
// srcset survives, browser fetches from evil.example
$sanitizer->sanitize('');
// src correctly dropped
source[srcset] and, in the head context, link[rel=preload][imagesrcset] behave the same way. The confirmed primitive is a browser-active URL policy bypass, not JavaScript execution.
Exploitation requires the application to sanitize attacker-controlled HTML with a configuration that allows these attributes, through allowSafeElements(), allowStaticElements() or an explicit opt-in, and to rely on allowMediaHosts(), allowMediaSchemes() or `forceHttps…
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 github.com
- web github.com
- web github.com