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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype pollution (Fixed) #26

Merged
merged 1 commit into from
Oct 21, 2020
Merged

Prototype pollution (Fixed) #26

merged 1 commit into from
Oct 21, 2020

Conversation

luci-m-666
Copy link
Contributor

Hi,
This package is vulnerable to prototype pollution.
POC

var {JsonPointer } = require("json-ptr")
var obj = {}
console.log("Before : " + obj.polluted);
JsonPointer.set(obj,'/__proto__/polluted','Yes! Its Polluted', true);
var obj1 ={}
console.log("After : " + obj1.polluted);

Fixed prototype pollution in util.ts.
Thanks

@flitbit flitbit merged commit 96cf9ce into flitbit:master Oct 21, 2020
@flitbit
Copy link
Collaborator

flitbit commented Oct 21, 2020

Thanks for the PR. I added a test; since pollution is now disallowed, I test that the error is thrown.

@flitbit
Copy link
Collaborator

flitbit commented Oct 21, 2020

Will be v2.0.0 shortly; seems it is potentially a breaking change if someone was using such pointers.

@luci-m-666
Copy link
Contributor Author

Glad to be of help.

@alromh87
Copy link

alromh87 commented Nov 5, 2020

Hello @luci-m-666 , I'm a little curious as it how you found prototype pollution in the library and how you came up with this exact lines:

https://github.com/418sec/json-ptr/pull/1/files#diff-3294a832ea2276e554177e0b3007cc2d401c082912c7fbde49fa09141bf1aed1R175-R177

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