Skip to content

Security Fix for Prototype Pollution - huntr.dev#16

Open
huntr-helper wants to merge 2 commits intobigShai:masterfrom
418sec:1-npm-extendify
Open

Security Fix for Prototype Pollution - huntr.dev#16
huntr-helper wants to merge 2 commits intobigShai:masterfrom
418sec:1-npm-extendify

Conversation

@huntr-helper
Copy link

https://huntr.dev/users/alromh87 has fixed the Prototype Pollution vulnerability 🔨. alromh87 has been awarded $25 for fixing the vulnerability through the huntr bug bounty program 💵. 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/extendify/1/README.md

User Comments:

📊 Metadata *

extendify is vulnerable to Prototype Pollution.
This package allowing for modification of prototype behavior, which may result in Information Disclosure/DoS/RCE.

Bounty URL: https://www.huntr.dev/bounties/1-npm-extendify

⚙️ 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 updating to latest lodash

🐛 Proof of Concept (PoC) *

  1. Create the following PoC file:
// poc.js
var extendify = require("extendify")
extend = extendify({isDeep: true});
const payload = JSON.parse('{"__proto__":{"polluted":"Yes! Its Polluted"}}');
var obj = {}
console.log("Before : " + {}.polluted);
extend(obj, payload);
console.log("After : " + {}.polluted);
  1. Execute the following commands in another terminal:
npm i extendify # Install affected module
node poc.js #  Run the PoC
  1. Check the Output:
Before : undefined
After : Yes! Its Polluted

Captura de pantalla de 2020-10-29 13-35-52

🔥 Proof of Fix (PoF) *

After fix execution will block prototype pollution and polluted will be undefined for new objects

Captura de pantalla de 2020-10-29 13-34-59

👍 User Acceptance Testing (UAT)

After fix functionality is unafected

@JamieSlome
Copy link

@bigShai - let me know if you have any questions or thoughts, cheers! 🍰

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