Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Fix prototype pollution #1

Merged
merged 1 commit into from
Oct 9, 2020
Merged

Fix prototype pollution #1

merged 1 commit into from
Oct 9, 2020

Conversation

alromh87
Copy link

@alromh87 alromh87 commented Oct 9, 2020

📊 Metadata *

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

⚙️ Description *

js.merge package is vulnerable to prototype pollution issue

💻 Technical Description *

Fixed by adding missing magical attributes, to filter.
- if (key === '__proto__'){
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype'){

🐛 Proof of Concept (PoC) *

  1. Install the package, run the below code:
var mergelib = require('merge');
var obj = mergelib({}, JSON.parse('{ "testProperty": "hi", "prototype" : { "status" : "pwned!" } }'));
console.log(obj.prototype.status);

Outputs: pwned.

js mergePOC

🔥 Proof of Fix (PoF) *

After fix prototype.status is undefined
js mergePOF

👍 User Acceptance Testing (UAT)

After fix functionality is unafected

@alromh87 alromh87 changed the title ### 📊 Metadata * Fix prototype pollution Oct 9, 2020
@ghost ghost requested a review from JamieSlome October 9, 2020 13:23
@JamieSlome JamieSlome merged commit 869927f into 418sec:master Oct 9, 2020
@huntr-helper
Copy link
Member

Congratulations alromh87 - your fix has been selected! 🎉

Thanks for being part of the community & helping secure the world's open source code.
If you have any questions, please respond in the comments section, or hit us up on Discord. Your bounty is on its way - keep hunting!

Come join us on Discord

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants