Vulnerabilities in pkg:npm/ag-psd

PACKAGE
Advisory Identifier: GHSA-qfx6-q44v-9qqw
Advisory Summary

CVE-2026-62297 is a HIGH (CVSS 7.5) ag-psd can exhaust memory when vulnerability (CWE-789: Memory Allocation with Excessive Size Value) affecting Ag psd libraries in the npm ecosystem. The issue involves ag-psd can exhaust memory when parsing crafted psd dimensions. Remediation is available by upgrading affected packages to version 31.0.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/ag-psd

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/ag-psd. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-qfx6-q44v-9qqw CVE-2026-62297 HIGH ag-psd can exhaust memory when parsing crafted PSD dimensions

CVE-2026-62297 at a Glance

CVE Identifier CVE-2026-62297
GHSA Identifier GHSA-qfx6-q44v-9qqw
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-789: Memory Allocation with Excessive Size Value
Affected Product Ag psd
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-62297

To remediate this vulnerability, upgrade all affected Ag psd dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ag-psd fixed: 31.0.0
npm install ag-psd@31.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls ag-psd

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-62297, inspect your project dependencies using npm:

npm ls ag-psd

Analyze the terminal output to locate any version of Ag psd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 31.0.0), your application is affected.

Note: The npm ls ag-psd command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-789: Memory Allocation with Excessive Size Value, where the product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated. In Ag psd, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-62297 Affected Ag psd Versions

1 component(s)
Fixed Versions:
31.0.0
Product / Package Ecosystem Affected Versions Fixed Version
ag-psd
npm
< 31.0.0
31.0.0

References

Frequently Asked Questions

What is CVE-2026-62297?
CVE-2026-62297 is a security vulnerability in Ag psd involving ag-psd can exhaust memory when parsing crafted PSD dimensions under CWE-789: Memory Allocation with Excessive Size Value.
Which Ag psd versions are affected?
Affected versions include releases prior to 31.0.0 across affected packages: ag-psd.
What version fixes CVE-2026-62297?
Upgrading to 31.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ag-psd affected?
Yes, ag-psd is affected in releases prior to 31.0.0. Upgrade your dependency to 31.0.0 or later.
What is the CVSS score of CVE-2026-62297?
CVE-2026-62297 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-62297?
CVE-2026-62297 is classified under CWE-789: Memory Allocation with Excessive Size Value (The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.).
How can I check npm dependencies for CVE-2026-62297?
Run the dependency tree command: 'npm ls ag-psd'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qfx6-q44v-9qqw",
  "modified" : "2026-11-13T23:19:38Z",
  "published" : "2026-11-13T23:19:38Z",
  "aliases" : [ "CVE-2026-62297" ],
  "summary" : "ag-psd can exhaust memory when parsing crafted PSD dimensions",
  "details" : "### Summary\nreadPsd() 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.\n\n### Impact\nOn 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.\n\nThis 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.\n\n### Steps to reproduce\nThe PoC is a 52-byte PSD (sha256 a1146a6fabdfef289472f99a56851249e7a46e8d19d4d8bf85fe833e2f0158b6). Reconstruct with:\n\n    base64 -d > poc.psd <<'EOF'\n    OEJQUwABAAAAAAAAAA0AADcuAAA58wAgAAMAAAAAAAAAAAAAAAAAAdEgNZv+i9bc9ygd2A==\n    EOF\n\nThen (commits ~3.17 GB before throwing a catchable RangeError):\n\n    const { readPsd } = require('ag-psd');\n    const buf = require('fs').readFileSync('poc.psd');\n    readPsd(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));\n\n### Root cause\npsdReader.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.\n\n### Suggested fix\nValidate the declared dimensions, channel count, depth, and per-layer rectangles against the actual input length (and a sane maximum) before allocating.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ag-psd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "31.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Agamnentzar/ag-psd/security/advisories/GHSA-qfx6-q44v-9qqw"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Agamnentzar/ag-psd/commit/2d7da68400990bae8ba248a065eb45021fa8000a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Agamnentzar/ag-psd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Agamnentzar/ag-psd/blob/2d7da68400990bae8ba248a065eb45021fa8000a/CHANGELOG.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Agamnentzar/ag-psd/tree/31.0.0"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/cve-2026-62297"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-789" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-13T23:19:38Z",
    "nvd_published_at" : "2026-10-30T21:17:13Z"
  }
}