CVE-2026-121949: Symfony HtmlSanitizer Does Not URL-Sanitize Srcset Vulnerability

LOW
Advisory Identifier: GHSA-q8jq-xrf4-v5j8
CVSS 5.4
CWE-1023 CWE-184
Published
Advisory Summary

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

CVE Identifier CVE-2026-121949
GHSA Identifier GHSA-q8jq-xrf4-v5j8
Severity LOW
CVSS v3.1 Base Score 5.4
CWE Classification CWE-1023: Incomplete Comparison with Missing Factors
Affected Product Symfony
Package Ecosystem Packagist
Published Date
Last Updated

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

symfony/html-sanitizer fixed: 6.4.50
Upgrade symfony/html-sanitizer to 6.4.50
symfony/html-sanitizer fixed: 7.4.23
Upgrade symfony/html-sanitizer to 7.4.23
symfony/html-sanitizer fixed: 8.1.11
Upgrade symfony/html-sanitizer to 8.1.11
symfony/symfony fixed: 6.4.50
Upgrade symfony/symfony to 6.4.50
symfony/symfony fixed: 7.4.23
Upgrade symfony/symfony to 7.4.23
symfony/symfony fixed: 8.1.11
Upgrade symfony/symfony to 8.1.11
Verify Direct and Transitive Dependencies

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

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

CVE-2026-121949 Affected Symfony Versions

6 component(s)
Fixed Versions:
6.4.507.4.238.1.11
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?
CVE-2026-121949 is a security vulnerability in Symfony involving HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass under CWE-1023: Incomplete Comparison with Missing Factors.
Which Symfony versions are affected?
Affected versions include releases prior to 6.4.50, 7.4.23, 8.1.11 across affected packages: symfony/html-sanitizer, symfony/symfony.
What version fixes CVE-2026-121949?
Upgrading to 6.4.50, 7.4.23, 8.1.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is symfony/html-sanitizer affected?
Yes, symfony/html-sanitizer is affected in releases prior to 6.4.50, 7.4.23, 8.1.11. Upgrade your dependency to 6.4.50, 7.4.23, 8.1.11 or later.
Is symfony/symfony affected?
Yes, symfony/symfony is affected in releases prior to 6.4.50, 7.4.23, 8.1.11. Upgrade your dependency to 6.4.50, 7.4.23, 8.1.11 or later.
What is the CVSS score of CVE-2026-121949?
CVE-2026-121949 has a CVSS v3.1 base score of 5.4 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2026-121949?
CVE-2026-121949 is classified under CWE-1023: Incomplete Comparison with Missing Factors (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.).
How can I check Packagist dependencies for CVE-2026-121949?
Run the dependency tree command: 'inspect dependencies for symfony/html-sanitizer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}