lodash vulnerable to Code Injection via `_.template` imports key names
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 Packages
| Ecosystem | Package | Vulnerable Versions | Patched Version |
|---|---|---|---|
| npm |
lodash.template
|
>= 4.0.0, < 4.18.0 |
4.18.0
|
| npm |
lodash-amd
|
>= 4.0.0, <= 4.17.23 |
4.18.0
|
| npm |
lodash-es
|
>= 4.0.0, <= 4.17.23 |
4.18.0
|
| npm |
lodash
|
>= 4.0.0, <= 4.17.23 |
4.18.0
|
Bump lodash from 4.17.21 to 4.18.1
Closed about 8 hours agobuild(deps): bump the npm_and_yarn group across 1 directory with 10 updates
Open about 9 hours agobuild(deps): bump the npm_and_yarn group across 1 directory with 7 updates
Closed about 13 hours agochore(deps): bump lodash from 4.17.23 to 4.18.1
Open about 16 hours agoBump the production-dependencies group with 4 updates
Closed about 16 hours agochore(deps-dev): bump lodash from 4.17.23 to 4.18.1 in /html/themes/custom/common_design_subtheme
Closed about 16 hours agoBump lodash from 4.17.21 to 4.18.1
Open about 17 hours agochore(deps): bump the npm_and_yarn group across 2 directories with 2 updates
Open about 18 hours agoBump the npm_and_yarn group across 2 directories with 7 updates
Open about 18 hours agochore(deps): bump the npm_and_yarn group across 4 directories with 10 updates
Open about 21 hours agoBump the npm_and_yarn group across 1 directory with 9 updates
Open about 22 hours agoBump lodash from 4.17.21 to 4.18.1
Open 1 day agoBump the npm_and_yarn group across 7 directories with 10 updates
Open 1 day agoBump the npm_and_yarn group across 1 directory with 5 updates
Open 1 day agoBump lodash from 4.17.20 to 4.18.1 in /javascript
Open 1 day agoBump lodash from 4.17.21 to 4.18.1
Open 2 days agoBump lodash from 4.17.21 to 4.18.1
Closed 2 days agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open 2 days agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open 2 days agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open 2 days agoBump the npm_and_yarn group across 2 directories with 17 updates
Closed 2 days agoBump lodash from 4.17.21 to 4.18.1
Closed 2 days agochore(deps): bump the npm_and_yarn group across 1 directory with 7 updates
Closed 2 days agochore(deps): bump the npm_and_yarn group across 12 directories with 10 updates
Open 2 days agoBump lodash from 4.17.21 to 4.18.1 in /samples/tab-stage-view/nodejs
Closed 2 days agoBump lodash from 4.17.15 to 4.18.1
Open 2 days agoBump the npm_and_yarn group across 1 directory with 7 updates
Open 2 days agoBump the npm_and_yarn group across 1 directory with 13 updates
Open 2 days agoBump lodash from 4.17.21 to 4.18.1
Open 3 days agoBump the npm_and_yarn group across 16 directories with 21 updates
Open 3 days agoBump lodash from 4.17.4 to 4.18.1
Closed 3 days agoci: bump the npm_and_yarn group across 2 directories with 5 updates
Open 3 days agochore(deps): bump the npm_and_yarn group across 2 directories with 16 updates
Open 3 days agochore(deps): Bump the npm_and_yarn group across 1 directory with 16 updates
Closed 3 days agoBump the npm_and_yarn group across 1 directory with 17 updates
Closed 3 days agochore(deps): bump lodash-es from 4.17.21 to 4.18.1 in /docs
Closed 3 days agochore(deps): bump the npm_and_yarn group across 1 directory with 5 updates
Open 3 days agoBump lodash, grunt-legacy-log and grunt-legacy-util
Open 3 days agoBump lodash from 4.17.21 to 4.18.1
Open 3 days agoBump the npm_and_yarn group across 1 directory with 14 updates
Open 3 days agoBump the npm_and_yarn group across 1 directory with 9 updates
Closed 3 days agochore(deps): bump the npm_and_yarn group across 1 directory with 12 updates
Open 3 days agochore(deps): bump the npm_and_yarn group across 4 directories with 14 updates
Open 3 days agoBump lodash from 4.17.20 to 4.18.1 in /javascript
Closed 3 days agoBump lodash from 4.17.21 to 4.18.1
Open 4 days agochore(deps): bump the npm_and_yarn group across 6 directories with 20 updates
Open 4 days agoBump lodash-es from 4.17.23 to 4.18.1
Open 4 days agoBump the npm_and_yarn group across 12 directories with 6 updates
Closed 4 days agochore(deps): bump lodash-es from 4.17.23 to 4.18.1
Open 4 days agoBump the npm_and_yarn group across 1 directory with 8 updates
Closed 4 days agoActions
Advisory Details
| Published: | April 01, 2026 about 2 months ago |
| Updated: | May 18, 2026 about 4 hours ago |
| CVSS Score: | 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| EPSS: | 0.04% 14th percentile |
| Source: | Github |
| Classification: | GENERAL |
| UUID: | GSA_kwCzR0hTQS1yNWZyLXJqeHItNjZqY84ABUmW |
PR Statistics
References
- https://github.com/lodash/lodash/security/advisories/GHSA-r5fr-rjxr-66jc
- https://nvd.nist.gov/vuln/detail/CVE-2026-4800
- https://github.com/lodash/lodash/commit/3469357cff396a26c363f8c1b5a91dde28ba4b1c
- https://cna.openjsf.org/security-advisories.html
- https://github.com/advisories/GHSA-35jh-r3h4-6jhm
- https://github.com/advisories/GHSA-r5fr-rjxr-66jc