Skip to content
Medium 5.4

Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass

CVE-2026-121949 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

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

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