---
id: "CVE-2026-121949"
kind: "vulnerability"
aliases: ["CVE-2026-121949"]
title: "Symfony HtmlSanitizer: srcset attributes bypass image host allowlist"
severity: "low"
cvss: 2.3
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["html-sanitizer", "package", "php", "symfony"]
not_affected_if: ["no-media-allowlist", "no-untrusted-html"]
published_at: "2026-11-05T18:17:07+00:00"
first_seen_at: "2026-11-05T18:40:09+00:00"
updated_at: "2026-11-05T18:40:42+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-121949", "first_seen_at": "2026-11-05T18:40:09+00:00"}]
exploit_sources: []
---

# Symfony HtmlSanitizer: srcset attributes bypass image host allowlist

The Symfony HtmlSanitizer component does not apply its media host and scheme allowlist to srcset and imagesrcset attributes. A crafted value lets a page load images from hosts the application meant to block, so a viewer's browser can be made to contact an attacker's server and expose their IP address.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the Symfony version of the `symfony/html-sanitizer` package in `composer.lock`.
- Look for calls to `allowMediaSchemes()` or `allowMediaHosts()` in code that sanitizes untrusted HTML.

## Fix

- Symfony 6.1.x: move to `6.4.50` or later
- Symfony 7.x: move to `7.4.23` or later
- Symfony 8.x: move to `8.1.11` or later

## Timeline

- 2026-11-05T18:40:09+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-121949

## Documents

- [advisory] Vendor advisory: github.com https://github.com/symfony/symfony/security/advisories/GHSA-q8jq-xrf4-v5j8
- [fix] Patch: github.com https://github.com/symfony/symfony/commit/50e7a38a8f088601c09669b9d267c9c0228884e1

## From the sources

The Symfony HtmlSanitizer component does not apply the media URL policy to the srcset and imagesrcset attributes, allowing values that point to hosts or schemes not permitted by allowMediaSchemes() or allowMediaHosts() to bypass it, so that browsers load images from disallowed hosts in Symfony versions 6.1.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11.The srcset attribute on img and source elements and the imagesrcset attribute on link elements are allowed by the sanitizer, but their URL candidates are never validated, so their values are kept verbatim while the same URL in src is dropped. The fixes for CVE-2026-45753 and CVE-2026-48761 extended the same attribute list but did not cover these two attributes. For example, with allowMediaSchemes(['https']) and allowMediaHosts(['trusted.example']), <img srcset="https://evil.example/a.png 1x"> survives sanitization, and the browser fetches the selected candidate as it would fetch src. Candidates with a scheme forbidden by the configuration, such as http, are kept as well.
Any application that sanitizes untrusted HTML and relies on the media schemes and hosts allowlists to restrict where images can be loaded from is affected. A single crafted value is enough to make the browser of a user viewing the sanitized content send a request to an attacker-controlled host, which can be used to track viewers or log their IP addresses. No authentication is needed if the application accepts HTML from unauthenticated users.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
