/

CVE-2026-84370

Severity:

HIGH RISK

(8.2)

SVG Link XSS (CWE-79) in SVGO Node.js SVG Optimizer

CVE-2026-84370

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79, CWE-184

Impact:

Stored or reflected script execution through an SVG link

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SVGO's optional script-removal plugin can fail to recognize certain executable SVG links, including namespace-prefixed anchors and URLs containing ASCII control characters. When attacker-controlled SVG is optimized and then served in an active browser context, a victim who activates the surviving link may execute script in the SVG's origin.

Affected context

The vulnerability affects applications that use SVGO to process untrusted SVG files and rely on its optional script-removal functionality to eliminate executable links. Risk is higher when the optimized output is served with an active SVG content type and rendered by a browser in a security-sensitive origin; the issue depends on attacker-controlled SVG content reaching that processing and serving pipeline.

Exploit preconditions

  • Attack surface: SVG upload, transformation, optimization, or content-serving workflows
  • Required access: Ability to submit or influence SVG content processed by SVGO
  • Trigger point: Browser activation of an executable link that survives optimization
  • Why exploitation is possible: The filtering logic does not fully account for namespace-prefixed link elements, namespaced href attributes, or browser-normalized ASCII whitespace in URL schemes

Why this happens

The underlying bug is incomplete filtering of executable links in SVG content, mapping primarily to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting) and secondarily to CWE-184: Incomplete List of Disallowed Inputs. The sanitizer checks only a partial set of element, attribute, and URL representations, while browsers normalize certain characters and interpret namespace variants during parsing. As a result, input that appears non-executable to the filter may remain executable to the browser.

Potential impact

  • A victim may execute attacker-controlled script in the SVG's origin
  • Sensitive same-origin data may be exposed
  • Page content or SVG-rendered content could be modified
  • Actions may be performed using the victim's browser session and privileges
  • Applications embedding or serving optimized SVGs may experience cross-site scripting

General mitigation guidance

Mitigation generally focuses on treating SVG as active content rather than relying on a narrow denylist.

Common defensive patterns include:

  • Use a maintained SVGO release with complete handling for executable links and browser-normalized URL schemes
  • Prefer an allowlist-based SVG sanitizer that understands namespaces, namespaced attributes, and URL parsing behavior
  • Remove scripting, event-handler attributes, external references, and executable link schemes by policy
  • Serve untrusted SVG from an isolated origin with restrictive content security and response headers
  • Avoid inline rendering of untrusted SVG in privileged application origins
  • Reduce input trust by validating content before optimization and validating the final serialized output afterward
  • Apply least privilege to services that process uploaded files and keep optimized output separate from sensitive application data

How teams detect issues like this

Organizations can identify this weakness through:

  • Static analysis and code review of SVG sanitization and filtering logic
  • Tests covering namespace-prefixed anchor elements and namespaced href attributes
  • Regression tests using URL schemes containing ASCII tab, line-feed, and carriage-return characters
  • Verification that browser parsing behavior matches sanitizer assumptions
  • Content-security and upload policies that flag active SVG served from trusted origins
  • Dynamic testing that optimizes representative untrusted SVG samples and inspects the final serialized output

Automated security review tools may help identify incomplete URL filtering and unsafe SVG rendering paths, but browser-based validation remains important.

Sources

SourceLink
github.comgithub.com/svg/svgo/commit/0557385564a5c6c11d76cd934a6cff94451e532c
github.comgithub.com/svg/svgo/commit/3db3ef33e409a0bc0fdaf255e46c908b00e93bc2
github.comgithub.com/svg/svgo/commit/994a9f00d79ddec68ce19a1ce9eb8ca08d747e4f
github.comgithub.com/svg/svgo/pull/2268
github.comgithub.com/svg/svgo/pull/2269
github.comgithub.com/svg/svgo/pull/2272
github.comgithub.com/svg/svgo/releases/tag/v2.8.4
github.comgithub.com/svg/svgo/releases/tag/v3.3.5
github.comgithub.com/svg/svgo/releases/tag/v4.1.0
github.comgithub.com/svg/svgo/security/advisories/GHSA-w27v-7q3p-w38r

Frequently asked

questions

It can be exploitable through an application's remote SVG upload or content-processing workflow when an attacker can supply SVG input and the resulting file is served in an active browser context.

No direct server access is necessarily required. The key requirement is the ability to provide or influence SVG content that the application sends through the vulnerable optimization and serving pipeline.

Use a maintained optimizer or sanitizer with complete namespace-aware and browser-aware filtering, then validate the final output and serve untrusted SVG from an isolated, restricted origin.

Combine allowlist-based SVG sanitization, regression tests for parser differentials and URL normalization, restrictive content policies, and separation of untrusted media from privileged application origins.

Find out what's already
exploitable in your codebase.