GHSA-GJJ5-9665-RWRC

Vulnerability from github – Published: 2026-10-02 23:18 – Updated: 2026-10-02 23:18
VLAI
Summary
probe-image-size: Quadratic-time Denial of Service in the SVG Parser
Details

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/parse_sync/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/parse_stream/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:

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:

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
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 7.3.0"
      },
      "package": {
        "ecosystem": "npm",
        "name": "probe-image-size"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "7.4.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-104861"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333",
      "CWE-400"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-02T23:18:02Z",
    "nvd_published_at": "2026-10-02T18:17:02Z",
    "severity": "HIGH"
  },
  "details": "## Overview\n\n`probe-image-size` scans the SVG header with a searching regular expression, `/\u003c[-_.:a-zA-Z0-9][^\u003e]*\u003e/`. On input that contains many `\u003c` characters but no `\u003e`, the engine restarts the `[^\u003e]*` scan at every `\u003c` position and runs to end of input each time, giving quadratic time complexity.\n\nBoth the synchronous and the streaming parser are affected.\n\n## Impact\n\nEvery entry point that reaches the SVG parser is affected: `probe.sync()`, `probe(stream)` and `probe(url)`. The URL form is the most exposed one \u2014 the input is fetched from a remote host, so an attacker only needs to supply a link.\n\nProcessing 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.\n\n## Root Cause Analysis\n\nTwo independent problems.\n\n1. **Absence of input size cap in the sync path.** `lib/parse_sync/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.\n\n2. **Repeated rescanning in the stream path.** `lib/parse_stream/svg.js` did cap accumulated data at 64 KB, but called `parseSvg(str)` on the whole accumulated string on *every* chunk, giving `O(chunks \u00d7 N\u00b2)`. The cap does not help here: the more chunks the input is split into, the more times the quadratic scan is repeated.\n\n   Chunk size is influenced by the sender. `highWaterMark` (16 KB) is a buffering threshold, not a lower bound \u2014 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.\n\nThe original report identified (1) only, and stated that the 64 KB cap mitigates the streaming path. It does not.\n\n## Proof of Concept (PoC)\n\nSynchronous:\n\n```js\nconst probe = require(\u0027probe-image-size\u0027)\n\n// ~200 KB of \u0027\u003ca\u0027 \u2014 contains \u0027\u003c\u0027 but never \u0027\u003e\u0027\nprobe.sync(Buffer.from(\u0027\u003ca\u0027.repeat(100000), \u0027latin1\u0027))\n```\n\nStreaming \u2014 the same payload split into chunks, slower per byte than the synchronous form:\n\n```js\nconst { Readable } = require(\u0027stream\u0027)\nconst probe = require(\u0027probe-image-size\u0027)\n\nconst payload = Buffer.from(\u0027\u003ca\u0027.repeat(32768), \u0027latin1\u0027)\nconst chunks = []\nfor (let i = 0; i \u003c payload.length; i += 4096) chunks.push(payload.subarray(i, i + 4096))\n\nawait probe(Readable.from(chunks))\n```\n\nMeasurements on the maintainer\u0027s machine:\n\n| path | input | time |\n| --- | --- | --- |\n| `probe.sync()` | 25 KB | 0.9 s |\n| `probe.sync()` | 50 KB | 5.5 s |\n| `probe.sync()` | 100 KB | 18 s |\n| `probe.sync()` | 200 KB | 54 s |\n| `probe(stream)` | 64 KB, 1 chunk | 1.6 s |\n| `probe(stream)` | 64 KB, 4 chunks | 2.9 s |\n| `probe(stream)` | 64 KB, 16 chunks | 9.6 s |",
  "id": "GHSA-gjj5-9665-rwrc",
  "modified": "2026-10-02T23:18:02Z",
  "published": "2026-10-02T23:18:02Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nodeca/probe-image-size/security/advisories/GHSA-gjj5-9665-rwrc"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-104861"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodeca/probe-image-size/commit/60cc96ac0b671e79e328213d0a8e831312b09e84"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodeca/probe-image-size/commit/9b74656d6f973cc59ea2ab1375c0d88390a402ad"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodeca/probe-image-size/commit/c032aefabdecf5cb50548ab9ba175db56353078f"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nodeca/probe-image-size"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodeca/probe-image-size/releases/tag/7.4.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "probe-image-size: Quadratic-time Denial of Service in the SVG Parser"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…