GHSA-qfx6-q44v-9qqw: ag-psd has uncontrolled memory allocation via declared PSD dimensions (DoS)
ag-psd is a JavaScript library for reading and writing Photoshop Document files. Before the allocation-limit remediation attempt in version 31.0.0, readPsd() commits image and layer buffers from attacker-declared PSD geometry before validating the declarations against the actual available data or sane allocation limits. The psdReader.js implementation sizes off-heap typed arrays using width, height, channels, depth and per-layer rectangles, so a tiny PSD declaring enormous geometry can force multi-gigabyte memory allocation before a later bounds error. The reported 52-byte input on Node 24 produced approximately 3.17 GB peak RSS before a RangeError; under memory pressure the process can be terminated before the error can be caught, and concurrent inputs can exhaust memory. Services reading untrusted PSDs are exposed to denial of service. This differs from genuinely large PSD files whose memory demand is proportional to real input content. Version 31.0.0 adds a composite-image allocation limit, but complete coverage of the separately described layer-rectangle allocation path is not established and requires curator residual/scope review.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
ag-psdto a version that resolves this vulnerability.Fixed in 31.0.0
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Services that call readPsd() on PSD files supplied by untrusted users are exposed. A remote attacker can submit a very small PSD that declares enormous image or layer geometry and cause the process to consume memory.
Does exploitation require authentication or user interaction?
No. The supplied severity vector indicates network reachability, low attack complexity, no privileges required, and no user interaction.
What happens during exploitation?
ag-psd can allocate multi-gigabyte typed-array buffers based on attacker-declared dimensions before it detects invalid input. The process may be terminated under memory pressure before the later RangeError can be caught, and concurrent malicious inputs can exhaust available memory.
Is upgrading to version 31.0.0 sufficient?
Version 31.0.0 adds a limit for composite-image allocations. Complete protection for the separate layer-rectangle allocation path is not established, so its residual exposure requires review.
What can be done if patching is not immediately possible?
Do not process untrusted PSD files in the affected service. Where such processing is required, isolate it and enforce resource limits to reduce the impact of excessive memory allocation.