Vulnerabilities in pkg:npm/svgo

PACKAGE
Advisory Identifier: GHSA-w27v-7q3p-w38r
Advisory Summary

CVE-2026-84370 is a HIGH (CVSS 8.2) removescripts allows executable links through vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting SVGO libraries in the npm ecosystem. The issue involves removescripts allows executable links through namespace and control-character bypasses. Remediation is available by upgrading affected packages to version 2.8.4, 3.3.5, 4.1.0.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/svgo

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/svgo. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w27v-7q3p-w38r CVE-2026-84370 HIGH SVGO: removeScripts allows executable links through namespace and control-character bypasses
GHSA-4vpr-x523-8j87 CVE-2026-84369 MODERATE SVGO: removeScripts incompletely sanitizes executable HTML in SVG foreignObject elements
GHSA-2p49-hgcm-8545 CVE-2026-73650 HIGH SVGO removeScripts plugin leaves some executable scripts intact
GHSA-xpqw-6gx7-v673 CVE-2026-29074 HIGH SVGO DoS through entity expansion in DOCTYPE (Billion Laughs)

CVE-2026-84370 at a Glance

CVE Identifier CVE-2026-84370
GHSA Identifier GHSA-w27v-7q3p-w38r
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product SVGO
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-84370

To remediate this vulnerability, upgrade all affected SVGO dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

svgo fixed: 2.8.4
npm install svgo@2.8.4
svgo fixed: 3.3.5
npm install svgo@3.3.5
svgo fixed: 4.1.0
npm install svgo@4.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls svgo

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-84370, inspect your project dependencies using npm:

npm ls svgo

Analyze the terminal output to locate any version of SVGO in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.4), your application is affected.

Note: The npm ls svgo command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In SVGO, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-84370 Affected SVGO Versions

3 component(s)
Fixed Versions:
2.8.43.3.54.1.0
Product / Package Ecosystem Affected Versions Fixed Version
svgo
npm
≥ 1.0.0
< 2.8.4
2.8.4
svgo
npm
≥ 3.0.0
< 3.3.5
3.3.5
svgo
npm
≥ 4.0.0
< 4.1.0
4.1.0

References

Frequently Asked Questions

What is CVE-2026-84370?
CVE-2026-84370 is a security vulnerability in SVGO involving removeScripts allows executable links through namespace and control-character bypasses under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which SVGO versions are affected?
Affected versions include releases prior to 2.8.4, 3.3.5, 4.1.0 across affected packages: svgo.
What version fixes CVE-2026-84370?
Upgrading to 2.8.4, 3.3.5, 4.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is svgo affected?
Yes, svgo is affected in releases prior to 2.8.4, 3.3.5, 4.1.0. Upgrade your dependency to 2.8.4, 3.3.5, 4.1.0 or later.
What is the CVSS score of CVE-2026-84370?
CVE-2026-84370 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-84370?
CVE-2026-84370 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-84370?
Run the dependency tree command: 'npm ls svgo'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w27v-7q3p-w38r",
  "modified" : "2026-09-08T21:20:28Z",
  "published" : "2026-09-08T21:20:28Z",
  "aliases" : [ "CVE-2026-84370" ],
  "summary" : "SVGO: removeScripts allows executable links through namespace and control-character bypasses",
  "details" : "## Summary\n\nSVGO'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).\n\nSVGO 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.\n\n## Details\n\nTwo related bypasses were present:\n\n1. 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.\n2. 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.\n\nAnchors in unrelated custom namespaces are not executable SVG anchors and remain untouched.\n\n## Impact\n\nIf 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.\n\nThe 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.\n\n## Patches\n\nUpgrade to one of the following releases for the maintained release line in use:\n\n| Release line | Patched version | Plugin |\n| --- | --- | --- |\n| v2 | 2.8.4 | `removeScriptElement` |\n| v3 | 3.3.5 | `removeScriptElement` |\n| v4 | 4.1.0 | `removeScripts` |\n\nThe fix makes SVG anchor handling namespace-aware and strips ASCII tabs, line feeds, and carriage returns before checking executable URL schemes.\n\nSVGO v1 is no longer maintained. Users of v1 should upgrade to a supported release line.\n\n## Workarounds\n\nFor 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.\n\n## References\n\n- v4 fix: https://github.com/svg/svgo/pull/2268\n- related executable URL hardening: https://github.com/svg/svgo/pull/2263\n- v3 backport: https://github.com/svg/svgo/pull/2269\n- v2 backport: https://github.com/svg/svgo/pull/2272\n- v4.1.0 release: https://github.com/svg/svgo/releases/tag/v4.1.0\n- v3.3.5 release: https://github.com/svg/svgo/releases/tag/v3.3.5\n- v2.8.4 release: https://github.com/svg/svgo/releases/tag/v2.8.4",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "svgo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "2.8.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "svgo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.3.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "svgo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/security/advisories/GHSA-w27v-7q3p-w38r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-84370"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/pull/2268"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/pull/2269"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/pull/2272"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/commit/0557385564a5c6c11d76cd934a6cff94451e532c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/commit/3db3ef33e409a0bc0fdaf255e46c908b00e93bc2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/commit/994a9f00d79ddec68ce19a1ce9eb8ca08d747e4f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/svg/svgo"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/releases/tag/v2.8.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/releases/tag/v3.3.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svg/svgo/releases/tag/v4.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-08T21:20:28Z",
    "nvd_published_at" : "2026-09-01T21:18:48Z"
  }
}