/

CVE-2026-29074

Severity:

HIGH RISK

(7.5)

XML Entity Expansion / Denial of Service in SVGO SVG

CVE-2026-29074

Modified

Vulnerability type

Category:

XML Entity Expansion / Denial of Service

CWE:

CWE-776

Impact:

Denial of Service via Resource Exhaustion

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SVGO, a popular Node.js SVG optimization library and CLI, processes XML input without restricting custom entity expansion or recursion.

Crafted SVG files using malicious XML entities can trigger excessive memory use, stalling the optimization process and potentially crashing the Node.js runtime with an out-of-memory error.

Affected context

This vulnerability affects applications and build pipelines that use SVGO versions:

  • 2.1.0 to < 2.8.1
  • 3.0.0 to < 3.3.3
  • < 4.0.1

The issue is most relevant where:

  • SVG or XML content is accepted from external or semi-trusted sources
  • SVGO runs automatically (e.g., during uploads, build steps, or image processing)
  • There are no upstream checks to reject or sanitize SVGs with custom XML entities

In these contexts, a small but malicious SVG can tie up CPU and memory, degrading service availability.

Exploit preconditions

  • Attack surface: Any feature or pipeline that passes SVG/XML input into SVGO, including:
  • Web upload endpoints that optimize images
  • CI/CD or asset build pipelines processing third-party SVGs
  • Developer tools that auto-run SVGO on opened or imported files
  • Required access: Ability to supply or influence an SVG file that will be processed by SVGO (remote or local, depending on the application).
  • Trigger point: The moment SVGO parses the XML and resolves custom entities during optimization.
  • Why exploitation is possible: The XML parser used by SVGO allows unrestricted entity expansion and recursion. A small, specially crafted SVG can expand into a very large in-memory structure, consuming excessive heap and causing process stalls or crashes.

Why this happens

The root cause aligns with CWE-776: Improper Restriction of Recursive Entity References in DTDs (XML Entity Expansion).

SVGO accepts XML input that includes custom entities defined via a document type definition (DTD), but it does not enforce limits on:

  • The depth of recursive entity references
  • The number of expansions
  • The overall size of the expanded content in memory

When a malicious SVG defines entities that reference each other repeatedly or expand exponentially, the XML parser tries to resolve them fully. This unbounded expansion leads to disproportionate memory and CPU consumption relative to the tiny input size. Abstractly, the insecure pattern is:

  • Trusting XML entities without limits
  • Allowing unbounded recursion or expansion during parsing in a performance-critical path

Potential impact

  • Node.js process may crash due to "JavaScript heap out of memory" errors.
  • Affected services can become unavailable until processes are restarted.
  • Resource exhaustion could cascade, causing slowdowns or failures in other components sharing the same host.
  • Automated build or deployment pipelines may fail, delaying releases or causing timeouts.
  • In multi-tenant environments, heavy resource use may impact neighboring workloads, depending on isolation controls.

General mitigation guidance

Effective mitigation focuses on limiting XML entity features and controlling resource use when handling SVG input:

  • Prefer XML parsers or configurations that:
  • Disable DTDs and external/custom entity expansion where not strictly needed.
  • Enforce limits on recursion depth, entity count, and total expansion size.
  • Treat SVG input as untrusted by default:
  • Introduce pre-filters that reject files containing DTD declarations or suspicious entity constructs.
  • Use allowlists for expected SVG structures and attributes instead of parsing arbitrary XML.
  • Isolate and constrain the SVGO execution environment:
  • Run SVG optimization in a separate, low-privilege process or container with strict memory and CPU limits.
  • Apply timeouts to optimization tasks to prevent long-running hangs.
  • Incorporate defense in depth:
  • Combine parser hardening, input validation, and runtime resource limits to reduce the impact of malformed or malicious SVGs.

How teams detect issues like this

Teams can detect and manage this class of vulnerability using a combination of code-focused and operational strategies:

  • Static analysis / configuration review:
  • Identify XML parsing libraries and check whether DTD and entity features are disabled or constrained.
  • Review code paths that pass untrusted SVG/XML data into SVGO without prior validation.
  • Code review signals:
  • Look for acceptance of arbitrary user-provided SVGs with automatic optimization.
  • Flag use of XML parsing configurations that allow external entities or unconstrained DTD processing.
  • Runtime and operational monitoring:
  • Monitor Node.js processes for spikes in memory and CPU usage during SVG processing.
  • Track repeated process crashes or "heap out of memory" errors related to asset optimization.
  • Automated tooling:
  • Use software composition analysis (SCA) tools to surface known XML entity expansion and DoS issues in third-party dependencies.
  • Enforce CI policies that fail builds when vulnerable versions of SVGO or similar libraries are present.

Sources

SourceLink
github.comgithub.com/svg/svgo/security/advisories/GHSA-xpqw-6gx7-v673
access.redhat.comaccess.redhat.com/errata/RHSA-2026:11856
access.redhat.comaccess.redhat.com/errata/RHSA-2026:11916
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13512
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13545
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13553
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13826
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19375
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19712
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21017
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21772
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22465
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24977
access.redhat.comaccess.redhat.com/errata/RHSA-2026:48085
access.redhat.comaccess.redhat.com/errata/RHSA-2026:5807
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6277
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6309
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6568
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6926
access.redhat.comaccess.redhat.com/errata/RHSA-2026:7110
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8483
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8484
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8490
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8491
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8493
access.redhat.comaccess.redhat.com/errata/RHSA-2026:9742
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-29074
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2445132
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-29074.json

Frequently asked

questions

Yes, if a remote user can upload or otherwise provide SVG files that your system processes with SVGO, they can potentially trigger this denial of service. The attack remains local if SVGs are only handled from trusted, internal sources.

An attacker needs the ability to influence an SVG that will be passed through SVGO—commonly via file upload, content submission, or integration points that import third-party SVG assets.

The safest pattern is to:

  • Use XML parsing configurations that disable DTDs and entity expansion where possible.
  • Enforce limits on recursion and expansion when XML entities cannot be fully disabled.
  • Treat SVGs as untrusted input and validate or sanitize them before optimization.

To prevent similar problems:

  • Standardize secure XML/SVG handling practices across your codebase (e.g., no DTDs in user-provided content).
  • Rely on hardened libraries and keep them updated as part of a regular dependency management process.
  • Include checks for XML entity expansion, resource exhaustion, and parser configuration in security reviews and automated CI pipelines.
Find out what's already
exploitable in your codebase.