lukeed / dset

A tiny (194B) utility for safely writing deep Object values~!
MIT License
754 stars 22 forks source link

Security Fix for Prototype Pollution - huntr.dev #16

Closed huntr-helper closed 3 years ago

huntr-helper commented 3 years ago

https://huntr.dev/users/arjunshibu 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 | https://github.com/418sec/dset/pull/1 Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/npm/dset/1/README.md

User Comments:

:bar_chart: Metadata *

dset is vulnerable to Prototype Pollution.

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

:gear: 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.

:computer: Technical Description *

Fix implemented by not allowing to modify object prototype.

:bug: Proof of Concept (PoC) *

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

:fire: Proof of Fix (PoF) *

dset

+1 User Acceptance Testing (UAT)

lukeed commented 3 years ago

Thank you for the fix @arjunshibu

I'd be happy to work with you (personally) again in the future, but I do not want bot accounts within the repository. I hope you are still able to collect the bounty.

JamieSlome commented 3 years ago

@lukeed - great to see the commit included! Just out of curiosity, is there any specific reason you aren't crazy about a bot account being included as a contributor in the repository?

Cheers! 🍰

arjunshibu commented 3 years ago

Thank you for the fix @arjunshibu

I'd be happy to work with you (personally) again in the future, but I do not want bot accounts within the repository. I hope you are still able to collect the bounty.

Thanks @lukeed πŸ˜€

lukeed commented 3 years ago

Hey @JamieSlome – just that a bot removes the personal aspect of collaboration. @arjunshibu did the work – I'd like for him to get credit for it, not a company/service acting on his behalf.