[GHSA-p6mc-m468-83gw] Prototype Pollution in lodash #2884
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates
Comments
Added function names
The root cause of this vulnerability is internal function
baseSet
, which is used by multiple public functions in addition tozipObjectDeep
. This pull request adds those additional vulnerable functions to the description, as they may not be obvious to analysts determining if their codebase is affected. For example, https://hackerone.com/reports/864701 is essentially a duplicate of the HackerOne report that created this CVE due to the shared root cause. However, it was awarded a bounty (and received a separate Snyk entry) because it is not obvious from the older HackerOne disclosure or CVE description thatset
andsetWith
are also affected by the same bug.This is the PoC I've been using to check affected versions:
For completeness' sake,
pickBy
also usesbaseSet
, but it isn't vulnerable because it iterates over a list of enumerable properties and doesn't access arbitrary paths provided in the function call.Affected versions
Lower bound
The above PoC found that the oldest vulnerable version of Lodash is 3.7.0, which introduces the
set
function (with vulnerable functionality eventually moving tobaseSet
). All the other vulnerable functions were added later.pick
is technically older thanset
but its behavior matches that of the not vulnerablepickBy
until lodash/lodash@fd526e8 in v4.0.0.Upper bound
The PoC above found that the fix was added in 4.17.17:
4.17.17 also matches the patch version listed in SNYK-JS-LODASH-608086, which was created in response to the second HackerOne disclosure of this vulnerability.
However the Lodash changelog lists the fix under 4.17.19 and says that versions 4.17.16–4.17.18 were corrupted (which doesn't match my current experience, but whatever).
lodash-es doesn't have releases for versions 4.17.16–4.17.19, so its earliest patched version would be 4.17.20. I was unable to find an issue in this repository explaining the discrepancy in affected version between the advisory details (4.17.19) and metadata (4.17.20), but I'm assuming it's because NVD has no way to differentiate lodash and lodash-es given that they're the same library with differing packaging.
References
Replaced the link to a deleted GitHub issue with an archive link and added a link to https://hackerone.com/reports/864701, which is a second disclosure for this vulnerability focusing on
set
andsetWith
.