probe-image-size turned tiny EXIF structures into event-loop stalls
probe-image-size before 7.5.0 contains two denial of service issues in image metadata parsing. CVE-2026-134164 describes self-referencing EXIF IFD pointers that make a crafted 9.6 KB JPEG block the Node.js event loop for about 23 seconds. CVE-2026-134166 describes WebP parsing that can buffer an attacker-declared EXIF chunk length without a practical bound.
Applications use this package to learn an image's dimensions before processing it. That looks like a small metadata operation, which is why it often runs on the request path with generous time and memory limits. The parser follows offsets and lengths inside the file, so the cost of the work is controlled by the input structure rather than by the compressed file size.
A 23-second stall in a single Node.js worker can back up unrelated requests. Repeated submissions can consume the worker pool across many instances. The WebP buffering case points to a different failure mode: memory growth driven by a declared length. Either outcome can degrade the service before anyone opens the image in an editor.
Upgrade to 7.5.0 and find direct and transitive dependents. The package may be reached through upload handlers, URL preview services, media libraries, or link scanners. Compare the resolved dependency tree in each service, not only the root application manifest. Restart long-lived processes after the change.
Add limits around metadata probing. Run parsing in a worker or subprocess with a short deadline and a separate memory ceiling. Reject unsupported or oversized inputs before the library call. Do not let a parser task hold a database transaction or an HTTP worker indefinitely.
The EXIF logic should track visited IFD offsets and cap traversal depth. The WebP path should compare the declared chunk length with the remaining input and a configured maximum before allocating. These checks are parser-level fixes. The package update supplies them, while the deployment needs to prevent an old copy from remaining reachable through a bundled dependency.
Monitor slow image-probe requests, worker restarts, heap growth, and queue depth. Capture a bounded sample of the offending file hash and metadata structure in a controlled store. Do not keep unbounded attacker files in production logs. A hash is enough to find duplicates and compare with staging tests.
Build a regression test corpus with cyclic EXIF pointers, nested IFD loops, declared lengths beyond EOF, chunk lengths that conflict with the container size, and normal images from each supported format. Run the corpus under the same timeout and memory limits used in production. A successful parse is less useful than a clean rejection within the budget.
Image metadata handling sits on a boundary between untrusted bytes and shared application processes. The update fixes known paths. Isolation and resource limits keep the next parser problem from becoming a full service interruption.
Top comments (0)