CVE-2026-104861 in probe-image-sizeinfo

Summary

by MITRE • 10/02/2026

probe-image-size gets image dimensions without downloading the entire file. Prior to 7.4.0, lib/parse_sync/svg.js and lib/parse_stream/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.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 10/02/2026

The vulnerability identified as CVE-2021-3918 represents a significant denial of service risk within the probe-image-size library for Node.js, specifically affecting versions prior to 7.4.0. This library is designed to determine image dimensions by inspecting file headers or initial data chunks without downloading entire files, which is generally an efficient operation. However, the implementation contains critical flaws in its handling of SVG (Scalable Vector Graphics) content that allow for algorithmic complexity attacks. The core issue lies within the synchronous and streaming parsers located in lib/parse_sync/svg.js and lib/parse_stream/svg.js respectively. These modules utilize a regular expression pattern defined as /<[-_.:a-zA-Z0-9][^>]*>/ to identify SVG tags. This regex is fundamentally flawed because it lacks backtracking protection or efficient matching strategies, leading to catastrophic performance degradation when processing maliciously crafted input.

When an attacker supplies data containing numerous less-than characters that are not followed by closing greater-than characters, the regular expression engine enters a state of excessive computation. In the synchronous parser, which operates via probe.sync(), the system attempts to scan and convert the full supplied buffer without any input cap or length limitation. This means that if a large amount of malformed SVG data is passed directly to this function, it will consume 100% of a single CPU core until the operation completes or times out, effectively blocking the Node.js event loop. Since Node.js relies on an asynchronous, non-blocking I/O model for handling concurrent requests, any synchronous blockage prevents the application from processing other incoming connections, leading to a complete service outage for all users connected to that instance.

The streaming parser presents an even more severe amplification vector through its chunked processing logic. In this mode, accessed via probe(stream) or probe(url), the library processes data as it arrives in chunks rather than waiting for the full file. The vulnerability manifests because the streaming parser reparses the complete accumulated SVG prefix from the beginning of the stream for every new chunk received. As more malicious chunks arrive, each containing many unclosed less-than signs, the amount of work required to re-evaluate the initial portion of the data grows quadratically or exponentially relative to the total input size. This recursive rescanning behavior allows an attacker with limited bandwidth to cause disproportionate CPU exhaustion on the server side by simply sending a steady stream of carefully crafted bytes that trigger repeated regex backtracking failures across all accumulated prefixes.

From a classification perspective, this vulnerability aligns closely with CWE-400, which describes uncontrolled resource consumption leading to denial of service conditions. The specific mechanism involves an inefficient regular expression implementation that fails to handle edge cases involving malformed markup, fitting the profile of CWE-1327 or similar regex-based DoS patterns often seen in web application firewalls and parsers. In terms of offensive security frameworks such as MITRE ATT&CK, this behavior can be categorized under T1496 Resource Hijacking, where an adversary uses computing resources to disrupt service availability rather than stealing data. The attack does not require authentication or complex exploitation chains; it relies solely on the transmission of specific byte sequences that exploit the parser's logic errors.

The operational impact of this vulnerability is severe for any application relying on probe-image-size to validate image uploads, particularly those accepting SVG files from untrusted sources such as user-generated content platforms, media processing pipelines, or API endpoints handling file submissions. An attacker can launch a low-cost denial-of-service attack that renders the target system unresponsive without needing high bandwidth or sophisticated tools. The lack of input caps in the synchronous parser and the quadratic complexity in the streaming parser mean that even moderate-sized inputs can cause significant latency spikes or complete crashes depending on server configuration and concurrency levels. This undermines the reliability and availability guarantees expected from modern web services, potentially causing financial loss and reputational damage due to prolonged downtime.

Mitigation strategies must prioritize immediate upgrading of the probe-image-size dependency to version 7.4.0 or later, where these parsing flaws have been addressed with more robust regex patterns and input handling mechanisms. For organizations unable to upgrade immediately due to legacy constraints, defensive coding practices should be implemented at the application layer. This includes enforcing strict size limits on uploaded SVG files before they are passed to the parser, thereby preventing large buffers from reaching the vulnerable code paths. Additionally, implementing timeouts for image processing operations can help mitigate the impact of blocking calls by terminating long-running requests that exceed a reasonable duration threshold. Input validation should also be strengthened to reject or sanitize inputs containing excessive special characters like unclosed less-than signs before they enter the parsing logic. Regular security audits and dependency scanning using tools such as npm audit are essential to detect and remediate such vulnerabilities in third-party libraries promptly, ensuring the overall resilience of the software supply chain against algorithmic complexity attacks.

Responsible

GitHub M

Reservation

10/02/2026

Disclosure

10/02/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!