{"id":"CVE-2026-121949","aliases":["GHSA-q8jq-xrf4-v5j8"],"url":"https://o3.security/vulnerability/CVE-2026-121949","summary":"Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset: Media Scheme and Host Allow-List Bypass","details":"### Description\n\n`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.\n\nThe 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.\n\n```php\n$config = (new HtmlSanitizerConfig())->allowSafeElements()\n    ->allowMediaSchemes(['https'])->allowMediaHosts(['trusted.example']);\n$sanitizer = new HtmlSanitizer($config);\n\n$sanitizer->sanitize('<img srcset=\"https://evil.example/a.png 1x\" alt=\"x\">');\n// srcset survives, browser fetches from evil.example\n\n$sanitizer->sanitize('<img src=\"https://evil.example/a.png\" alt=\"x\">');\n// src correctly dropped\n```\n\n`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.\n\nExploitation 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.\n\n### Resolution\n\n`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`.\n\nThe 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.\n\n### Credits\n\nSymfony would like to thank Shriyansh Gupta, [Ilia Alshanetsky](https://github.com/iliaal) and 李智遥 for independently reporting the issue.","published":"2026-11-05T17:46:04.672Z","modified":"2026-11-08T02:47:32.795050763Z","cvss":null,"epss":{"score":0.00239,"percentile":0.16072,"asOf":"2026-12-01"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Packagist","name":"symfony/html-sanitizer","fixedVersion":"6.4.50"},{"ecosystem":"Packagist","name":"symfony/html-sanitizer","fixedVersion":"7.4.23"},{"ecosystem":"Packagist","name":"symfony/html-sanitizer","fixedVersion":"8.1.11"},{"ecosystem":"Packagist","name":"symfony/symfony","fixedVersion":"6.4.50"},{"ecosystem":"Packagist","name":"symfony/symfony","fixedVersion":"7.4.23"},{"ecosystem":"Packagist","name":"symfony/symfony","fixedVersion":"8.1.11"}],"fix":{"url":"https://github.com/symfony/symfony/commit/50e7a38a8f088601c09669b9d267c9c0228884e1","label":"symfony/symfony@50e7a38"},"references":[{"type":"WEB","url":"https://packagist.org/packages/symfony/html-sanitizer"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/121xxx/CVE-2026-121949.json"},{"type":"ADVISORY","url":"https://github.com/symfony/symfony/security/advisories/GHSA-q8jq-xrf4-v5j8"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-121949"},{"type":"FIX","url":"https://github.com/symfony/symfony/commit/50e7a38a8f088601c09669b9d267c9c0228884e1"},{"type":"PACKAGE","url":"https://github.com/symfony/html-sanitizer"},{"type":"WEB","url":"https://github.com/symfony/symfony/commit/9da387d0ddbf506eebd5d9e928bfd4f8f455d8b9"},{"type":"WEB","url":"https://github.com/symfony/symfony/commit/f2f47d2eef6c2552c6c5c24953caa94f7901cb43"},{"type":"WEB","url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/html-sanitizer/CVE-2026-121949.yaml"},{"type":"WEB","url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-121949.yaml"},{"type":"PACKAGE","url":"https://github.com/symfony/symfony"},{"type":"WEB","url":"https://github.com/symfony/symfony/releases/tag/v6.4.50"},{"type":"WEB","url":"https://github.com/symfony/symfony/releases/tag/v7.4.23"},{"type":"WEB","url":"https://github.com/symfony/symfony/releases/tag/v8.1.11"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-11-08T02:47:32.795050763Z"}}