CVE-2026-104861: probe-image-size: Quadratic-time Denial of Service in the SVG Parser

Published Oct 2, 2026
·
Updated

Overview

probe-image-size scans the SVG header with a searching regular expression, /<[-.:a-zA-Z0-9][^>]>/. On input that contains many < characters but no >, the engine restarts the [^>] scan at every < position and runs to end of input each time, giving quadratic time complexity.

Both the synchronous and the streaming parser are affected.

Impact

Every entry point that reaches the SVG parser is affected: probe.sync(), probe(stream) and probe(url). The URL form is the most exposed one — the input is fetched from a remote host, so an attacker only needs to supply a link.

Processing a crafted buffer blocks the Node.js event loop at 100% CPU for the whole duration. In production environments such as upload validators, image proxies or link unfurl services, a small number of concurrent requests is enough to deny service.

Root Cause Analysis

Two independent problems.

1. Absence of input size cap in the sync path. lib/parsesync/svg.js copied the entire buffer into a string and matched against it. There was no size limit at all, so cost scaled with the size of the attacker-supplied buffer.

2. Repeated rescanning in the stream path. lib/parsestream/svg.js did cap accumulated data at 64 KB, but called parseSvg(str) on the whole accumulated string on every chunk, giving O(chunks × N²). The cap does not help here: the more chunks the input is split into, the more times the quadratic scan is repeated.

Chunk size is influenced by the sender. highWaterMark (16 KB) is a buffering threshold, not a lower bound — a socket read returns whatever has arrived. A server that writes one byte at a time produces one-byte chunks; this was confirmed against the real needle pipeline with default options.

The original report identified (1) only, and stated that the 64 KB cap mitigates the streaming path. It does not.

Proof of Concept (PoC)

Synchronous:

js const probe = require('probe-image-size')

// ~200 KB of '<a' — contains '<' but never '>' probe.sync(Buffer.from('<a'.repeat(100000), 'latin1'))

Streaming — the same payload split into chunks, slower per byte than the synchronous form:

js const { Readable } = require('stream') const probe = require('probe-image-size')

const payload = Buffer.from('<a'.repeat(32768), 'latin1') const chunks = [] for (let i = 0; i < payload.length; i += 4096) chunks.push(payload.subarray(i, i + 4096))

await probe(Readable.from(chunks))

Measurements on the maintainer's machine:

| path | input | time | | --- | --- | --- | | probe.sync() | 25 KB | 0.9 s | | probe.sync() | 50 KB | 5.5 s | | probe.sync() | 100 KB | 18 s | | probe.sync() | 200 KB | 54 s | | probe(stream) | 64 KB, 1 chunk | 1.6 s | | probe(stream) | 64 KB, 4 chunks | 2.9 s | | probe(stream) | 64 KB, 16 chunks | 9.6 s |

Other sources

probe-image-size gets image dimensions without downloading the entire file. Prior to 7.4.0, lib/parsesync/svg.js and lib/parsestream/svg.js use the searching regular expression /<[-.:a-zA-Z0-9][^>]>/, which repeatedly scans to the end of input when attacker-controlled data contains many less-than characters without a closing greater-than character. The synchronous parser converts and scans the full supplied buffer without an input cap, while the streaming parser reparses the complete accumulated SVG prefix for every received chunk. The probe.sync(), probe(stream), and probe(url) entry points can therefore block the Node.js event loop at full CPU, and attacker-controlled chunking can amplify the streaming cost. This issue is fixed in version 7.4.0.

— MITRE

Affected Software

2 affected componentsFixes available
npm/probe-image-size<7.4.0
npm/probe-image-size<=7.3.0
7.4.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/probe-image-size to a version that resolves this vulnerability.

    Fixed in 7.4.0
  2. Upgrade

    Upgrade probe-image-size to a version that resolves this vulnerability.

    Fixed in 7.4.0

Event History

Oct 2, 2026
CVE Published
via MITRE·05:56 PM
Data Sourced
via MITRE·05:56 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:17 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·11:18 PM
Data Sourced
via GitHub·11:18 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which applications are realistically exposed to this denial-of-service issue?

Applications using probe-image-size before 7.4.0 are exposed when they pass attacker-controlled SVG content to probe.sync(), probe(stream), or probe(url). The impact is blocking the Node.js event loop at full CPU.

2

What input is required to trigger the issue?

An attacker needs to supply SVG data containing many less-than characters without a closing greater-than character. For streaming use, attacker-controlled chunk boundaries can further amplify the processing cost because the accumulated SVG prefix is reparsed for each chunk.

3

Is the synchronous parser affected differently from streaming use?

Yes. The synchronous parser converts and scans the full supplied buffer without an input cap, while the streaming parser repeatedly reparses the complete accumulated prefix as chunks arrive. Both behaviors can cause quadratic-time processing.

4

What version fixes the vulnerability?

Upgrade probe-image-size to version 7.4.0 or later. The issue affects versions prior to 7.4.0.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203