---
id: "CVE-2026-118517"
kind: "vulnerability"
aliases: ["CVE-2026-118517"]
title: "Symfony HtmlSanitizer: host allow-lists can be bypassed via malformed URLs"
severity: "medium"
cvss: 4.3
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["html-sanitizer", "package", "php", "symfony"]
not_affected_if: ["default-config", "no-host-allow-list", "relative-links-disabled"]
published_at: "2026-11-05T17:17:53+00:00"
first_seen_at: "2026-11-05T17:40:03+00:00"
updated_at: "2026-11-05T17:42:38+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-118517", "first_seen_at": "2026-11-05T17:40:03+00:00"}]
exploit_sources: []
---

# Symfony HtmlSanitizer: host allow-lists can be bypassed via malformed URLs

The Symfony HtmlSanitizer UrlSanitizer parses some malformed URLs differently from browsers, so allowLinkHosts() and allowMediaHosts() checks are skipped for them. Untrusted hosts can end up referenced in sanitized HTML output.

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

## How to check

- Run `composer show symfony/html-sanitizer` to see the installed version.
- Search the code for `allowLinkHosts(` or `allowMediaHosts(` together with `allowRelativeLinks(true)` or `allowRelativeMedias(true)`.

## Fix

- Symfony `6.4.50`, `7.4.23`, and `8.1.11` (and later in each line); 6.1.x is affected before 6.4.50, so move to the 6.4 line.

## Timeline

- 2026-11-05T17:40:03+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-118517

## Documents

- [advisory] Vendor advisory: github.com https://github.com/symfony/symfony/security/advisories/GHSA-c76g-9c4c-gxrw
- [fix] Patch: github.com https://github.com/symfony/symfony/commit/f2f47d2eef6c2552c6c5c24953caa94f7901cb43

## From the sources

The Symfony HtmlSanitizer component UrlSanitizer parses URLs differently from browsers, allowing the allowLinkHosts() and allowMediaHosts() checks to be bypassed for URLs without a well-formed authority, resulting in untrusted hosts being referenced in sanitized output 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.



UrlSanitizer parses URLs with league/uri, which follows RFC 3986, while browsers follow the WHATWG URL standard. For URLs without a well-formed authority, such as http:evil.example, ///evil.example, or https://://evil.example/ the sanitizer finds no host, whereas browsers resolve them to evil.example. The guard added for CVE-2026-45066 missed the zero-slash form, and the host 0 was also skipped because PHP treats it as falsy.



This is exploitable when a host allow-list is combined with allowRelativeLinks(true) or allowRelativeMedias(true). The default configuration is not affected.

---

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