Junglewise Threat Intelligence

CVE-2026-84369: SVGO removeScripts incomplete sanitization in foreignObject

CVE-2026-84369 · Severity: medium · CVSS 6.1 · Published 2026-09-08

Executive brief

SVGO is a popular SVG optimizer library used by developers to process and minimize SVG files. The removeScripts plugin is supposed to strip executable code from user-supplied SVGs to prevent cross-site scripting (XSS) attacks. However, the plugin failed to sanitize executable HTML hidden inside SVG foreignObject elements, allowing attackers to embed malicious event handlers, iframe payloads, and executable URLs that would execute in the viewer's browser and steal cookies, modify content, or perform unauthorized actions.

Technical details

This vulnerability is a cross-site scripting (CWE-79) flaw in SVGO's removeScripts plugin. The plugin was designed to remove script execution vectors from SVG files but failed to sanitize executable HTML markup nested within SVG foreignObject elements—a legitimate SVG feature for embedding foreign XML and HTML content. An attacker could craft an SVG containing multiple attack vectors inside foreignObject: event-handler attributes (onload, onbeforetoggle), srcdoc attributes on iframe elements, or executable URLs in action, data, formaction, href, and src attributes. When an application optimizes untrusted SVG with removeScripts and serves the result in an active browser context, these payloads execute with the privileges of the origin, potentially exfiltrating session tokens or local storage. The plugin is opt-in and does not affect default SVGO behavior or local optimization of trusted files. Patches are available in SVGO v2.8.4, v3.3.5, and v4.1.0, which remove event attributes and srcdoc while preserving legitimate visual HTML.

Affected products

  • svg svgo >= 1.0.0, < 2.8.4; >= 3.0.0, < 3.3.5; >= 4.0.0, < 4.1.0

Timeline

  • 2026-08-24: disclosed: Published by GitHub Advisory Database
  • 2026-09-08: advisory: Advisory published
  • 2026: patched: Patches released: v2.8.4, v3.3.5, v4.1.0

References