Symfony: HtmlSanitizer MetaRefreshAttributeSanitizer Matches Only a Narrow Subset of the Browser Refresh Grammar: Incomplete Fix for CVE-2026-48761
Published 1 Dec 2026 · Updated 1 Dec 2026
Affected packages
- Affected
- >=6.1.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/html-sanitizer:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/html-sanitizer:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/html-sanitizer:^8.1.11- Affected
- >=6.1.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/symfony:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/symfony:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/symfony:^8.1.11Which symfony/html-sanitizer does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads composer.json.
Public repo?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
Description
The MetaRefreshAttributeSanitizer introduced for CVE-2026-48761 sanitizes the refresh URL only when the content attribute matches:
/^(\s*\d+\s*[;,]\s*url\s*=\s*)(["\']?)(.+?)\2(\s*)$/i
The browser grammar, the WHATWG shared declarative refresh steps, is broader: the separator after the time may be ASCII whitespace alone, with no ; or ,, and the url= keyword is optional. Directives the browser honours but the regex misses are returned unchanged, so the attacker URL skips UrlSanitizer entirely and both allowLinkSchemes and allowLinkHosts are defeated for the refresh navigation.
$c = (new HtmlSanitizerConfig())->allowStaticElements()->allowLinkHosts(['trusted.example']);
$s = new HtmlSanitizer($c);
$s->sanitizeFor('head', '<meta http-equiv="refresh" content="0;url=https://evil.example/">');
// <meta http-equiv="refresh" />, correct
$s->sanitizeFor('head', '<meta http-equiv="refresh" content="0 url=https://evil.example/">');
$s->sanitizeFor('head', '<meta http-equiv="refresh" content="0;https://evil.example/">');
$s->sanitizeFor('head', '<meta http-equiv="refresh" content="9 , https://evil.example/">');
// URL survives in all three, host allow-list defeatedThe rendered = is entity-decoded back to = by the HTML parser before the refresh algorithm runs, so the browser sees a valid directive. Because the URL never reaches UrlSanitizer, a javascript: refresh URL is not filtered either.
Three further spellings were found while fixing and are covered by the same patch: 0,https://evil.example/, .5;url=https://evil.example/ with an empty integer part, and the specification's incomplete-url= quirk 0;uhttps://evil.example/.
This is reachable under any configuration that allows meta with http-equiv and content, including the documented allowStaticElements() preset.
Resolution
The sanitizer now parses the value following the WHATWG shared declarative refresh steps, and it fails safe: once a value looks like a refresh directive, any parse that does not end in a sanitized URL causes the attribute to be dropped rather than passed through.
Reviewers should note one unavoidable consequence. sanitizeAttribute() receives only the element name and the attribute value, never http-equiv, so every <meta content> value must be treated alike. A value such as <meta name="description" content="10 tips for cooking"> is now dropped, or rewritten as a relative URL when allowRelativeLinks() is enabled, because that same string on an http-equiv="refresh" element does make a browser navigate. The collateral is bounded to meta content values beginning with a digit or a full stop.
The patches for this issue are available here for branch 6.4 (and forward-ported to 7.4, 8.1 and 8.2).
Credits
Symfony would like to thank Ilia Alshanetsky for reporting the issue.
Is GHSA-wm2w-4mgj-vw33 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected symfony/html-sanitizer, and gives you the command that fixes it.
More advisories for symfony/html-sanitizer
- LowCVE-2026-121949Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass · 1 Dec 2026
- LowCVE-2026-118517Symfony: HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URLs Without a Well-Formed Authority: Incomplete Fix for CVE-2026-45066 · 1 Dec 2026
- MediumCVE-2026-48760Symfony: HtmlSanitizer URL Parser Deny Gates Underinclusive: Percent-Encoded BiDi Marks and Unicode Whitespace Bypass Visual-Spoofing Defense · 15 Jun 2026
- MediumCVE-2026-48761Symfony: HtmlSanitizer UrlAttributeSanitizer Misses URL Attributes · 15 Jun 2026
- LowCVE-2026-45753Symfony's HtmlSanitizer UrlAttributeSanitizer Omits action/formaction/poster/cite — `javascript`: URI Survives Sanitization (XSS) · 28 May 2026
- MediumCVE-2026-45066Symfony has an HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URL-Parser Differentials and <area> Misclassification · 27 May 2026
References
- Linkgithub.com/symfony/symfony/security/advisories/GHSA-wm2w-4mgj-vw33
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-121373
- Linkgithub.com/symfony/symfony/commit/2d4c4fe36200858b91132a95076fff3d9de89d26
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/html-sanitizer/CVE-2026-121373.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-121373.yaml
- Packagegithub.com/symfony/symfony
- Linkgithub.com/symfony/symfony/releases/tag/v6.4.50
- Linkgithub.com/symfony/symfony/releases/tag/v7.4.23
- Linkgithub.com/symfony/symfony/releases/tag/v8.1.11
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.