All vulnerabilities

npm

CVE-2026-4800

lodash vulnerable to Code Injection via `_.template` imports key names

Severity
High 8.1
Published
1 Apr 2026
Last changed
17 Oct 2026
Added to UpHeron
10 Nov 2026
Fixed in
4.18.0
Exploit chance
2.9% in the next 30 daysHigher than 87% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Code injection (CWE-94)
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Read data · Change data · Take it down
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Also known as
GHSA-r5fr-rjxr-66jc
Sources
OSV.dev and GitHub

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. 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().

From the GitHub Advisory Database, CC BY 4.0.

Workarounds

Do not pass untrusted input as key names in options.imports. Only use developer-controlled, static key names.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
lodashnpm · osv:npm:lodash
  • From 4.0.0 before 4.18.0
lodash-amdnpm · osv:npm:lodash-amd
  • From 4.0.0 before 4.18.0
lodash-esnpm · osv:npm:lodash-es
  • From 4.0.0 before 4.18.0
lodash.templatenpm · osv:npm:lodash.template
  • From 4.0.0 before 4.18.0

About lodash

Weekly downloads (npm)
205,327,931npm, 18 Nov 2026

Vulnerabilities in lodash

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
1
Known exploited
0
Search the list for lodash

About lodash-amd

Weekly downloads (npm)
6,591npm, 18 Nov 2026

Vulnerabilities in lodash-amd

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
1
Known exploited
0
Search the list for lodash-amd

About lodash-es

Weekly downloads (npm)
71,083,440npm, 18 Nov 2026

Vulnerabilities in lodash-es

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
1
Known exploited
0
Search the list for lodash-es

References