CVE-2026-29074: Svgo Denial of Service Vulnerability
HIGHCVE-2026-29074 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting Svgo libraries in the npm ecosystem. The issue involves svgo dos through entity expansion in doctype (billion laughs). Remediation is available by upgrading affected packages to version 2.8.1, 3.3.3, 4.0.1.
CVE-2026-29074 at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-29074
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.
npm install svgo@2.8.1
npm install svgo@3.3.3
npm install svgo@4.0.1
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-29074, 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.1), 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-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. 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
CVE-2026-29074 Affected Svgo Versions
3 component(s)References
Frequently Asked Questions
What is CVE-2026-29074?
Which Svgo versions are affected?
What version fixes CVE-2026-29074?
Is svgo affected?
What is the CVSS score of CVE-2026-29074?
What CWE is associated with CVE-2026-29074?
How can I check npm dependencies for CVE-2026-29074?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xpqw-6gx7-v673",
"modified" : "2026-03-06T21:58:08Z",
"published" : "2026-03-04T22:59:28Z",
"aliases" : [ "CVE-2026-29074" ],
"summary" : "SVGO DoS through entity expansion in DOCTYPE (Billion Laughs)",
"details" : "### Summary\n\nSVGO 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`.\n\n### Details\n\nThe upstream XML parser ([sax](https://www.npmjs.com/package/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`.\n\nHowever, entities can reference other entities, which can enable small SVGs to explode exponentially when we try to parse them.\n\n#### Proof of Concept\n\n```js\nimport { optimize } from 'svgo';\n\n/** Presume that this string was obtained in some other way, such as network. */\nconst original = `\n <?xml version=\"1.0\"?>\n <!DOCTYPE lolz [\n <!ENTITY lol \"lol\">\n <!ELEMENT lolz (#PCDATA)>\n <!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">\n <!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">\n <!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">\n <!ENTITY lol4 \"&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;\">\n <!ENTITY lol5 \"&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;\">\n <!ENTITY lol6 \"&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;\">\n <!ENTITY lol7 \"&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;\">\n <!ENTITY lol8 \"&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;\">\n <!ENTITY lol9 \"&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;\">\n ]>\n <lolz>&lol9;</lolz>\n`;\n\noptimize(original);\n```\n\n### Impact\n\nIf 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.\n\nIt's unlikely to impact users who just use SVGO locally on their own SVGs or in build pipelines.\n\n### Patches\n\nSVGO 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.\n\n### Workarounds\n\n#### == 4.0.0\n\nFor 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:\n\nFor example:\n\n```sh\nyarn up -R sax\n```\n\nNew options were introduced upstream which makes the way SVGO parses SVGs safe by default.\n\n#### >= 2.1.0, <= 3.3.2\n\nUsers 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.\n\nParse the DOCTYPE directly and check for the presence of custom entities. If entities are present, throw/escape before passing them to SVGO.\n\n```diff\n+ import SAX from 'sax';\n import { optimize } from 'svgo';\n\n- const original =`\n+ let original = `\n <?xml version=\"1.0\"?>\n <!DOCTYPE lolz [\n <!ENTITY lol \"lol\">\n <!ELEMENT lolz (#PCDATA)>\n <!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">\n <!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">\n <!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">\n <!ENTITY lol4 \"&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;\">\n <!ENTITY lol5 \"&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;\">\n <!ENTITY lol6 \"&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;\">\n <!ENTITY lol7 \"&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;\">\n <!ENTITY lol8 \"&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;\">\n <!ENTITY lol9 \"&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;\">\n ]>\n <lolz>&lol9;</lolz>\n `;\n\n+ const parser = SAX.parser();\n+ /** @param {string} doctype */\n+ parser.ondoctype = (doctype) => {\n+ original = original.replace(doctype, '');\n+ }\n+ parser.write(original);\n\n optimize(original);\n```\n\n### Resources\n\n* [Wikipedia: Billion laughs attack](https://en.wikipedia.org/wiki/Billion_laughs_attack)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "svgo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.1.0"
}, {
"fixed" : "2.8.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "svgo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "svgo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.1"
} ]
} ],
"versions" : [ "4.0.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/svg/svgo/security/advisories/GHSA-xpqw-6gx7-v673"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-29074"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/svg/svgo"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-776" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-04T22:59:28Z",
"nvd_published_at" : "2026-03-06T08:16:26Z"
}
}