GHSA-w27v-7q3p-w38r: XSS

Published Sep 8, 2026
·
Updated

Summary

SVGO's opt-in removeScripts plugin failed to remove some executable links. Namespace-prefixed SVG anchors and URL schemes containing ASCII tabs or newlines could bypass its checks. Applications that used this plugin as their only protection for untrusted SVG input could expose users to cross-site scripting (XSS).

SVGO is an optimizer rather than a comprehensive sanitization library, but removeScripts is maintained for consumers that already rely on it to remove common script execution paths.

Details

Two related bypasses were present:

1. The plugin inspected unprefixed SVG <a> elements but did not recognize namespace-prefixed SVG anchors such as <svg:a> when the prefix was bound to the SVG namespace. Their executable href or namespaced :href values remained intact. 2. The URL check did not account for ASCII tab, line-feed, or carriage-return characters embedded in a scheme. Browsers remove these characters before parsing the scheme, so values such as java&#9;script: could remain executable after bypassing the plugin's javascript: check.

Anchors in unrelated custom namespaces are not executable SVG anchors and remain untouched.

Impact

If an application optimized attacker-controlled SVGs with removeScripts and then served the result in an active browser context, a victim could follow a link that executes script in the SVG's origin. Depending on the embedding and origin configuration, this could expose cookies or local storage, modify content, or perform actions as the victim.

The plugin is opt-in, so consumers that do not enable it are not relying on the affected behavior. Typical local optimization of trusted SVG files is not affected.

Patches

Upgrade to one of the following releases for the maintained release line in use:

| Release line | Patched version | Plugin | | --- | --- | --- | | v2 | 2.8.4 | removeScriptElement | | v3 | 3.3.5 | removeScriptElement | | v4 | 4.1.0 | removeScripts |

The fix makes SVG anchor handling namespace-aware and strips ASCII tabs, line feeds, and carriage returns before checking executable URL schemes.

SVGO v1 is no longer maintained. Users of v1 should upgrade to a supported release line.

Workarounds

For hostile input, use a dedicated SVG sanitization tool before passing the SVG to SVGO. Applications can also reject links from untrusted SVG input and avoid serving user-controlled SVGs in an active same-origin context.

References

- v4 fix: https://github.com/svg/svgo/pull/2268 - related executable URL hardening: https://github.com/svg/svgo/pull/2263 - v3 backport: https://github.com/svg/svgo/pull/2269 - v2 backport: https://github.com/svg/svgo/pull/2272 - v4.1.0 release: https://github.com/svg/svgo/releases/tag/v4.1.0 - v3.3.5 release: https://github.com/svg/svgo/releases/tag/v3.3.5 - v2.8.4 release: https://github.com/svg/svgo/releases/tag/v2.8.4

Affected Software

3 affected componentsFixes available
npm/svgo>=4.0.0<4.1.0
4.1.0
npm/svgo>=3.0.0<3.3.5
3.3.5
npm/svgo>=1.0.0<2.8.4
2.8.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/svgo to a version that resolves this vulnerability.

    Fixed in 4.1.0
  2. Upgrade

    Upgrade npm/svgo to a version that resolves this vulnerability.

    Fixed in 3.3.5
  3. Upgrade

    Upgrade npm/svgo to a version that resolves this vulnerability.

    Fixed in 2.8.4
  4. Upgrade

    Upgrade svgo to a version that resolves this vulnerability.

    Fixed in 2.8.4
  5. Upgrade

    Upgrade svgo to a version that resolves this vulnerability.

    Fixed in 3.3.5
  6. Upgrade

    Upgrade svgo to a version that resolves this vulnerability.

    Fixed in 4.1.0
  7. Compensating control

    For hostile/untrusted SVG input, use a dedicated SVG sanitization tool before passing the SVG to SVGO.

Event History

Sep 8, 2026
Advisory Published
via GitHub·09:20 PM
Data Sourced
via GitHub·09:20 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications that process untrusted SVG input and rely on SVGO's opt-in removeScripts plugin as their only script-execution safeguard are exposed. SVGO is an optimizer, not a comprehensive SVG sanitization library.

2

What input patterns can bypass the plugin's checks?

Executable links on SVG anchors using an SVG namespace prefix, such as svg:a, can be missed. URL schemes containing ASCII tab, line-feed, or carriage-return characters can also bypass a javascript: check because browsers remove those characters before interpreting the scheme.

3

Are anchors in arbitrary custom namespaces affected?

No. Anchors in unrelated custom namespaces are not executable SVG anchors and remain untouched.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203