Skip to main content
Vulnerability Database/CVE-2026-104861

CVE-2026-104861: probe-image-size DOS Vulnerability

CVE-2026-104861 is a denial of service vulnerability in probe-image-size that allows attackers to block the Node.js event loop through malicious SVG input. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-104861 Overview

CVE-2026-104861 is a regular expression denial of service (ReDoS) vulnerability [CWE-400] in the probe-image-size Node.js library. Versions prior to 7.4.0 use the regular expression /<[-_.:a-zA-Z0-9][^>]*>/ in lib/parse_sync/svg.js and lib/parse_stream/svg.js. Attacker-controlled input containing many < characters without matching > causes the engine to repeatedly scan to the end of the buffer. The synchronous parser processes the full buffer with no input cap. The streaming parser reparses the entire accumulated SVG prefix on every received chunk, which amplifies CPU cost. The probe.sync(), probe(stream), and probe(url) entry points can block the Node.js event loop at full CPU.

Critical Impact

Remote, unauthenticated attackers can stall or crash Node.js services that use probe-image-size to inspect user-supplied images, exhausting CPU and blocking the event loop.

Affected Products

  • probe-image-size versions prior to 7.4.0
  • Node.js applications invoking probe.sync() on untrusted buffers
  • Node.js applications invoking probe(stream) or probe(url) on attacker-controlled sources

Discovery Timeline

  • 2026-10-02 - CVE-2026-104861 published to NVD
  • 2026-10-02 - Last updated in NVD database

Technical Details for CVE-2026-104861

Vulnerability Analysis

The vulnerability is an algorithmic complexity flaw in the SVG header parser. The regular expression /<[-_.:a-zA-Z0-9][^>]*>/ is unanchored. When input contains many < characters and no >, the regex engine retries the match from every < position and scans forward to the end of input on each attempt. The result is quadratic scanning behavior over the buffer length. In the streaming path, probe-image-size reparses the full accumulated SVG prefix for every incoming chunk. An attacker who controls chunk boundaries can further amplify total work.

Root Cause

Two design decisions combine to produce the issue. First, the parser applies an unanchored search regex that does not use disjoint prefixes or linear-time constructs. Second, neither parser caps the input length before matching, so hostile input of arbitrary size reaches the regex engine. The streaming parser compounds this by reprocessing the entire accumulated prefix on each chunk event instead of incremental state.

Attack Vector

The attack is network-reachable and requires no authentication or user interaction. An attacker submits a crafted SVG payload (or a response masquerading as an image fetched by probe(url)) consisting of many < characters without closing >. The Node.js event loop stalls at full CPU for the duration of the match. Repeated requests exhaust server CPU and deny service to other clients.

javascript
// Security patch in lib/parse_sync/svg.js and lib/parse_stream/svg.js (commit c032aef)
// Caps the SVG parser input length to 10 KB in both sync and stream paths.

// max size for pre-svg-tag comments plus svg tag itself
-var MAX_DATA_LENGTH = 65536
+var MAX_DATA_LENGTH = 10240

// Added to lib/parse_sync/svg.js:
+// max size for pre-svg-tag comments plus svg tag itself
+var MAX_DATA_LENGTH = 10240

Source: GitHub Commit c032aef

javascript
// Security patch in lib/parse_stream/svg.js (commit 9b74656)
// Restricts IDENTIFY_RE scan length so leading whitespace cannot be unbounded.

-var IDENTIFY_RE = /^\s*(?:<|$)/
+var IDENTIFY_RE = new RegExp('^\\s{0,' + MAX_DATA_LENGTH + '}(?:<|$)')

Source: GitHub Commit 9b74656

javascript
// Security patch in lib/common/svg_header.js (commit 60cc96a)
// Rewrites SVG header parsing as a shared module with anchored, linear regexes.

+// All regexps below are anchored (`^`) and applied at a known offset, so the
+// engine never rescans the input from every position. Alternatives inside
+// PROLOG_RE have disjoint prefixes (`\s`, `<?`, `<!--`, `<![CDATA[`, `<!`+letter),
+// which keeps the repetition deterministic.

+var pi      = '<[?][\\s\\S]*?[?]>'
+var comment = '<!--(?:[^-]|-[^-]|--[^>])*-->'
+var cdata   = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'
+var doctype = '<![A-Za-z][^[>]*(?:\\[[\\s\\S]*?\\][^>]*)?>'

+var PROLOG_RE = new RegExp('^(?:\\s+|' + pi + '|' + comment + '|' + cdata + '|' + doctype + ')*')

Source: GitHub Commit 60cc96a

Detection Methods for CVE-2026-104861

Indicators of Compromise

  • Sustained 100% CPU usage on a single Node.js worker thread while processing uploaded or fetched image data.
  • HTTP requests delivering SVG or image/* payloads containing long runs of < characters with no corresponding >.
  • Event loop lag metrics spiking during image upload or URL-fetch operations handled by probe-image-size.

Detection Strategies

  • Inventory Node.js projects and lockfiles for probe-image-size at versions below 7.4.0 using software composition analysis.
  • Inspect application logs for repeated timeouts or request cancellations on endpoints that accept image uploads or URLs.
  • Sample inbound image payloads at the proxy or WAF for anomalous ratios of < to > characters within SVG content.

Monitoring Recommendations

  • Track Node.js event loop lag and per-request CPU time; alert when image-processing routes exceed baseline by a defined threshold.
  • Enforce request timeouts on upload and URL-fetch endpoints to bound worst-case processing time.
  • Centralize web server, application, and process metrics in a security data lake to correlate CPU spikes with request payload patterns.

How to Mitigate CVE-2026-104861

Immediate Actions Required

  • Upgrade probe-image-size to version 7.4.0 or later in all Node.js projects and rebuild dependent container images.
  • Audit transitive dependencies with npm ls probe-image-size or yarn why probe-image-size to find indirect usage.
  • Enforce size limits on uploaded images and on bodies returned by probe(url) fetches before invoking the parser.

Patch Information

The maintainers fixed CVE-2026-104861 in probe-image-size 7.4.0. The fix spans three commits: 60cc96a rewrites SVG header parsing as a shared module with anchored, linear-time regexes; 9b74656 restricts the IDENTIFY_RE scan length; and c032aef caps SVG parser input to 10 KB in both sync and stream paths. See the GitHub Security Advisory GHSA-gjj5-9665-rwrc for full details.

Workarounds

  • Cap request body size at the HTTP layer (for example, express.json({ limit: '64kb' }) or reverse-proxy client_max_body_size) before invoking probe-image-size.
  • Reject payloads whose declared Content-Type is image/svg+xml at the perimeter if SVG support is not required.
  • Run image parsing in a worker thread or separate process with a strict wall-clock timeout to contain event loop stalls.
bash
# Upgrade probe-image-size to the patched release
npm install probe-image-size@^7.4.0

# Verify the resolved version in the dependency tree
npm ls probe-image-size

# Audit for the advisory across the project
npm audit

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.