CVE-2026-4800
lodash vulnerable to Code Injection via `_.template` imports key names
Description
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.
Affected Maven artifacts (7)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.mvnpm » lodashvia npm lodash | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.mvnpm » lodash-esvia npm lodash-es | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.mvnpm » lodash.templatevia npm lodash.template | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.webjars » lodashvia npm lodash | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.webjars.npm » lodashvia npm lodash | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.webjars.npm » lodash-esvia npm lodash-es | >= 4.0.0, < 4.18.0 | 4.18.0 |
| org.webjars.npm » lodash.templatevia npm lodash.template | >= 4.0.0, < 4.18.0 | 4.18.0 |
Blast radius
46% of the dependent artifacts (104) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 719 |
| 2 hops | 1,019 |
| 3 hops | 359 |
| 4 hops | 183 |
| 5 hops | 12 |
| 6 hops | 6 |
Most used dependents
- org.carewebframework » org.carewebframework.shell70 usages
- org.webjars.npm » ckeditor__ckeditor5-core58 usages
- org.webjars.npm » ckeditor__ckeditor5-utils56 usages
- org.webjars.npm » ckeditor__ckeditor5-ui50 usages
- org.webjars.npm » ckeditor546 usages
- org.webjars.npm » ckeditor__ckeditor5-engine34 usages
- org.fujion » fujion-core27 usages
- org.webjars.npm » ckeditor__ckeditor5-typing21 usages
- org.hspconsortium.carewebframework » cwf-ui-reporting17 usages
- com.foreach.across.modules » entity-module14 usages
- org.fujion » fujion-icons-core13 usages
- org.carewebframework » org.carewebframework.ui.core12 usages
- org.webjars.npm » ckeditor__ckeditor5-image12 usages
- org.webjars.npm » ckeditor__ckeditor5-widget12 usages
- com.trigyn » templating11 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
Other ecosystems
Also affects npm (4 packages) . See all on OSV
References
| Advisory | NVD CVE-2026-4800 | nvd.nist.gov |
| Advisory | GitHub advisory GHSA-35jh-r3h4-6jhm | github.com |
| Package | lodash/lodash | github.com |
| Web | lodash/lodash advisory GHSA-r5fr-rjxr-66jc | github.com |
| Web | lodash/lodash commit 3469357 | github.com |
| Web | security-advisories.html | cna.openjsf.org |
