CVE-2026-4800: Lodash Lodash Vulnerable To Code Injection Vulnerability
HIGHCVE-2026-4800 is a HIGH (CVSS 8.1) lodash vulnerable to code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Lodash libraries in the npm ecosystem. The issue involves lodash vulnerable to code injection via `_.template` imports key names. Remediation is available by upgrading affected packages to version 4.18.0.
CVE-2026-4800 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-4800
To remediate this vulnerability, upgrade all affected Lodash dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install lodash@4.18.0
npm install lodash-es@4.18.0
npm install lodash-amd@4.18.0
npm install lodash.template@4.18.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls lodash
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-4800, inspect your project dependencies using npm:
npm ls lodash
Analyze the terminal output to locate any version of Lodash in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.18.0), your application is affected.
Note: The npm ls lodash command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Lodash, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-4800 Affected Lodash Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
lodash
|
npm |
≥ 4.0.0
< 4.18.0
|
4.18.0
|
|
lodash-es
|
npm |
≥ 4.0.0
< 4.18.0
|
4.18.0
|
|
lodash-amd
|
npm |
≥ 4.0.0
< 4.18.0
|
4.18.0
|
|
lodash.template
|
npm |
≥ 4.0.0
< 4.18.0
|
4.18.0
|
References
Frequently Asked Questions
What is CVE-2026-4800?
Which Lodash versions are affected?
What version fixes CVE-2026-4800?
Is lodash affected?
Is lodash-es affected?
What is the CVSS score of CVE-2026-4800?
What CWE is associated with CVE-2026-4800?
How can I check npm dependencies for CVE-2026-4800?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r5fr-rjxr-66jc",
"modified" : "2026-04-01T23:51:12Z",
"published" : "2026-04-01T23:51:12Z",
"aliases" : [ "CVE-2026-4800" ],
"summary" : "lodash vulnerable to Code Injection via `_.template` imports key names",
"details" : "### Impact\n\nThe fix for [CVE-2021-23337](https://github.com/advisories/GHSA-35jh-r3h4-6jhm) added validation for the `variable` option in `_.template` but did not apply the same validation to `options.imports` key names. Both paths flow into the same `Function()` constructor sink.\n\nWhen an application passes untrusted input as `options.imports` key names, an attacker can inject default-parameter expressions that execute arbitrary code at template compilation time.\n\nAdditionally, `_.template` uses `assignInWith` to merge imports, which enumerates inherited properties via `for..in`. If `Object.prototype` has been polluted by any other vector, the polluted keys are copied into the imports object and passed to `Function()`.\n\n### Patches\n\nUsers should upgrade to version 4.18.0.\n\nThe fix applies two changes:\n1. Validate `importsKeys` against the existing `reForbiddenIdentifierChars` regex (same check already used for the `variable` option)\n2. Replace `assignInWith` with `assignWith` when merging imports, so only own properties are enumerated\n\n### Workarounds\n\nDo not pass untrusted input as key names in `options.imports`. Only use developer-controlled, static key names.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "lodash"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.18.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.17.23"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "lodash-es"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.18.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.17.23"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "lodash-amd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.18.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.17.23"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "lodash.template"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.18.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/lodash/lodash/security/advisories/GHSA-r5fr-rjxr-66jc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-4800"
}, {
"type" : "WEB",
"url" : "https://github.com/lodash/lodash/commit/3469357cff396a26c363f8c1b5a91dde28ba4b1c"
}, {
"type" : "WEB",
"url" : "https://cna.openjsf.org/security-advisories.html"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-35jh-r3h4-6jhm"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/lodash/lodash"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-01T23:51:12Z",
"nvd_published_at" : "2026-03-31T20:16:29Z"
}
}