Track vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
2.3

CVE-2026-121949: Symfony HTML sanitizer lets unsafe srcset URLs through

CVE-2026-121949 · published 1 day ago
Summary

The Symfony HTML sanitizing component fails to check the URLs in the srcset and imagesrcset attributes, allowing attackers to supply malicious image sources that bypass the allowed‑media scheme and host lists. As a result, harmful images can be loaded even when other URL attributes are correctly blocked. Update Symfony to a version that includes the fix or modify the sanitization configuration to explicitly reject these attributes.

What to do
  • Update debian symfony to version 7.4.23+dfsg-1.
  • Update debian symfony to version 6.4.50+dfsg-0+deb13u1.
  • Update symfony html-sanitizer to version 6.4.50.
  • Update symfony html-sanitizer to version 7.4.23.
  • Update symfony html-sanitizer to version 8.1.11.
  • Update symfony symfony to version 6.4.50.
  • Update symfony symfony to version 7.4.23.
  • Update symfony symfony to version 8.1.11.
  • Update symfony symfony/html-sanitizer to version 6.4.50.
  • Update symfony symfony/html-sanitizer to version 7.4.23.
  • Update symfony symfony/html-sanitizer to version 8.1.11.
  • Update symfony symfony/symfony to version 6.4.50.
  • Update symfony symfony/symfony to version 7.4.23.
  • Update symfony symfony/symfony to version 8.1.11.
  • Update sensiolabs symfony to version 6.4.50 or later.
Affected software
Ecosystem VendorProductAffected versions
– sensiolabs symfony < 6.4.50
Debian:12 debian symfony All versions
Ubuntu:16.04:LTS canonical symfony All versions
Debian:14 debian symfony < 7.4.23+dfsg-1
Fix: upgrade to 7.4.23+dfsg-1
Debian:13 debian symfony < 6.4.50+dfsg-0+deb13u1
Fix: upgrade to 6.4.50+dfsg-0+deb13u1
composer symfony html-sanitizer >= 6.1.0, < 6.4.50
>= 7.0.0, < 7.4.23
>= 8.0.0, < 8.1.11
Fix: upgrade to 6.4.50
composer symfony symfony >= 6.1.0, < 6.4.50
>= 7.0.0, < 7.4.23
>= 8.0.0, < 8.1.11
Fix: upgrade to 6.4.50
Packagist symfony symfony/html-sanitizer >= 6.1.0, < 6.4.50
>= 7.0.0, < 7.4.23
>= 8.0.0, < 8.1.11
Fix: upgrade to 6.4.50
Packagist symfony symfony/symfony >= 6.1.0, < 6.4.50
>= 7.0.0, < 7.4.23
>= 8.0.0, < 8.1.11
Fix: upgrade to 6.4.50
Original advisory text
Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass
### 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('<img srcset="https://evil.example/a.png 1x" alt="x">');
// srcset survives, browser fetches from evil.example

$sanitizer->sanitize('<img src="https://evil.example/a.png" alt="x">');
// 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 `forceHttpsUrls()` to restrict media URLs. The severity is rated low on that basis.

### Resolution

`srcset` and `imagesrcset` are now sanitized. Because they carry a comma-separated list of candidates rather than a single URL, the value is parsed following the HTML srcset parsing rules, which correctly handles commas inside URLs and trailing width or density descriptors. Each candidate URL is passed through `UrlSanitizer::sanitize()` against the media policy, rejected candidates are dropped, and survivors are re-serialized with their descriptors intact. If every candidate is rejected, or the value is empty or holds only separators, the attribute is dropped, consistent with a rejected `src`, letting the browser fall back to the already sanitized `src`.

The patches for this issue are available [here](https://github.com/symfony/symfony/commit/9da387d0ddbf506eebd5d9e928bfd4f8f455d8b9) for branch 6.4 (and forward-ported to 7.4, 8.1 and 8.2). They require the patch for CVE-2026-118517, available [here](https://github.com/symfony/symfony/commit/f2f47d2eef6c2552c6c5c24953caa94f7901cb43). Without it, a candidate written without `//`, like `http:evil.example/a.png`, is not checked against the media host allow-list.

### Credits

Symfony would like to thank Shriyansh Gupta, [Ilia Alshanetsky](https://github.com/iliaal) and 李智遥 for independently reporting the issue.
Fix within
Internet-facing 60 days
Internal At next upgrade
  • Not known to be exploited
  • Needs hands-on effort to exploit
  • Gives an attacker partial control
Severity
2.3 Low
Exploitation
<1% chance of attack within 30 days
Type
CWE-184Incomplete List of Disallowed Inputs
CWE-1023Incomplete Comparison with Missing Factors
Timeline
Published1 Dec 2026
Updated2 Dec 2026
First seen5 Nov 2026
Track software like this
Free during beta