What’s Vulnerable › Vulnerabilities
CVE-2026-4800: lodash vulnerable to Code Injection via `_.template` imports key names
- Severity: critical (CVSS 9.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 2.8% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2026-03-31 · updated 2026-10-15
- Weakness: CWE-94
Description
The fix for CVE-2021-23337 added validation for the variable option in _.template but did not apply the same validation to options.imports key names, and both paths flow into the same Function() constructor sink. When 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. Additionally, _.template uses assignInWith to merge imports, which enumerates inherited properties via for..in, so if Object.prototype has been polluted by another vector the polluted keys are copied into the imports object and passed to Function(). The issue is fixed in 4.18.1 for lodash, lodash-es, lodash-amd, and lodash.template. As a workaround, do not pass untrusted input as key names in options.imports; use only developer-controlled, static key names.
Affected products
- lodash: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- lodash-amd: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- lodash-es: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- lodash.template: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- Npm Lodash: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- Npm Lodash-Amd: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- Npm Lodash-Es: from 4.0.0 before 4.18.0 — fixed in 4.18.0
- Npm Lodash.Template: from 4.0.0 before 4.18.0 — fixed in 4.18.0
How to fix
Upgrade to a fixed version: lodash 4.18.0; lodash-amd 4.18.0; lodash-es 4.18.0; lodash.template 4.18.0; Npm Lodash 4.18.0; Npm Lodash-Amd 4.18.0; Npm Lodash-Es 4.18.0; Npm Lodash.Template 4.18.0. Check the vendor advisory for mitigations.
References
- https://cna.openjsf.org/security-advisories.html
- https://github.com/lodash/lodash/security/advisories/GHSA-r5fr-rjxr-66jc
- https://access.redhat.com/errata/RHBA-2026:21387
- https://access.redhat.com/errata/RHSA-2026:10131
- https://access.redhat.com/errata/RHSA-2026:10175
- https://access.redhat.com/errata/RHSA-2026:10710
- https://access.redhat.com/errata/RHSA-2026:10713
- https://access.redhat.com/errata/RHSA-2026:11454
- https://access.redhat.com/errata/RHSA-2026:11469
- https://access.redhat.com/errata/RHSA-2026:11470
- https://access.redhat.com/errata/RHSA-2026:11471
- https://access.redhat.com/errata/RHSA-2026:11493
Get alerted when CVE-2026-4800 or the next vulnerability affects your stack