Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

CVE-2026-62297: CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd

CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd Vulnerability ID: CVE-2026-62297 CVSS Score: 7.5 Published: 2026-11-13 An uncontrolled memory allocation vulnerability exists in ag-psd

CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd

Vulnerability ID: CVE-2026-62297
CVSS Score: 7.5
Published: 2026-11-13

An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.

TL;DR

Versions of the JavaScript PSD parser library ag-psd prior to 31.0.0 allocate image buffers based directly on unvalidated width, height, and bit-depth fields in the PSD header. A crafted 52-byte payload can force the Node.js runtime to allocate over 3.35 GB of off-heap memory, causing immediate denial of service via Out-Of-Memory (OOM) crashes.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-62297 (GHSA-qfx6-q44v-9qqw)
  • Weakness Class: CWE-789: Memory Allocation with Excessive Size Value
  • CVSS v3.1 Score: 7.5 HIGH (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
  • EPSS Score: 0.34% (27.71st Percentile)
  • Affected Component: ag-psd (< 31.0.0) readPsd() / createImageDataBitDepth()
  • Impact: Denial of Service via 3.35+ GB Off-Heap OOM Exhaustion
  • Exploit Status: Public PoC Available (52-byte PSD payload)
  • CISA KEV Status: Not Listed

Affected Systems

  • ag-psd (npm package)
  • ag-psd: < 31.0.0 (Fixed in: 31.0.0)

Code Analysis

Commit: 2d7da68

Introduce totalMemoryLimit and useRawData options to mitigate uncontrolled memory allocation during PSD parsing.

Exploit Details

  • GitHub: Official commit containing the 52-byte base64 test vector in src/test/psdReader.spec.ts that triggers a 3.35 GB allocation.

Mitigation Strategies

  • Enforce strict memory allocation ceilings via the totalMemoryLimit reader option.
  • Defer bitmap allocation and decompression during initial parsing using useRawData: true and useRawThumbnail: true.
  • Validate composite document dimensions, bit depth, layer count, and individual layer bounding rectangles before decoding pixel data.
  • Isolate PSD parsing workloads in dedicated worker processes or ephemeral containers with strict OS-level cgroup limits.

Remediation Steps:

  1. Upgrade the ag-psd dependency to version 31.0.0 or later via npm install ag-psd@^31.0.0.
  2. Pass an explicit totalMemoryLimit option (e.g., 50 MB to 100 MB) to all readPsd() calls handling untrusted input instead of relying on the 2 GB default.
  3. Enable useRawData: true in readPsd() options to inspect psd.width, psd.height, and layer coordinates prior to invoking getCompositeImageData() or getLayerImageData().

References

Read the full report for CVE-2026-62297 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.