CVE-2026-4800
ADVISORY - githubSummary
Impact
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().
Patches
Users should upgrade to version 4.18.0.
The fix applies two changes:
- Validate
importsKeysagainst the existingreForbiddenIdentifierCharsregex (same check already used for thevariableoption) - Replace
assignInWithwithassignWithwhen 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.
Common Weakness Enumeration (CWE)
Improper Control of Generation of Code ('Code Injection')
Improper Control of Generation of Code ('Code Injection')
Improper Control of Generation of Code ('Code Injection')
NIST
2.2
CVSS SCORE
8.1highGitHub
2.2
CVSS SCORE
8.1highDebian
-
Ubuntu
-
CVSS SCORE
N/AmediumRed Hat
2.2
CVSS SCORE
8.1highChainguard
CGA-738g-g4gp-hqw4
-
minimos
MINI-2vj8-c4xj-fpxh
-
minimos
MINI-9q3g-vpjv-w74g
-
minimos
MINI-cf3v-8g9p-ccgg
-
minimos
MINI-hqj9-3xhp-q9xv
-
minimos
MINI-xjcg-v6ff-6wvr
-
minimos
MINI-xjg8-r56f-9382
-