Intel

AIKIDO-2026-387398

enshrined/svg-sanitize is vulnerable to Cross-Site Scripting (XSS)

Cross-Site Scripting (XSS)GHSA-9rjx-3jch-6vjf Published 4 days ago

80

High Risk

This Affects:

PHPenshrined/svg-sanitize
0.13.0 - 0.22.0
Fixed in 1.0.0
Are you affected? Scan for Free

TL;DR

The sanitizer validates href values after XML entity expansion, but the serialized output keeps the original entity reference while the DOCTYPE is stripped. A crafted DTD entity whose name collides with an HTML5 named character reference (for example 	) expands to a benign character during validation, so a javascript: URI passes the check. When the sanitized SVG is rendered inline in HTML, the browser resolves the named reference to U+0009, which URL parsers strip, exposing the javascript: scheme and running script. The fix strips the DOCTYPE/DTD before parsing so entity definitions never reach the parser.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you embed the sanitized SVG inline in an HTML page.

Background info

enshrined/svg-sanitize is vulnerable to Cross-Site Scripting (XSS) in versions 0.13.0 - 0.22.0.

How to fix this

Upgrade the enshrined/svg-sanitize library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform