Skip to content

check all the keys for prototype pollution#6

Merged
ahdinosaur merged 1 commit into
ahdinosaur:masterfrom
erik-krogh:patch-1
Apr 21, 2022
Merged

check all the keys for prototype pollution#6
ahdinosaur merged 1 commit into
ahdinosaur:masterfrom
erik-krogh:patch-1

Conversation

@erik-krogh

Copy link
Copy Markdown
Contributor

An prototype-pollution attack was still possible with the previous fix for CVE-2022-25354.
The method would crash, but the attack was still successful.

PoC:

let obj = { foo: { bar: 'baz' } }
try {
  obj = setIn(obj, ['__proto__', 'polluted'], 'success');
} catch (e) {
  console.error(e);
}
console.log(({}).polluted);

An prototype-pollution attack was still possible with the previous fix.  
The method would crash, but the attack was still successful. 
PoC: 
```JavaScript
let obj = { foo: { bar: 'baz' } }
try {
  obj = setIn(obj, ['__proto__', 'polluted'], 'success');
} catch (e) {
  console.error(e);
}
console.log(({}).polluted);
```
@ahdinosaur

Copy link
Copy Markdown
Owner

wow, silly me! 😅

thanks @erik-krogh, i appreciate your pull request 💜

@ahdinosaur ahdinosaur merged commit d87c1a0 into ahdinosaur:master Apr 21, 2022
@ahdinosaur

Copy link
Copy Markdown
Owner

added another commit to clean things up: 34842cc. (this code should have the same effect, unless i'm being clueless again) 🧼

then published as 2.0.4 📦

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.

2 participants