Home/Research/Post

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

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

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

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

Source: GitHub Security Advisories · 2026-12-01