npm · package · 2021-02-15

lodash template command injection

CVE CVE-2021-23337GHSA GHSA-35jh-r3h4-6jhm High

A widely cited npm package flaw that illustrates why 'a dependency is vulnerable' is not the same as 'this application is exploitable'.

Patch status
Patch available
Exploitation
Exploitation unknown
CISA KEV
Not listed

Key facts

Each fact is linked to the source that supports it.
  1. Versions before 4.17.21 are vulnerable to command injection via the template function. GitHub Advisory Database
  2. The advisory also lists lodash-es, lodash-rails, lodash-template and lodash.template as affected packages with different fix status. GitHub Advisory Database
  3. CVSS v3.1 is 7.2; NVD describes it as HIGH. GitHub Advisory Database

Summary

Command injection through lodash's template function when untrusted input reaches the template options. Impact depends on how the application uses the library.

Component: lodash. Disclosed: 15 February 2021. Last verified: 22 October 2026, 16:45 UTC.

Affected versions

Product Affected range Note
lodash < 4.17.21 Also lodash-es and lodash-rails below 4.17.21; lodash.template and lodash-template are listed separately in the advisory.

Version ranges preserve the source wording. A distribution package may contain a backport without changing this string. GitHub Advisory Database

Fixed versions

Product Fixed version Note
lodash 4.17.21 Fixed release.

Update to lodash 4.17.21 or later. Check the separate lodash.template and lodash-template packages, which the advisory lists with no patched version. GitHub Advisory Database

Conditions and scope

These are the conditions named by the sources. They are not a score and not a prediction.

  • The application passes untrusted input into lodash template compilation, particularly template options.
  • A dependency tree that includes lodash does not by itself prove the vulnerable code path is reachable.
  • This is an npm package issue, not a Node.js core issue.

Exploitation status

No public confirmation of exploitation was found in the sources checked. Exploitability depends on whether untrusted input reaches the template function.

CISA KEV — not listed

Not present in the downloaded CISA KEV catalog.

Catalog version 2026.10.21 · checked 22 October 2026, 16:53 UTC .

Severity and scoring

Scores are listed with their version and assessor. Different CVSS versions, and different assessors, are not averaged. The presence of a high score does not establish exploitation, and a lower score does not make a memory-safety defect harmless.

7.2
CVSS v3.1 · High
GitHub Advisory Database / NVD
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

Why a package advisory needs reachability

lodash is embedded in an enormous number of dependency trees. A scanner can report the package present without showing whether the vulnerable template path is reachable from untrusted input. That difference matters when prioritising work.

The advisory's conditions are specific: command injection through the template function. Applications that never compile templates from untrusted data have a different exposure profile from applications that do. This is a general lesson, not a claim that any particular site is safe.

Fix

Upgrade lodash to 4.17.21 or later. Because lockfiles can keep multiple copies, verify the resolved version in the built artefact, not only in package.json. The advisory also lists standalone template packages that need separate review.

This is an npm dependency entry. It is deliberately not described as a Node.js core vulnerability.

What to do

Sources

Sources for this record

Last verified 22 October 2026, 16:45 UTC. A statement that no evidence was found in checked sources is not a statement that an event never occurred.

Search PHP2Shell Live

Type to search the local index Results stay in your browser
↑ ↓ move Enter open Esc close