SVGO removeScripts plugin leaves some executable scripts intact
SVGO's removeScripts plugin, which is disabled by default, fails to remove all executable scripts from SVG files in certain cases. Specifically, it does not remove namespaced or prefixed <script> elements (e.g., <svg:script>) and matches JavaScript URIs case-sensitively instead of case-insensitively. This can leave executable scripts intact, potentially enabling cross-site scripting (XSS) if untrusted SVGs are processed with this plugin and served to users. SVGO patched these issues in versions 3.3.4 and 4.0.2. Users relying on this plugin for sanitization should upgrade or use dedicated SVG sanitization tools.
AI Analysis
Technical Summary
The SVGO removeScripts plugin is intended to remove script elements, JavaScript URIs, and event handlers from SVG files to reduce XSS risk. However, it did not handle namespaced or prefixed <script> elements, such as <svg:script>, leaving them intact. Additionally, it matched JavaScript URIs case-sensitively, missing variants with different casing. These shortcomings mean that some executable scripts could remain in SVGs after optimization, posing an XSS risk if untrusted SVGs are processed and served. The issue affects SVGO versions >=1.0.0 <2.8.3, >=3.0.0 <3.3.4, and >=4.0.0 <4.0.2. Patches are available in versions 2.8.3, 3.3.4, and 4.0.2, which improve namespace-aware handling and case-insensitive URI matching. Users are advised to upgrade or use dedicated SVG sanitization tools before SVGO processing.
Potential Impact
If SVGO's removeScripts plugin is used on untrusted SVG input, some executable scripts may remain due to incomplete script removal. This can lead to cross-site scripting (XSS) vulnerabilities if the SVG is served to other users on the same domain, potentially allowing script execution that can access cookies or local storage. The vulnerability affects multiple SVGO versions before the patches. Users who only use SVGO locally on trusted SVGs or in build pipelines are unlikely to be impacted.
Mitigation Recommendations
Fixes for this vulnerability are available in SVGO versions 2.8.3, 3.3.4, and 4.0.2. Users should upgrade to at least these versions to ensure complete removal of executable scripts by the removeScripts plugin. If upgrading is not possible, users should consider using dedicated SVG sanitization tools prior to SVGO processing. The removeScripts plugin is disabled by default, so users relying on it for sanitization should verify their configurations. No additional action is required if the plugin is not enabled or if SVGs are trusted.
SVGO removeScripts plugin leaves some executable scripts intact
Description
SVGO's removeScripts plugin, which is disabled by default, fails to remove all executable scripts from SVG files in certain cases. Specifically, it does not remove namespaced or prefixed <script> elements (e.g., <svg:script>) and matches JavaScript URIs case-sensitively instead of case-insensitively. This can leave executable scripts intact, potentially enabling cross-site scripting (XSS) if untrusted SVGs are processed with this plugin and served to users. SVGO patched these issues in versions 3.3.4 and 4.0.2. Users relying on this plugin for sanitization should upgrade or use dedicated SVG sanitization tools.
CVSS v3.1
Score 8.2high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The SVGO removeScripts plugin is intended to remove script elements, JavaScript URIs, and event handlers from SVG files to reduce XSS risk. However, it did not handle namespaced or prefixed <script> elements, such as <svg:script>, leaving them intact. Additionally, it matched JavaScript URIs case-sensitively, missing variants with different casing. These shortcomings mean that some executable scripts could remain in SVGs after optimization, posing an XSS risk if untrusted SVGs are processed and served. The issue affects SVGO versions >=1.0.0 <2.8.3, >=3.0.0 <3.3.4, and >=4.0.0 <4.0.2. Patches are available in versions 2.8.3, 3.3.4, and 4.0.2, which improve namespace-aware handling and case-insensitive URI matching. Users are advised to upgrade or use dedicated SVG sanitization tools before SVGO processing.
Potential Impact
If SVGO's removeScripts plugin is used on untrusted SVG input, some executable scripts may remain due to incomplete script removal. This can lead to cross-site scripting (XSS) vulnerabilities if the SVG is served to other users on the same domain, potentially allowing script execution that can access cookies or local storage. The vulnerability affects multiple SVGO versions before the patches. Users who only use SVGO locally on trusted SVGs or in build pipelines are unlikely to be impacted.
Mitigation Recommendations
Fixes for this vulnerability are available in SVGO versions 2.8.3, 3.3.4, and 4.0.2. Users should upgrade to at least these versions to ensure complete removal of executable scripts by the removeScripts plugin. If upgrading is not possible, users should consider using dedicated SVG sanitization tools prior to SVGO processing. The removeScripts plugin is disabled by default, so users relying on it for sanitization should verify their configurations. No additional action is required if the plugin is not enabled or if SVGs are trusted.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-2p49-hgcm-8545
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a600ac39c2644c7f8fe33b3
Added to database: 07/22/2026, 00:11:47 UTC
Last enriched: 07/22/2026, 00:55:57 UTC
Last updated: 07/31/2026, 12:28:12 UTC
Views: 31
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.