MediumGHSA-22wq-q86m-83fhCVE-2025-55166

svg-sanitizer Bypasses Attribute Sanitization

Published 12 Aug 2025 · Updated 12 Aug 2025

Is your project on an affected enshrined/svg-sanitize?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
<0.22.0
Fixed in
0.22.0
Update to the fixed version for your release line, for example:composer require enshrined/svg-sanitize:^0.22.0

Details

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>.

Is GHSA-22wq-q86m-83fh 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 enshrined/svg-sanitize, and gives you the command that fixes it.

More advisories for enshrined/svg-sanitize

  • MediumCVE-2026-107380enshrined/svg-sanitize: Stored XSS via DTD Entity / HTML5 Named Character Reference Collision · 8 Oct 2026
  • MediumCVE-2026-107381svg-sanitizer: Mixed-case xlink:HrEf skips the `<use>` nesting-DoS check in Resolver::processReferences · 8 Oct 2026
  • MediumCVE-2026-107379enshrined/svg-sanitize: Denial of Service via DTD Attribute Declaration Crash · 8 Oct 2026
  • MediumCVE-2022-23638Cross-site Scripting in enshrined/svg-sanitize · 14 Feb 2022
  • MediumCVE-2019-10772Sanitizer bypass in svg-sanitizer · 27 Feb 2020
  • HighCVE-2019-18857XSS in enshrined/svg-sanitize due to mishandled script and data values in attributes · 8 Jan 2020
enshrined/svg-sanitize security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.