8000 Security fix for Prototype Pollution by arjunshibu · Pull Request #1 · 418sec/NestedObjectAssign · GitHub
[go: up one dir, main page]

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

Security fix for Prototype Pollution #1

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

arjunshibu
Copy link
@arjunshibu arjunshibu commented Jan 28, 2021

📊 Metadata *

nested-object-assign is vulnerable to Prototype Pollution.

Bounty URL: https://www.huntr.dev/bounties/1-npm-nested-object-assign

⚙️ 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 *

Fix implemented by not allowing to modify object prototype.

🐛 Proof of Concept (PoC) *

  1. Create the following PoC file:
// poc.js
const assign = require('nested-object-assign')

console.log('Before: ' + {}.polluted)
assign({}, JSON.parse('{"__proto__": {"polluted": true}}'))
console.log('After: ' + {}.polluted)
  1. Execute the following commands in terminal:
npm i nested-object-assign # Install vulnerable package
node poc.js #  Run the PoC
  1. Check the Output:
Before: undefined
After: true

🔥 Proof of Fix (PoF) *

I've added unit tests for Prototype Pollution

image

+1 User Acceptance Testing (UAT)

  • I've executed unit tests.
  • After fix the functionality is unaffected.

@huntr-helper
Copy link

👋 Hello, @eirhor - @arjunshibu has opened a PR to us with a fix for a potential vulnerability in your repository. To view the vulnerability, please refer to the bounty URL in the first comment, above.

Ultimately, you get to decide if the fix is 👍 or 👎. If you are happy with the fix, please write a new comment (@huntr-helper - LGTM) and we will open a PR to your repository with the fix. All remaining PRs for this vulnerability will be automatically closed.

If you have any questions or need support, come and join us on our community Discord!

@eirhor & @arjunshibu - thank you for your efforts in securing the world’s open source code! 🎉

huntr-helper pushed a commit to 418sec/huntr that referenced this pull request Jan 28, 2021
@eirhor
Copy link
eirhor commented Jan 28, 2021

@huntr-helper - LGTM

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
0