Skip to content

Security Fix for Prototype Pollution - huntr.dev#1

Open
huntr-helper wants to merge 3 commits into
korel-san:masterfrom
418sec:1-npm-doc-path
Open

Security Fix for Prototype Pollution - huntr.dev#1
huntr-helper wants to merge 3 commits into
korel-san:masterfrom
418sec:1-npm-doc-path

Conversation

@huntr-helper
Copy link
Copy Markdown

https://huntr.dev/users/ljharb has fixed the Prototype Pollution vulnerability 🔨. @ljharb 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/staging/bounties/npm/doc-path/1/README.md

User Comments:

📊 Metadata *

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

⚙️ Description *

Note that the link describes pollution via .prototype and .constructor, neither of which are actually "prototype pollution". Mutating a shared object is supposed to be visible across the environment. However, __proto__ is the one that can be unintentional and cause these kind of issues.

Note: in node 0.10, obj['__proto__'] incorrectly does obj.__proto__, which is different according to the spec, so Object.getOwnPropertyDescriptor is needed.

When the key is __proto__ and is not an own property, use Object.defineProperty to create it, avoiding accidental pollution of the [[Prototype]].

💻 Technical Description *

See above.

🐛 Proof of Concept (PoC) *

See the test case.

🔥 Proof of Fix (PoF) *

npm test

👍 User Acceptance Testing (UAT)

npm test

🔗 Relates to...

418sec/huntr#747

ljharb and others added 3 commits January 3, 2021 22:50
See https://www.huntr.dev/bounties/1-npm-doc-path/

Note that the link describes pollution via `.prototype` and
`.constructor`, neither of which are actually "prototype pollution".
Mutating a shared object is *supposed* to be visible across the
environment. However, `__proto__` is the one that can be unintentional
and cause these kind of issues.

Note: in node 0.10, `obj['__proto__']` incorrectly does `obj.__proto__`,
which is different according to the spec, so
Object.getOwnPropertyDescriptor is needed.
[Fix] fix prototype pollution vuln
@JamieSlome
Copy link
Copy Markdown

@korel-san - 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