Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-4vpr-x523-8j87

Опубликовано: 08 сент. 2026
Источник: github
Github: Прошло ревью
CVSS3: 6.1

Описание

SVGO: removeScripts incompletely sanitizes executable HTML in SVG foreignObject elements

Summary

SVGO's opt-in removeScripts plugin did not inspect executable HTML content inside SVG <foreignObject> elements. Applications that used this plugin as their only protection for untrusted SVG input could produce SVGs containing active HTML and 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

Although the plugin removed SVG and XHTML <script> elements, it left other HTML execution paths inside <foreignObject> unchanged. These included:

  • event-handler attributes such as onload and onbeforetoggle;
  • srcdoc documents, including on <iframe> elements;
  • executable URLs in HTML attributes such as action, data, formaction, href, and src.

An attacker could place one of these payloads in an SVG. If an application optimized the untrusted SVG with removeScripts and then served the result in an active browser context, the payload could execute in the viewer's origin.

Impact

Successful exploitation could allow script execution in the context where the optimized SVG is rendered. 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 removeScripts 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 linePatched versionPlugin
v22.8.4removeScriptElement
v33.3.5removeScriptElement
v44.1.0removeScripts

The fix preserves visual HTML inside SVG <foreignObject> elements while removing event attributes, srcdoc, and executable URL values from active HTML URL attributes.

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. As defense in depth, applications can reject or remove <foreignObject> content and avoid serving user-controlled SVGs in an active same-origin context.

Пакеты

Наименование

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

EPSS

Процентиль: 21%
0.00279
Низкий

6.1 Medium

CVSS3

Дефекты

CWE-79

Связанные уязвимости

CVSS3: 6.1
nvd
21 день назад

SVGO, short for SVG Optimizer, is a Node.js library and command-line application for optimizing SVG files. From version 1.0.0 until versions 2.8.4, 3.3.5, and 4.1.0, the opt-in removeScripts plugin, named removeScriptElement in versions 2 and 3 and implemented in plugins/removeScripts.js, removes SVG and XHTML script elements but does not inspect executable HTML content inside SVG foreignObject elements. Event-handler attributes such as onload and onbeforetoggle, srcdoc documents, and executable URLs in the action, data, formaction, href, and src attributes can remain in attacker-controlled SVG input. When an application uses the plugin as its only protection and serves the optimized SVG in an active browser context, the payload can execute script in the viewer's origin, expose data, modify content, or perform actions as the victim. This issue is fixed in versions 2.8.4, 3.3.5, and 4.1.0.

CVSS3: 6.1
debian
21 день назад

SVGO, short for SVG Optimizer, is a Node.js library and command-line a ...

EPSS

Процентиль: 21%
0.00279
Низкий

6.1 Medium

CVSS3

Дефекты

CWE-79