# CVE-2026-62297: ag-psd can exhaust memory when parsing crafted PSD dimensions

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.61% (percentile 43, 2026-11-28)
- **CWE:** CWE-789
- **Aliases:** GHSA-qfx6-q44v-9qqw
- **Published:** 2026-11-13T23:19:38.000Z
- **Modified:** 2026-11-13T23:19:41.000Z

## Who should check

- Projects that depend on npm package ag-psd (\< 31.0.0)

## Description

\#\#\# Summary
readPsd() commits the image/layer buffers from the declared header geometry (width x height x channels x depth, and per-layer rectangles) before validating those values against the actual data. A tiny crafted PSD declaring huge geometry forces a multi-gigabyte allocation.

\#\#\# Impact
On ag-psd 30.2.0, Node 24, a 52-byte PSD makes readPsd(buf) commit ~3.17 GB (measured peak RSS) in ~0.45 s before throwing a catchable RangeError ("Offset is outside the bounds of the DataView") — about 61,000,000x amplification. Because the buffer is committed before validation, the allocation OOM-kills the process before the error on essentially any host (uncatchable), and concurrent requests exhaust memory. Any service reading untrusted PSDs with ag-psd is exposed to a remote DoS.

This is distinct from \#39 and \#206, which involve genuinely large PSDs (memory proportional to real data). Here the input is 52 bytes: the file declares enormous geometry that is never present, so the allocation is driven by an unvalidated header field, not by actual content, an uncontrolled-allocation denial-of-service vulnerability, not proportional memory use.

\#\#\# Steps to reproduce
The PoC is a 52-byte PSD (sha256 a1146a6fabdfef289472f99a56851249e7a46e8d19d4d8bf85fe833e2f0158b6). Reconstruct with:

    base64 -d \> poc.psd \<\<'EOF'
    OEJQUwABAAAAAAAAAA0AADcuAAA58wAgAAMAAAAAAAAAAAAAAAAAAdEgNZv+i9bc9ygd2A==
    EOF

Then (commits ~3.17 GB before throwing a catchable RangeError):

    const { readPsd } = require('ag-psd');
    const buf = require('fs').readFileSync('poc.psd');
    readPsd(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));

\#\#\# Root cause
psdReader.js sizes the off-heap typed-array buffers from the declared header dimensions (and per-layer rectangles, a second independent lever) before validating against the available bytes.

\#\#\# Suggested fix
Validate the declared dimensions, channel count, depth, and per-layer rectangles against the actual input length (and a sane maximum) before allocating.

## Affected and fixed versions

- npm `ag-psd`: affected \< 31.0.0; fixed 31.0.0 (ghsa)

## Technologies

npm packages

## Mitigation

- Upgrade ag-psd to 31.0.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-62297. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-62297.md
Affected: ag-psd < 31.0.0
Fixed in: 31.0.0

Steps:
1. Search this machine and project for ag-psd (npm): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-62297 being exploited?

There is no confirmed exploitation: CVE-2026-62297 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.61% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-62297?

High: CVSS 7.5 (v3.1, scored by GitHub). Remote, no login needed.

### Which versions are affected by CVE-2026-62297?

ag-psd \< 31.0.0.

### Is there a fix for CVE-2026-62297?

Yes. Fixed in 31.0.0. Upgrade ag-psd to 31.0.0 or later.

### How do I check if I'm affected by CVE-2026-62297?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/Agamnentzar/ag-psd/security/advisories/GHSA-qfx6-q44v-9qqw>
- patch: <https://github.com/Agamnentzar/ag-psd/commit/2d7da68400990bae8ba248a065eb45021fa8000a>
- other: <https://github.com/Agamnentzar/ag-psd/blob/2d7da68400990bae8ba248a065eb45021fa8000a/CHANGELOG.md>
- other: <https://github.com/Agamnentzar/ag-psd/tree/31.0.0>
- other: <https://nvd.nist.gov/vuln/detail/cve-2026-62297>
- other: <https://github.com/advisories/GHSA-qfx6-q44v-9qqw>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-qfx6-q44v-9qqw> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-62297> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-62297>
