Vulnerabilities in pkg:npm/deepmerge-ts

PACKAGE
Advisory Identifier: GHSA-ggr8-5vv4-36mx
Advisory Summary

CVE-2026-40345 is a HIGH deepmergets has stack exhaustion when vulnerability (CWE-674: Uncontrolled Recursion) affecting Deepmerge ts libraries in the npm ecosystem. The issue involves deepmergets has stack exhaustion when merging recursive object graphs. Remediation is available by upgrading affected packages to version 8.0.0.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/deepmerge-ts

2 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-ggr8-5vv4-36mx CVE-2026-40345 HIGH DeepmergeTS has stack exhaustion when merging recursive object graphs
GHSA-r9w3-g83q-m6hq CVE-2022-24802 HIGH Prototype Pollution in deepmerge-ts

CVE-2026-40345 at a Glance

CVE Identifier CVE-2026-40345
GHSA Identifier GHSA-ggr8-5vv4-36mx
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Deepmerge ts
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-40345

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

deepmerge-ts fixed: 8.0.0
npm install deepmerge-ts@8.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 deepmerge-ts

How to Check if You Are Affected

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

npm ls deepmerge-ts

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

Note: The npm ls deepmerge-ts 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 Deepmerge ts, 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 `deepmerge()` and `deepmergeInto()` can be crashed with a crafted recursive object graph. When both merged values contain self-references at the same property path, the library recurses until Node throws `RangeError: Maximum call stack size exceeded`. ### Details Record merging is implemented recursively. For each enumerable key, the library collects the values from every input object and immediately calls the same merge routine on that property. There is no visited-object tracking, pair tracking, or cycle detection in that recursion. As a result, if two merged records both point back to themselves through the same key path, the merge logic keeps revisiting the same object pair forever. This is reachable through the real public API: * `deepmerge(...)` * `deepmergeCustom(...)(...)` * `deepmergeInto(target, ...)` * `deepmergeIntoCustom(...)(target, ...)` The issue only occurs when recursive object graphs are supplied. Plain JSON alone does not create this condition. ### PoC ```js import { deepmerge, deepmergeInto } from "deepmerge-ts"; const left = {}; left.self = left; const right = {}; right.self = right; try { deepmerge(left, right); } catch (error) { console.log(error.name, error.message); // Expected: the merge should reject or safely handle recursive input without exhausting the stack. // Vulnerable behavior: RangeError Maximum call stack size exceeded } const target = {}; target.self = target; const source = {}; source.self = source; try { deepmergeInto(target, source); } catch (error) { console.log(error.name, error.message); // Expected: the merge should reject or safely handle recursive input without exhausting the stack. // Vulnerable behavior: RangeError Maximum call stack size exceeded } ``` ### Impact Applications that pass attacker-controlled recursive object graphs into these APIs can be forced into a synchronous crash path. In Node.js services, that can terminate request handling for the affected process or trigger repeated worker restarts until the malicious input is blocked.

CVE-2026-40345 Affected Deepmerge ts Versions

1 component(s)
Fixed Versions:
8.0.0
Product / Package Ecosystem Affected Versions Fixed Version
deepmerge-ts
npm
< 8.0.0
8.0.0

References

Frequently Asked Questions

What is CVE-2026-40345?
CVE-2026-40345 is a security vulnerability in Deepmerge ts involving DeepmergeTS has stack exhaustion when merging recursive object graphs under CWE-674: Uncontrolled Recursion.
Which Deepmerge ts versions are affected?
Affected versions include releases prior to 8.0.0 across affected packages: deepmerge-ts.
What version fixes CVE-2026-40345?
Upgrading to 8.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is deepmerge-ts affected?
Yes, deepmerge-ts is affected in releases prior to 8.0.0. Upgrade your dependency to 8.0.0 or later.
What CWE is associated with CVE-2026-40345?
CVE-2026-40345 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 CVE-2026-40345?
Run the dependency tree command: 'npm ls deepmerge-ts'. 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-ggr8-5vv4-36mx",
  "modified" : "2026-08-17T13:32:13Z",
  "published" : "2026-08-17T13:32:13Z",
  "aliases" : [ "CVE-2026-40345" ],
  "summary" : "DeepmergeTS has stack exhaustion when merging recursive object graphs",
  "details" : "### Summary\n\n`deepmerge()` and `deepmergeInto()` can be crashed with a crafted recursive object graph. When both merged values contain self-references at the same property path, the library recurses until Node throws `RangeError: Maximum call stack size exceeded`.\n\n### Details\n\nRecord merging is implemented recursively. For each enumerable key, the library collects the values from every input object and immediately calls the same merge routine on that property.\n\nThere is no visited-object tracking, pair tracking, or cycle detection in that recursion. As a result, if two merged records both point back to themselves through the same key path, the merge logic keeps revisiting the same object pair forever.\n\nThis is reachable through the real public API:\n\n* `deepmerge(...)`\n* `deepmergeCustom(...)(...)`\n* `deepmergeInto(target, ...)`\n* `deepmergeIntoCustom(...)(target, ...)`\n\nThe issue only occurs when recursive object graphs are supplied. Plain JSON alone does not create this condition.\n\n### PoC\n\n```js\nimport { deepmerge, deepmergeInto } from \"deepmerge-ts\";\n\nconst left = {};\nleft.self = left;\n\nconst right = {};\nright.self = right;\n\ntry {\n  deepmerge(left, right);\n} catch (error) {\n  console.log(error.name, error.message);\n  // Expected: the merge should reject or safely handle recursive input without exhausting the stack.\n  // Vulnerable behavior: RangeError Maximum call stack size exceeded\n}\n\nconst target = {};\ntarget.self = target;\n\nconst source = {};\nsource.self = source;\n\ntry {\n  deepmergeInto(target, source);\n} catch (error) {\n  console.log(error.name, error.message);\n  // Expected: the merge should reject or safely handle recursive input without exhausting the stack.\n  // Vulnerable behavior: RangeError Maximum call stack size exceeded\n}\n```\n\n### Impact\n\nApplications that pass attacker-controlled recursive object graphs into these APIs can be forced into a synchronous crash path. In Node.js services, that can terminate request handling for the affected process or trigger repeated worker restarts until the malicious input is blocked.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "deepmerge-ts"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/RebeccaStevens/deepmerge-ts/security/advisories/GHSA-ggr8-5vv4-36mx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/RebeccaStevens/deepmerge-ts"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/RebeccaStevens/deepmerge-ts/releases/tag/v8.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-17T13:32:13Z",
    "nvd_published_at" : null
  }
}