CVE-2026-121949: Symfony HtmlSanitizer Does Not URL-Sanitize Srcset Vulnerability
LOWCVE-2026-121949 is a LOW (CVSS 5.4) htmlsanitizer does not url-sanitize srcset vulnerability (CWE-1023: Incomplete Comparison with Missing Factors) affecting Symfony libraries in the Packagist ecosystem. The issue involves htmlsanitizer does not url-sanitize srcset and imagesrcset leading to media scheme and host allow-list bypass. Remediation is available by upgrading affected packages to version 6.4.50, 7.4.23, 8.1.11.
CVE-2026-121949 at a Glance
Security Impact
CVSS: 5.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N).
How to Fix CVE-2026-121949
To remediate this vulnerability, upgrade all affected Symfony dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade symfony/html-sanitizer to 6.4.50
Upgrade symfony/html-sanitizer to 7.4.23
Upgrade symfony/html-sanitizer to 8.1.11
Upgrade symfony/symfony to 6.4.50
Upgrade symfony/symfony to 7.4.23
Upgrade symfony/symfony to 8.1.11
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for symfony/html-sanitizer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-121949, inspect your project dependencies for Symfony:
inspect dependencies for symfony/html-sanitizer
Analyze the terminal output to locate any version of Symfony in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.4.50), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1023: Incomplete Comparison with Missing Factors, where the product performs a comparison between entities that must consider multiple factors or characteristics of each entity, but the comparison does not include one or more of these factors. In Symfony, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-121949 Affected Symfony Versions
6 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
symfony/html-sanitizer
|
Packagist |
≥ 6.1.0
< 6.4.50
|
6.4.50
|
|
symfony/html-sanitizer
|
Packagist |
≥ 7.0.0
< 7.4.23
|
7.4.23
|
|
symfony/html-sanitizer
|
Packagist |
≥ 8.0.0
< 8.1.11
|
8.1.11
|
|
symfony/symfony
|
Packagist |
≥ 6.1.0
< 6.4.50
|
6.4.50
|
|
symfony/symfony
|
Packagist |
≥ 7.0.0
< 7.4.23
|
7.4.23
|
|
symfony/symfony
|
Packagist |
≥ 8.0.0
< 8.1.11
|
8.1.11
|
References
Frequently Asked Questions
What is CVE-2026-121949?
Which Symfony versions are affected?
What version fixes CVE-2026-121949?
Is symfony/html-sanitizer affected?
Is symfony/symfony affected?
What is the CVSS score of CVE-2026-121949?
What CWE is associated with CVE-2026-121949?
How can I check Packagist dependencies for CVE-2026-121949?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q8jq-xrf4-v5j8",
"modified" : "2026-12-01T21:33:51Z",
"published" : "2026-12-01T21:33:51Z",
"aliases" : [ "CVE-2026-121949" ],
"summary" : "Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/html-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.1.0"
}, {
"fixed" : "6.4.50"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/html-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.4.23"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/html-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.0.0"
}, {
"fixed" : "8.1.11"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/symfony"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.1.0"
}, {
"fixed" : "6.4.50"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/symfony"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.4.23"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "symfony/symfony"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.0.0"
}, {
"fixed" : "8.1.11"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"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" : "WEB",
"url" : "https://github.com/symfony/symfony/commit/50e7a38a8f088601c09669b9d267c9c0228884e1"
}, {
"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"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1023", "CWE-184" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-01T21:33:51Z",
"nvd_published_at" : "2026-11-05T18:17:07Z"
}
}