CVE-2026-63501 in ag-psd
Summary
by MITRE • 11/03/2026
ag-psd is a JavaScript library for reading and writing Photoshop Document files. Prior to 31.0.3, readPsd() accepts a totalMemoryLimit for parsing untrusted PSD files, but decodeLayerImageData expects a differently named memoryLimit property and therefore passes an undefined limit to createImageDataBitDepth. An attacker who can supply a PSD to an application with layer decoding enabled can use attacker-controlled layer dimensions to trigger an allocation larger than the configured limit, causing process memory exhaustion and denial of service. The advisory also identifies inflateSync(compressed) decompressing ZIP-encoded channel data without an output-size cap, which can cause a similar denial of service through unbounded decompression. This vulnerability is fixed in 31.0.1.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/03/2026
The ag-psd library serves as a JavaScript implementation for parsing and generating Photoshop Document files, facilitating the reading and writing of PSD formats within web and Node.js environments. A critical security flaw exists in versions prior to 31.0.3 regarding how memory limits are enforced during the processing of untrusted input data. The vulnerability stems from an inconsistency in parameter handling between different stages of the parsing pipeline. Specifically, while the primary entry point readPsd() accepts a configuration option named totalMemoryLimit intended to cap resource consumption, the internal function decodeLayerImageData incorrectly expects a property named memoryLimit. Due to this naming mismatch, the layer decoding logic receives undefined for its limit check rather than the configured threshold. This discrepancy allows an attacker who can supply a malicious PSD file with specific layer dimensions to bypass the intended memory constraints. When such a file is processed by an application that has layer decoding enabled, the system attempts to allocate memory based on the attacker-controlled dimensions without effective upper bounds, leading to excessive process memory consumption and ultimately resulting in a denial of service condition for the host application or server.
Beyond the parameter mismatch issue, the advisory highlights another significant vulnerability related to data decompression within the same library version range. The function inflateSync is utilized to decompress ZIP-encoded channel data found within PSD files. This operation lacks an output-size cap, meaning it will continue allocating memory and processing CPU cycles until the compressed stream ends or system resources are exhausted. An attacker can craft a PSD file containing highly compressible but large amounts of ZIP-encoded data designed to trigger unbounded decompression. Similar to the layer dimension exploit, this vector leads to resource exhaustion through excessive memory allocation during the inflation process. Both vulnerabilities represent classic cases where input validation and limit enforcement fail due to implementation errors or missing safeguards against maliciously crafted inputs. These flaws align with CWE-787 Out-of-bounds Write in terms of memory impact and CWE-400 Uncontrolled Resource Consumption, as they allow an external actor to deplete system resources effectively causing a denial of service.
From the perspective of attack tactics, these vulnerabilities facilitate resource exhaustion attacks which are categorized under MITRE ATT&CK technique T1496 Resource Hijacking or more specifically Denial of Service via application layer exploitation. The ability to trigger memory exhaustion through malformed PSD files poses a severe risk to any service that processes user-uploaded images without strict sandboxing or resource limits at the infrastructure level. To mitigate these risks, organizations relying on ag-psd must immediately upgrade to version 31.0.3 or later where the parameter naming inconsistency has been resolved and proper limit enforcement is applied across all decoding paths including layer data and ZIP decompression streams. Additionally, defensive measures should include implementing strict file size limits at the network gateway level before files reach the application logic, validating PSD structures against known safe schemas using allowlists for expected dimensions and compression ratios where possible, and deploying runtime protection mechanisms such as memory usage monitoring to detect and terminate processes that exhibit abnormal resource consumption patterns indicative of exploitation attempts.