Deepmerge ts: DeepmergeTS has stack exhaustion when merging recursive object graphs (CVE-2026-40345)
The deepmerge-ts library versions prior to 8.0.0 contain a vulnerability where merging recursive object graphs causes unbounded recursion, leading to a stack exhaustion crash. This occurs because the merge functions do not detect cycles or track visited objects, resulting in a RangeError due to maximum call stack size exceeded. This can cause Node.js applications using these APIs to crash synchronously when attacker-controlled recursive objects are merged.
AI Analysis
Technical Summary
The deepmerge-ts library's merge functions (deepmerge, deepmergeInto, and their custom variants) recursively merge enumerable keys from input objects without cycle detection or tracking of visited object pairs. When both input objects contain self-references at the same property path, the recursion never terminates, causing a stack overflow and a RangeError in Node.js. This vulnerability affects versions prior to 8.0.0 and can be triggered by supplying crafted recursive object graphs through the public API.
Potential Impact
Applications using vulnerable versions of deepmerge-ts that merge attacker-controlled recursive objects can experience a synchronous crash due to stack exhaustion. In Node.js environments, this can terminate request handling or cause repeated worker process restarts, potentially leading to denial of service conditions.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade deepmerge-ts to version 8.0.0 or later where this issue is fixed. Until patched, avoid merging recursive object graphs or implement custom cycle detection before invoking the merge functions.
Deepmerge ts: DeepmergeTS has stack exhaustion when merging recursive object graphs (CVE-2026-40345)
Description
The deepmerge-ts library versions prior to 8.0.0 contain a vulnerability where merging recursive object graphs causes unbounded recursion, leading to a stack exhaustion crash. This occurs because the merge functions do not detect cycles or track visited objects, resulting in a RangeError due to maximum call stack size exceeded. This can cause Node.js applications using these APIs to crash synchronously when attacker-controlled recursive objects are merged.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The deepmerge-ts library's merge functions (deepmerge, deepmergeInto, and their custom variants) recursively merge enumerable keys from input objects without cycle detection or tracking of visited object pairs. When both input objects contain self-references at the same property path, the recursion never terminates, causing a stack overflow and a RangeError in Node.js. This vulnerability affects versions prior to 8.0.0 and can be triggered by supplying crafted recursive object graphs through the public API.
Potential Impact
Applications using vulnerable versions of deepmerge-ts that merge attacker-controlled recursive objects can experience a synchronous crash due to stack exhaustion. In Node.js environments, this can terminate request handling or cause repeated worker process restarts, potentially leading to denial of service conditions.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade deepmerge-ts to version 8.0.0 or later where this issue is fixed. Until patched, avoid merging recursive object graphs or implement custom cycle detection before invoking the merge functions.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-ggr8-5vv4-36mx
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-40345"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a833354bf8831d5392a4dfd
Added to database: 08/17/2026, 16:14:12 UTC
Last enriched: 08/17/2026, 16:27:57 UTC
Last updated: 08/17/2026, 22:06:46 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.