Skip to content

GHSA-h726-x36v-rx45

Prototype Pollution in lodash.merge

High npm
Severity
High
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1321 Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Fix
4.6.2
Upgrade lodash.merge to this version or later

Description

Versions of lodash.merge before 4.6.2 are vulnerable to prototype pollution. The function merge may allow a malicious user to modify the prototype of Object via {constructor: {prototype: {...}}} causing the addition or modification of an existing property that will exist on all objects.

Recommendation

Update to version 4.6.2 or later.

Affected versions

npm

PackageVulnerableFixed in
lodash.merge
< 4.6.2
4.6.2

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

lodash.merge npm → 4.6.2

npm
npm install lodash.merge@4.6.2
yarn
yarn add lodash.merge@4.6.2
pnpm
pnpm add lodash.merge@4.6.2

Weakness

CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.

How to prevent it
  • Implementation: By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
  • Architecture and Design: By blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.
  • Implementation: When handling untrusted objects, validating using a schema can be used.
  • Implementation: By using an object without prototypes (via Object.create(null) ), adding object prototype attributes by accessing the prototype via the special attributes becomes impossible, mitigating this weakness.
  • Implementation: Map can be used instead of objects in most cases. If Map methods are used instead of object attributes, it is not possible to access the object prototype or modify it.

References

Timeline

  1. Last updated by the source
  2. Published
AdvisorySeverityWhy it's related
GHSA-2m96-9w4j-wgv7
Prototype Pollution in lodash.merge
High Also affects lodash.merge
GHSA-6wvx-3r32-xmcg
Forge: Prototype Pollution in forge.http cookie handling via a malicious Set-Cookie
Medium Same weakness, CWE-1321
GHSA-7648-jmwf-vw7j
systeminformation has prototype pollution in `networkStats()` via the interface name
Medium Same weakness, CWE-1321
GHSA-m2m5-rw3w-cwmj
ApostropheCMS: Client-side Prototype Pollution in apos.http.parseQuery leading to DOM-based XSS against authenticated users
Medium Same weakness, CWE-1321
GHSA-j5rq-xfvr-p969
ApostropheCMS: Authenticated projection-exclusion prototype-member deletion in @apostrophecms/db-connect causes process-wide denial of service
High Same weakness, CWE-1321
GHSA-97rh-rhh2-7vjv
Payload: Remote Code Execution through first-register
High Same weakness, CWE-1321
GHSA-4q55-j62x-fr9h
devalue: Malformed null-prototype object keys bypass __proto__ rejection via property-key coercion
Medium Same weakness, CWE-1321
GHSA-x97p-jq2g-jp4f
Axios: Prototype Pollution Gadget in axios toFormData Options
High Same weakness, CWE-1321
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor