[supermixer] Prototype pollution
The supermixer npm package merges objects in a way that lets a crafted JSON input add properties to the base JavaScript object prototype. An attacker could then influence other objects in the running application, with impact depending on how the code is used.
- Fixed in 4 days
- Disclosed after 4 days
I would like to report a Prototype pollution in supermixer, It allows an attacker to modify the prototype of a base object which can vary in severity depending on the implementation.
Module
module name: supermixer
version: 1.0.3
npm page: https://www.npmjs.com/package/supermixer
Module Description
Mixes/merges/extends your object in multiple ways.
Unlike underscore/lodash utility methods this module allows you to:
- mix or deep merge objects' prototype chain. Regular mixin/extend/assign implementations can't do that.
- mix or deep merge unique properties only. I.e. data will not be overwritten if a property already exists.
- filter each individual property by target value, source value, and key. See API.
- transform each value by resulting value, source value, and key. See API.
Module Stats
[577] weekly downloads
Vulnerability
Vulnerability Description
Prototype Pollution is a vulnerability affecting JavaScript, Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects.
Steps To Reproduce:
var mixer = require('supermixer');
var payload = '{"__proto__":{"poc":"evil"}}';
var test = {};
console.log("Before: ", test.poc);
mixer.merge({},JSON.parse(payload));
console.log("After: ", test.poc);
Wrap up
Select Y or N for the following statements:
- I contacted the maintainer to let them know: [N]
- I opened an issue in the related repository: [N]
Impact
DoS, Access to restricted data, rce (depends on implementation)
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
Root cause
Likely the merge routine copies keys such as __proto__ from untrusted input without filtering them, so the base object's prototype is modified.
Impact
Depending on how the library is used, this could lead to denial of service, access to restricted data, or remote code execution.
What the attacker needed
Attacker-controlled input passed to merge; application uses supermixer 1.0.3
How it was found
- Load the supermixer module in a Node.js script.
- Build a JSON string containing a nested __proto__ key with a test property.
- Parse the JSON and pass it to the merge function with an empty object as target.
- 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 'prototype' object. If a library copies user-supplied keys into that shared prototype, every object in the program can suddenly carry the attacker's values. Here the merge function did not block the special key that points at the prototype.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.