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

Security fix for Prototype Pollution #1

Merged
merged 2 commits into from
Jan 22, 2021
Merged

Conversation

arjunshibu
Copy link

馃搳 Metadata *

xe-utils is vulnerable to Prototype Pollution.

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

鈿欙笍 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 { set } = require('xe-utils')
console.log(`Before: ${{}.polluted}`)
set({}, '__proto__.polluted', true)
console.log(`After: ${{}.polluted}`)
  1. Execute the following commands in terminal:
npm i xe-utils # Install affected module
node poc.js #  Run the PoC
  1. Check the Output:
Before: undefined
After: true

馃敟 Proof of Fix (PoF) *

image

+1 User Acceptance Testing (UAT)

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

Copy link

@mzfr mzfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@Mik317 Mik317 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 馃槃 馃嵃

Cheers,
Mik

@huntr-helper
Copy link
Member

Congratulations arjunshibu - 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
5 participants