Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Fix for Prototype Pollution - huntr.dev #22

Merged
merged 3 commits into from
Oct 19, 2020

Conversation

huntr-helper
Copy link
Contributor

https://huntr.dev/users/alromh87 has fixed the Prototype Pollution vulnerability 馃敤. alromh87 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/master/bounties/npm/licia/1/README.md

User Comments:

馃搳 Metadata *

licia is a useful utility collection with zero dependencies used in nodejs. safeSet in this package is vulnerable to prototype pollution.

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

鈿欙笍 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 *

Fixed by avoiding setting magical attributes.

馃悰 Proof of Concept (PoC) *

  1. Install the package(npm i licia), run the below code:

safeSet

var licia = require('licia');
var src = {};
licia.safeSet(src, "__proto__.polluted", "pwned!");
console.log(polluted);

Outputs pwned!.

liciaPOC

extendDeep

var utils = require('licia');
var src = {};
let object = utils.extendDeep({}, JSON.parse('{ "myProperty": "a", "prototype" : { "isAdmin" : true } }'));
console.log(object.prototype.isAdmin);

Outputs true

licia2POC

馃敟 Proof of Fix (PoF) *

After fix polluted is not defined and prototype is unafected

Captura de pantalla de 2020-09-24 00-11-22

Captura de pantalla de 2020-09-24 15-29-06

馃憤 User Acceptance Testing (UAT)

After fix functionality is unafected

@JamieSlome
Copy link
Contributor

JamieSlome commented Oct 12, 2020

@surunzi - happy to answer your questions if you have any! 馃憤

@surunzi surunzi merged commit 8311e38 into liriliri:master Oct 19, 2020
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.

None yet

4 participants