Prototype pollution attack (lutils-merge)
The lutils-merge npm package recursively copies objects without guarding special keys, so a crafted JSON input can add properties to Object.prototype. An attacker who controls merged input could pollute every object in the process, which the reporter says may lead to denial of service or remote code execution in some cases.
- Triaged in 5 days
- Fixed in 36 days
- Disclosed after 36 days
Hi team, I would like to report a prototype pollution vulnerability in lutils-merge that allows an attacker to inject properties on Object.prototype.
Module
module name: lutils-merge
version: 0.2.6
npm page: https://www.npmjs.com/package/lutils-merge
Module Description
Merge javascript objects recursively.
Module Stats
79 downloads in the last week
Vulnerability
Vulnerability Description
this vulnerability type is similar to my report #438274 lutils-merge is vulnerable to prototype pollution when it performs a recursive copy of the specified objects.
Steps To Reproduce:
In the following code snippet, "payload" would come from user-input (JSON data).
var merge = require('lutils-merge');
var payload = '{"__proto__":{"polluted":"merge_done !"}}';
var test = {};
console.log("Before: ", test.polluted);
merge({},JSON.parse(payload));
console.log("After: ", test.polluted);
# Wrap up
- I contacted the maintainer to let them know: N
- I opened an issue in the related repository: N
Thanks!
## Impact
It causes Denial of Service or RCE in some cases.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
The reporter states it causes denial of service or, in some cases, remote code execution, though no exploitation beyond the pollution itself is demonstrated.
What the attacker needed
Attacker-controlled JSON is merged; application uses lutils-merge 0.2.6
How it was found
- Load the lutils-merge module and prepare a JSON payload that contains a __proto__ key.
- Parse the payload and merge it into an empty object.
- Observe that a separate empty object now shows the injected property.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
JavaScript objects inherit shared defaults from a built-in object called Object.prototype. If a library copies user-supplied data into an object without blocking the special key __proto__, an attacker can add their own defaults that then appear on almost every object in the program. That can break the application or, in some setups, be turned into code execution.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.