lukeed / dset

A tiny (194B) utility for safely writing deep Object values~!
MIT License
754 stars 22 forks source link

Prototype pollution vulnerability in merge function #33

Closed spratt closed 2 years ago

spratt commented 2 years ago

A vulnerability detection tool I use is flagging the merge function, and particularly this line: https://github.com/lukeed/dset/blob/master/src/merge.js#L9

The tool says that the function is vulnerable to prototype pollution as per this paper: https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf

Reading through the code and the paper, it seems like there is a check to mitigate prototype pollution in the dset function that uses merge, but not in merge itself. Would the merge function benefit from such a check? Or would that break something?

Thanks, Simon

n1ru4l commented 2 years ago

I created a PR for this: https://github.com/lukeed/dset/pull/34

lukeed commented 2 years ago

Closed by #34 and #38

matthewtusker commented 1 month ago

44 suggests that the vulnerability still exists.