GHSA-jggr-w7fw-pc2j: fast-copy Stack Exhaustion Vulnerability

MODERATE
CWE-674
Published
Advisory Summary

GHSA-jggr-w7fw-pc2j is a MODERATE stack exhaustion vulnerability (CWE-674: Uncontrolled Recursion) affecting fast-copy libraries in the npm ecosystem. The issue involves stack exhaustion in fast-copy when copying deeply-nested values. Remediation is available by upgrading affected packages to version 4.1.0, 3.1.0, 2.2.0.

GHSA-jggr-w7fw-pc2j at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-jggr-w7fw-pc2j
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product fast-copy
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-jggr-w7fw-pc2j

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

fast-copy fixed: 4.1.0
npm install fast-copy@4.1.0
fast-copy fixed: 3.1.0
npm install fast-copy@3.1.0
fast-copy fixed: 2.2.0
npm install fast-copy@2.2.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 fast-copy

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-jggr-w7fw-pc2j, inspect your project dependencies using npm:

npm ls fast-copy

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

Note: The npm ls fast-copy 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In fast-copy, 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 `fast-copy` traverses values recursively with no bound on depth. Copying a sufficiently deeply-nested value exhausts the JavaScript call stack and throws a native `RangeError: Maximum call stack size exceeded` from inside the library. ## Details Both `copy` and `copyStrict` recurse once per level of nesting. The value does not need to be circular (circular references were already handled correctly via an internal cache) and it does not need to be large. A plain object nested a few thousand levels deep is only a few kilobytes of equivalent JSON. Measured depths at which copying begins to fail (Node.js, V8; the exact ceiling varies with JIT state and the stack available to the environment): | Call | Last depth that copies successfully | | -------------------- | ----------------------------------- | | `copy(object)` | 2811 | | `copy(array)` | 3983 | | `copyStrict(object)` | 1874 | | `copyStrict(array)` | 1874 | `JSON.parse` is iterative and parses deeply-nested input without difficulty, so a payload that deserializes cleanly can fail in a subsequent `copy` call. ## Impact The failure is a synchronous, catchable `RangeError` confined to the `copy` call that received the value. There are no memory safety concerns, no data exposure, and no effect on state outside that call. In a typical server the result is a failed request rather than a failed process. Applications that call `copy` on externally-supplied data, such as request bodies, cached payloads, merged configuration, etc., do not expect a clone helper to throw may surface this as an unhandled error. ## Patches Fixed in 4.1.0, and backported to 3.1.0 and 2.2.0 so that every major line has a patch available without requiring a breaking upgrade. Traversal is now bounded by a `maxDepth` option, defaulting to `1000`, which sits below the native limit in standard environments. Exceeding it throws `MaxDepthExceededError`, which carries the limit that was exceeded and extends `RangeError` so existing handling continues to match. The limit is configurable for consumers with legitimately deep data. On `3.x` and `4.x` it is set when creating a copier: ```js import { createCopier } from 'fast-copy'; export const copy = createCopier({ maxDepth: 5000 }); ``` On `2.x` it is passed per call, and the error is a property of the exported function rather than a named export: ```js import copy from 'fast-copy'; copy(value, { maxDepth: 5000 }); // detection: error instanceof copy.MaxDepthExceededError ``` In legacy environments without `Object.setPrototypeOf`, `instanceof MaxDepthExceededError` cannot be supported; check `error.name === 'MaxDepthExceededError'` or `error instanceof RangeError` instead.

GHSA-jggr-w7fw-pc2j Affected fast-copy Versions

3 component(s)
Fixed Versions:
4.1.03.1.02.2.0
Product / Package Ecosystem Affected Versions Fixed Version
fast-copy
npm
≥ 4.0.0
< 4.1.0
4.1.0
fast-copy
npm
≥ 3.0.0
< 3.1.0
3.1.0
fast-copy
npm
< 2.2.0
2.2.0

References

Frequently Asked Questions

What is GHSA-jggr-w7fw-pc2j?
GHSA-jggr-w7fw-pc2j is a security vulnerability in fast-copy involving Stack exhaustion in fast-copy when copying deeply-nested values under CWE-674: Uncontrolled Recursion.
Which fast-copy versions are affected?
Affected versions include releases prior to 4.1.0, 3.1.0, 2.2.0 across affected packages: fast-copy.
What version fixes GHSA-jggr-w7fw-pc2j?
Upgrading to 4.1.0, 3.1.0, 2.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fast-copy affected?
Yes, fast-copy is affected in releases prior to 4.1.0, 3.1.0, 2.2.0. Upgrade your dependency to 4.1.0, 3.1.0, 2.2.0 or later.
What CWE is associated with GHSA-jggr-w7fw-pc2j?
GHSA-jggr-w7fw-pc2j is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check npm dependencies for GHSA-jggr-w7fw-pc2j?
Run the dependency tree command: 'npm ls fast-copy'. 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-jggr-w7fw-pc2j",
  "modified" : "2026-10-05T22:52:09Z",
  "published" : "2026-10-05T22:52:09Z",
  "aliases" : [ ],
  "summary" : "fast-copy: Stack exhaustion in fast-copy when copying deeply-nested values",
  "details" : "## Summary\n\n`fast-copy` traverses values recursively with no bound on depth. Copying a sufficiently deeply-nested value exhausts the JavaScript call stack and throws a native `RangeError: Maximum call stack size exceeded` from inside the library.\n\n## Details\n\nBoth `copy` and `copyStrict` recurse once per level of nesting. The value does not need to be circular (circular references were already handled correctly via an internal cache) and it does not need to be large. A plain object nested a few thousand levels deep is only a few\nkilobytes of equivalent JSON.\n\nMeasured depths at which copying begins to fail (Node.js, V8; the exact ceiling varies with JIT state and the stack available to the environment):\n\n| Call                 | Last depth that copies successfully |\n| -------------------- | ----------------------------------- |\n| `copy(object)`       | 2811                                |\n| `copy(array)`        | 3983                                |\n| `copyStrict(object)` | 1874                                |\n| `copyStrict(array)`  | 1874                                |\n\n`JSON.parse` is iterative and parses deeply-nested input without difficulty, so a payload that deserializes cleanly can fail in a subsequent `copy` call.\n\n## Impact\n\nThe failure is a synchronous, catchable `RangeError` confined to the `copy` call that received the value. There are no memory safety concerns, no data exposure, and no effect on state outside that call. In a typical server the result is a failed request rather than a failed process.\n\nApplications that call `copy` on externally-supplied data, such as request bodies, cached payloads, merged configuration, etc., do not expect a clone helper to throw may surface this as an unhandled error.\n\n## Patches\n\nFixed in 4.1.0, and backported to 3.1.0 and 2.2.0 so that every major line has a patch available without requiring a breaking upgrade.\n\nTraversal is now bounded by a `maxDepth` option, defaulting to `1000`, which sits below the native limit in standard environments. Exceeding it throws `MaxDepthExceededError`, which carries the limit that was exceeded and extends `RangeError` so existing handling continues to match.\n\nThe limit is configurable for consumers with legitimately deep data. On `3.x` and `4.x` it is set when creating a copier:\n\n```js\nimport { createCopier } from 'fast-copy';\n\nexport const copy = createCopier({ maxDepth: 5000 });\n```\n\nOn `2.x` it is passed per call, and the error is a property of the exported function rather than a named export:\n\n```js\nimport copy from 'fast-copy';\n\ncopy(value, { maxDepth: 5000 });\n// detection: error instanceof copy.MaxDepthExceededError\n```\n\nIn legacy environments without `Object.setPrototypeOf`, `instanceof MaxDepthExceededError` cannot be supported; check `error.name === 'MaxDepthExceededError'` or `error instanceof RangeError` instead.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fast-copy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fast-copy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fast-copy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/security/advisories/GHSA-jggr-w7fw-pc2j"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/pull/137"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/pull/138"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/pull/139"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/commit/359c00884ae8ae31f10925fd0e2fc66661db6cef"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/commit/caa7caace65767dfe252f0dc5115d82c99ca16b9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/commit/dedf465e5329fbd149f13b53521af962d16ff8df"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/planttheidea/fast-copy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/releases/tag/v2.2.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/releases/tag/v3.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/planttheidea/fast-copy/releases/tag/v4.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T22:52:09Z",
    "nvd_published_at" : null
  }
}