Lodash: The Delete Button for the Universe (CVE-2025-13465)
Jan 22, 2026·6 min read·1 visit
Executive Summary (TL;DR)
Lodash versions prior to 4.17.23 fail to sanitize paths in `_.unset` and `_.omit`. An attacker supplying a path like `__proto__.toString` can delete the `toString` method from `Object.prototype`, causing every object in the running application to lose that method. This leads to immediate application crashes (DoS) or security bypasses if logic relies on the existence of specific prototype methods. The fix involves strict validation of path segments to block `__proto__` and `constructor` access.
A prototype pollution vulnerability in the ubiquitous Lodash library allows attackers to delete critical properties from the global Object prototype. Unlike traditional pollution which injects malicious properties, this flaw uses `_.unset` and `_.omit` to destructively remove core language methods (like `toString` or `hasOwnProperty`) via path traversal, causing widespread Denial of Service or logic failures.
The Hook: The Swiss Army Knife with a Loose Blade
Lodash is the duct tape of the JavaScript ecosystem. It is the library you reach for when you realize JavaScript's standard library is missing the tools you actually need to do your job. It handles deep cloning, debouncing, and, crucially for this story, object manipulation. We trust it implicitly. We feed it our user input, our JSON blobs, and our complex state objects, expecting it to behave deterministically.
But here is the thing about utility belts: if you pull the wrong lever, you might just detach the floor you are standing on. CVE-2025-13465 isn't your standard 'injection' vulnerability where we sneak in a script tag. It is a Prototype Pollution flaw, but with a nihilistic twist.
Usually, hackers use prototype pollution to add properties—polluting the water supply, so to speak. This vulnerability allows us to delete properties. We aren't adding poison to the well; we are evaporating the water entirely. By targeting _.unset or _.omit, we can reach into the very soul of the JavaScript runtime—Object.prototype—and rip out methods that the application needs to breathe.
The Flaw: Logic Without Guardrails
The root of this vulnerability lies in how Lodash interprets 'paths'. When you tell Lodash to unset a property at a.b.c, it has to traverse the object graph to find c. It does this by splitting the string into segments or accepting an array of keys. The underlying engine for this is a function called baseUnset.
In vulnerable versions (pre-4.17.23), baseUnset was entirely too trusting. It would happily accept path segments like __proto__ or constructor and prototype. It treated them as valid keys to traverse. It didn't pause to ask, "Wait, should I really be climbing up the inheritance chain into the global scope?"
Because JavaScript objects are mutable by default, and because almost everything in JavaScript inherits from Object, traversing up to Object.prototype gives you write access to the blueprint of every object in the system. The flaw isn't just that it traverses; it's that after traversing, it executes the delete operator. While delete cannot remove non-configurable properties, many vital methods on the prototype chain are, in fact, configurable.
The Code: Examining the Fix
Let's look at the smoking gun. The fix was applied in baseUnset. The developers had to introduce a strict validation loop that runs before any traversal happens. They couldn't just check the final key; they had to check every step of the path.
Here is the logic introduced in commit edadd452146f7e4bad4ea684e955708931d84d81:
// The Fix Logic
while (++index < length) {
var key = path[index];
// ... checks for non-string keys ...
// BLOCK 1: The Classic Proto
if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
return false;
}
// BLOCK 2: The Constructor Bypass
if (key === 'constructor' &&
(index + 1) < length &&
path[index + 1] === 'prototype') {
// ... strict checks for primitive roots ...
return false;
}
}Analysis:
__proto__Check: It explicitly looks for__proto__. If found, it ensures it's an "own" property (a real key on the object) rather than the inherited accessor. If it's the accessor, it bails.constructor.prototypeCheck: Attackers often bypass__proto__filters by going throughconstructor.prototype. The patch explicitly looks for this sequence. If it seesconstructorfollowed immediately byprototype, it hard-stops the operation.
This creates a whitelist of sorts—you can traverse anywhere except the forbidden zones of the prototype chain.
The Exploit: Deleting Reality
How do we weaponize this? We don't need RCE to ruin a sysadmin's day. A Denial of Service (DoS) via prototype deletion is often harder to debug than a crash. The application enters a "zombie state" where basic language features stop working.
Imagine a backend service that accepts a JSON payload to update user preferences. The code uses _.unset to remove restricted keys before saving.
The Setup:
const _ = require('lodash');
// The victim code
app.post('/update', (req, res) => {
let userInput = req.body;
// Developer tries to be safe by unsetting a specific field
// But 'userInput.fieldToRemove' is controlled by the attacker
_.unset(userInput.data, userInput.fieldToRemove);
});The Attack:
We send a payload where fieldToRemove is constructor.prototype.toString.
The Execution Flow:
- Lodash receives the path
['constructor', 'prototype', 'toString']. - It traverses
userInput.data.constructor, which isObject. - It traverses
.prototype, which isObject.prototype. - It executes
delete Object.prototype['toString'].
The Aftermath:
The next time any part of that Node.js process tries to cast an object to a string (e.g., inside a logging library, an error handler, or a template engine), it will fail. [object Object] is gone. The application throws TypeError: ... is not a function and crashes. If you have an auto-restarter, it creates a crash loop until the malicious payload is flushed.
The Impact: Why This Matters
You might think, "So it crashes, big deal." But consider the subtlety. You can delete hasOwnProperty.
Many security mechanisms rely on obj.hasOwnProperty('isAdmin') to verify data integrity. If you delete hasOwnProperty from the prototype, the check might throw an error (DoS) or, depending on the implementation (e.g., try/catch blocks that swallow errors), it might fail open.
Furthermore, this vulnerability impacts _.omit as well. If an application uses _.omit(req.body, blocklist), an attacker can craft a request that pollutes the prototype during the omission process. Since Lodash is the backbone of thousands of high-traffic enterprise applications, the blast radius is massive. It turns a simple data processing utility into a remote kill switch.
The Fix: Remediation
The remediation is straightforward but urgent. You must upgrade Lodash.
Primary Fix: Update to version 4.17.23 or later.
npm install lodash@latestDefense in Depth: Even with the patch, you should stop trusting objects. JavaScript provides tools to harden your environment against this class of bugs entirely:
Object.freeze(Object.prototype): At the very start of your application, freeze the prototype. This prevents any library from modifying or deleting core methods.- Use
Mapinstead of Objects: For hash maps where keys are user-controlled, use theMapstructure. It doesn't have a prototype chain to pollute. - Input Validation: Never allow users to define paths for property access. Validate that keys are alphanumeric and do not contain special property names.
Official Patches
Fix Analysis (1)
Technical Appendix
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:H/SI:H/SA:H/E:PAffected Systems
Affected Versions Detail
| Product | Affected Versions | Fixed Version |
|---|---|---|
lodash lodash | >= 4.0.0 < 4.17.23 | 4.17.23 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1321 |
| CVSS v4.0 | 6.9 (Medium) |
| Attack Vector | Network |
| Impact | Denial of Service / Logic Alteration |
| Affected Function | _.unset, _.omit |
| Exploit Status | PoC Available |
MITRE ATT&CK Mapping
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Known Exploits & Detection
Vulnerability Timeline
Subscribe to updates
Get the latest CVE analysis reports delivered to your inbox.