CVE-2026-40345: Deepmerge ts DeepmergeTS Has Stack Exhaustion When Vulnerability
HIGHCVE-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.
CVE-2026-40345 at a Glance
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.
npm install deepmerge-ts@8.0.0
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
CVE-2026-40345 Affected Deepmerge ts Versions
1 component(s)| 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?
Which Deepmerge ts versions are affected?
What version fixes CVE-2026-40345?
Is deepmerge-ts affected?
What CWE is associated with CVE-2026-40345?
How can I check npm dependencies for CVE-2026-40345?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}