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
|
chore(deps): bump the npm_and_yarn group across 1 directory with 13 updates
Closed 3 days agoBump the npm_and_yarn group across 1 directory with 9 updates
Closed 4 days agoBump lodash from 4.17.20 to 4.18.1 in /javascript
Open 7 days agoBump lodash from 4.17.15 to 4.18.1 in /samples/express-shop
Closed 12 days agochore(deps): bump the npm_and_yarn group across 15 directories with 14 updates
Open 13 days agoBump the npm_and_yarn group across 3 directories with 13 updates
Open 13 days agoBump lodash from 3.10.1 to 4.18.1 in the npm_and_yarn group across 1 directory
Closed 14 days agoBump lodash.template from 4.5.0 to 4.18.1 in /test/simple-cli-prj-v3
Closed 14 days agoBump the all-prod group across 1 directory with 7 updates
Closed 16 days agoBump lodash from 4.17.21 to 4.18.1
Closed 17 days agoBump lodash from 4.17.11 to 4.18.1 in /rmq-playground
Closed 18 days agoBump lodash and @nestjs/config
Closed 18 days agochore(deps): bump the npm_and_yarn group across 4 directories with 7 updates
Open 22 days agochore(deps): bump the npm_and_yarn group across 1 directory with 11 updates
Closed 22 days agochore(deps): bump lodash from 4.17.20 to 4.18.1 in /pnpm11/deps/compliance/commands/test/audit/fixtures/workspace-has-vulnerabilities/packages/a
Open 24 days agoBump lodash from 4.17.15 to 4.18.1
Open 24 days agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open 24 days agochore(deps): bump the npm_and_yarn group across 1 directory with 17 updates
Open 25 days agochore(deps): bump the npm_and_yarn group across 2 directories with 13 updates
Closed 26 days agoBump lodash from 4.17.20 to 4.18.1 in /fixtures/scanner-samples
Closed 26 days agoBump openapi-sampler from 1.7.2 to 1.7.6
Closed 27 days agochore(deps): bump the minor-and-patch group across 1 directory with 20 updates
Closed 27 days agoBump the npm_and_yarn group across 2 directories with 27 updates
Open 27 days agobuild(deps): bump lodash from 4.17.21 to 4.18.1
Open 29 days agoBump lodash from 4.17.21 to 4.18.1
Open 29 days agoBump the npm_and_yarn group across 1 directory with 6 updates
Closed 29 days agoBump the npm_and_yarn group across 1 directory with 20 updates
Open 29 days agoE: Bump the security group across 1 directory with 2 updates
Open 29 days agobuild(deps): bump the npm_and_yarn group across 2 directories with 19 updates
Open 30 days agochore(deps): bump the npm_and_yarn group across 2 directories with 5 updates
Closed 30 days agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open about 1 month agobuild(deps): bump the npm_and_yarn group across 1 directory with 5 updates
Closed about 1 month agochore: bump the npm_and_yarn group across 1 directory with 2 updates
Open about 1 month agobuild(deps): Bump lodash and n8n-workflow
Closed about 1 month agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open about 1 month agoBump lodash from 4.17.15 to 4.18.1
Closed about 1 month agoBump the npm_and_yarn group across 3 directories with 24 updates
Open about 1 month agoci(deps): bump the npm_and_yarn group across 1 directory with 15 updates
Open about 1 month agoBump lodash from 4.17.21 to 4.18.1 in /mcp
Open about 1 month agochore(deps): bump lodash from 4.17.20 to 4.18.1 in /pnpm11/deps/compliance/commands/test/audit/fixtures/workspace-has-vulnerabilities
Open about 1 month agoBump the npm_and_yarn group across 1 directory with 12 updates
Closed about 1 month agoBump the npm_and_yarn group across 1 directory with 4 updates
Open about 1 month agoBump lodash-es from 4.17.21 to 4.18.1 in /js
Open about 1 month agoBump the npm-dependencies group across 1 directory with 31 updates
Closed about 1 month agochore(deps): bump the npm_and_yarn group across 1 directory with 2 updates
Open about 1 month ago(chore): Bump the minor-and-patch group across 1 directory with 30 updates
Open about 1 month agoBump lodash from 4.17.20 to 4.18.1 in /javascript
Open about 1 month agochore(deps): bump the npm_and_yarn group across 1 directory with 14 updates
Open about 1 month agobuild(deps): bump the npm_and_yarn group across 1 directory with 19 updates
Closed about 1 month agoBump lodash from 4.17.21 to 4.18.1
Open about 1 month agoActions
Advisory Details
| Published: | April 01, 2026 7 months ago |
| Updated: | October 29, 2026 3 days 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: | 2.81% 86th 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