CVE-2026-29074
XML Entity Expansion Vulnerability in SVGO Causing Crash
Publication date: 2026-03-06
Last updated on: 2026-03-10
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| svgo | svgo | From 2.1.0 (inc) to 2.8.1 (exc) |
| svgo | svgo | From 3.0.0 (inc) to 3.3.3 (exc) |
| svgo | svgo | From 4.0.0 (inc) to 4.0.1 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-776 | 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. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-29074 is a high-severity Denial of Service (DoS) vulnerability in the SVGO library, which is used to optimize SVG files. The vulnerability arises because SVGO accepts SVG files containing XML with custom entities without proper safeguards against recursive or exponential entity expansion.
Specifically, SVGOβs XML parser manually handles custom XML entities and allows them to expand recursively without limits. This can be exploited by a crafted SVG file as small as 811 bytes that uses nested entity definitions to cause exponential growth in memory usage.
As a result, the Node.js process running SVGO can stall or crash due to JavaScript heap out of memory errors, leading to denial of service.
How can this vulnerability impact me? :
This vulnerability can impact you by causing applications that use SVGO to process SVG files to stall or crash. Specifically, if your application processes untrusted SVG inputs, such as user-uploaded files on a server, an attacker can exploit this flaw to trigger excessive memory consumption and crash the Node.js process.
This leads to a denial of service condition, making the application unavailable or unstable.
Local or build pipeline usage of SVGO is less likely to be affected, but server-side or automated processing of SVG files is at risk.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
I don't know
How can this vulnerability be detected on my network or system? Can you suggest some commands?
[{'type': 'paragraph', 'content': 'This vulnerability can be detected by identifying SVG files that contain custom XML entities declared in the DOCTYPE section, which may cause recursive or exponential entity expansion when processed by SVGO.'}, {'type': 'paragraph', 'content': 'Since SVGO does not natively prevent entity expansion, one detection method is to pre-parse SVG files to check for the presence of custom entities before processing them with SVGO.'}, {'type': 'paragraph', 'content': 'There is no simple built-in flag in SVGO to disable entity expansion, so detection involves scanning SVG files for DOCTYPE declarations with ENTITY definitions.'}, {'type': 'paragraph', 'content': 'Suggested commands to detect potentially malicious SVG files include using tools like grep or xmllint to search for ENTITY declarations in SVG files, for example:'}, {'type': 'list_item', 'content': "grep -i '<!ENTITY' suspicious_file.svg"}, {'type': 'list_item', 'content': 'xmllint --noent suspicious_file.svg'}, {'type': 'paragraph', 'content': 'The first command searches for ENTITY declarations in the SVG file, which are indicative of potential recursive entity expansion. The second command attempts to expand entities and can help identify if the file triggers excessive resource usage.'}] [1]
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include upgrading SVGO to patched versions 2.8.1, 3.3.3, or 4.0.1, which incorporate safer parsing defaults that prevent unsafe XML entity expansion.
For users of SVGO version 4.0.0, upgrading the sax parser recursively via package managers (e.g., using the command `yarn up -R sax`) can apply upstream fixes that make parsing safe by default.
If upgrading is not immediately possible for versions 2.x and 3.x, a manual workaround involves pre-parsing SVG files to detect and reject those containing custom entities before passing them to SVGO.
Avoid processing untrusted or user-uploaded SVG files without prior validation to reduce the risk of denial of service caused by crafted SVG inputs.