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 in pathval #634

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions bounties/npm/pathval/1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Overview

pathval is `chaijs`'s package to retrieve Object value using a string path, this package is vulnerable to Prototype Pollution via the `setPathValue` function.

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. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

# Proof of Concept

```js
var pathval = require('pathval');

var obj = {};
console.log("Before:" + obj.polluted);
pathval.setPathValue(obj, '__proto__.polluted', 'pwned!');
console.log("After:" + polluted);
```
55 changes: 55 additions & 0 deletions bounties/npm/pathval/1/vulnerability.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"PackageVulnerabilityID": 1,
"DisclosureDate": "2020-09-13",
"AffectedVersionRange": "*",
"Summary": "Prototype Pollution",
"Contributor": {
"Discloser": "Asjidkalam",
"Fixer": ""
},
"Package": {
"Registry": "npm",
"Name": "pathval",
"URL": "https://github.com/chaijs/pathval/",
"Downloads": "11M"
},
"CWEs": [
{
"ID": "CWE-400",
"Description": ""
}
],
"CVSS": {
"Version": "3.1",
"AV": "N",
"AC": "H",
"PR": "N",
"UI": "N",
"S": "U",
"C": "L",
"I": "L",
"A": "L",
"E": "",
"RL": "",
"RC": "",
"Score": "5.6"
},
"CVEs": [
""
],
"Repository": {
"URL": "https://github.com/chaijs/pathval/",
"Codebase": [
"JavaScript"
],
"Owner": "chaijs",
"Name": "pathval",
"Forks": "6",
"Stars": "37"
},
"Permalinks": [
"https://github.com/chaijs/pathval/blob/master/index.js#L112",
Asjidkalam marked this conversation as resolved.
Show resolved Hide resolved
"https://github.com/chaijs/pathval/blob/master/index.js"
Asjidkalam marked this conversation as resolved.
Show resolved Hide resolved
],
"References": []
}