CVE-2025-55166 — svg-sanitize
Fix: darylldoyle/svg-sanitizer@5a0a1eaCVE-2025-55166 is a Cross-site Scripting (XSS) vulnerability in enshrined/svg-sanitize. A fix is available for enshrined/svg-sanitize — see the affected versions and patch details below.
svg-sanitizer By-Passing Attribute Sanitization
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-55166.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
enshrined/svg-sanitizeReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Problem
The sanitization logic at https://github.com/darylldoyle/svg-sanitizer/blob/0.21.0/src/Sanitizer.php#L454-L481 only searches for lower-case attribute names (e.g. xlink:href instead of xlink:HrEf), which allows to by-pass the isHrefSafeValue check. As a result this allows cross-site scripting or linking to external domains.
Proof-of-concept
provided by azizk
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
<a xlink:hReF="javascript:alert(document.domain)">
<rect width="100" height="50" fill="red"></rect>
<text x="50" y="30" text-anchor="middle" fill="white">Click me</text>
</a>
</svg>
Credits
The mentioned findings and proof-of-concept example were reported to the TYPO3 Security Team by the external security researcher azizk <[email protected]>.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | enshrined/svg-sanitize | all versions | 0.22.0composer require enshrined/svg-sanitize:^0.22.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for enshrined/svg-sanitize, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update enshrined/svg-sanitize to 0.22.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-55166 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is CVE-2025-55166 in your dependencies?
Find it across Packagist, including transitive dependencies.