lodash vulnerable to Code Injection via `_.template` imports key names
CVE-2026-4800 · GHSA-r5fr-rjxr-66jc · published 1 Apr 2026
How serious is it
- Severity: high.
- No exploit prediction (EPSS) score yet.
- Not on the CISA list of exploited vulnerabilities.
- No public exploit in Exploit-DB.
Is your app affected by CVE-2026-4800?
Paste this prompt into Claude Code, Cursor or any AI coding tool: it runs a free Shippable scan of your project and fixes what it finds. Built with Lovable, Bolt or v0? Scan your live app. Or upload your package file.
Who is affected
lodash(npm) >= 4.0.0, < 4.18.0lodash-es(npm) >= 4.0.0, < 4.18.0lodash-amd(npm) >= 4.0.0, < 4.18.0lodash.template(npm) >= 4.0.0, < 4.18.0
How to check
- Run
npm ls lodashin your project to see the installed version, including copies pulled in by other packages. - Run
npm ls lodash-esin your project to see the installed version, including copies pulled in by other packages. - Run
npm ls lodash-amdin your project to see the installed version, including copies pulled in by other packages. - Run
npm ls lodash.templatein your project to see the installed version, including copies pulled in by other packages. - Or paste your lockfile into the checker: it lists every package with a known vulnerability, this one included.
- Or run
npx shippable-dev scan localhost:3000in your project folder. It reads your lockfile and flags this vulnerability along with every other known one.
How to fix
Copies a prompt for Claude Code, Cursor or Codex: it checks your lockfiles for this and upgrades it.
- On >= 4.0.0, < 4.18.0: Upgrade
lodashto 4.18.0 or later, commit the lockfile and redeploy. - On >= 4.0.0, < 4.18.0: Upgrade
lodash-esto 4.18.0 or later, commit the lockfile and redeploy. - On >= 4.0.0, < 4.18.0: Upgrade
lodash-amdto 4.18.0 or later, commit the lockfile and redeploy. - On >= 4.0.0, < 4.18.0: Upgrade
lodash.templateto 4.18.0 or later, commit the lockfile and redeploy. - If a vulnerable version was live, check your logs and rotate the secrets that server could read.
The advisory
### Impact
The 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.
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`. If `Object.prototype` has been polluted by any other vector, the polluted keys are copied into the imports object and passed to `Function()`.
### Patches
Users should upgrade to version 4.18.0.
The fix applies two changes:
1. Validate `importsKeys` against the existing `reForbiddenIdentifierChars` regex (same check already used for the `variable` option)
2. Replace `assignInWith` with `assignWith` when merging imports, so only own properties are enumerated
### Workarounds
Do not pass untrusted input as key names in `options.imports`. Only use developer-controlled, static key names.
Check your whole app
Dependencies are only half of it. Free and read-only: before you push, run npx shippable-dev scan localhost:3000 in your project folder, no account needed. For your live app, you prove it's yours with a one-line tag first.
References
- github.com/lodash/lodash/security/advisories/GHSA-r5fr-rjxr-66jc
- nvd.nist.gov/vuln/detail/CVE-2026-4800
- github.com/lodash/lodash/commit/3469357cff396a26c363f8c1b5a91dde28ba4b1c
- cna.openjsf.org/security-advisories.html
- github.com/advisories/GHSA-35jh-r3h4-6jhm
- github.com/lodash/lodash
Merged from OSV. Last updated 23 Oct 2026. All vulnerabilities · RSS · JSON