Skip to content

Conversation

@huntr-helper
Copy link

https://huntr.dev/users/d3v53c has fixed the Prototype Pollution vulnerability 🔨. Think you could fix a vulnerability like this?

Get involved at https://huntr.dev/

Q | A
Version Affected | ALL
Bug Fix | YES
Original Pull Request | 418sec#1
Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/npm/@feizheng/next-object-operator/1/README.md

User Comments:

📊 Metadata *

@feizheng/next-object-operator is vulnerable to Prototype Pollution. This package fails to restrict access to prototypes of objects, allowing for modification of prototype behavior using a proto payload, which may result in Sensitive Information Disclosure/Denial of Service(DoS)/Remote Code Execution.

Bounty URL: https://www.huntr.dev/bounties/1-npm-%40feizheng%2Fnext-object-operator

⚙️ Description *

Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects.
JavaScript allows all Object attributes to be altered, including their magical attributes such as proto, constructor and prototype.
An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values.
Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain.

💻 Technical Description *

Fixed by avoiding setting magical attributes. The bug is fixed by validating the input strArray to check for prototypes. It is implemented by a simple validation to check for prototype keywords (proto, constructor and prototype), where if it exists, the function returns the object without modifying it, thus fixing the Prototype Pollution Vulnerability.

🐛 Proof of Concept (PoC) *

Create the following PoC file:

// poc.js
var nextObjectOperator = require("@feizheng/next-object-operator")

const data = {};
const operator = new nextObjectOperator(data);

console.log("Before : " + {}.polluted);
operator.set('__proto__.polluted', 'Yes! Its Polluted')
console.log("After : " + {}.polluted);

Execute the following commands in another terminal:

npm i @feizheng/next-object-operator # Install affected module
node poc.js #  Run the PoC

Check the Output:

Before : undefined
After : Yes! Its Polluted

🔥 Proof of Fix (PoF) *

Before:

image

After:

image

👍 User Acceptance Testing (UAT)

image

After the fix, functionality is unaffected.

🔗 Relates to...

https://www.huntr.dev/bounties/1-npm-%40feizheng%2Fnext-object-operator/

d3v53c and others added 3 commits January 15, 2021 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants