Navigation Menu

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
3 participants