GHSA-r5fr-rjxr-66jc

Suggest an improvement
Source
https://github.com/advisories/GHSA-r5fr-rjxr-66jc
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-r5fr-rjxr-66jc/GHSA-r5fr-rjxr-66jc.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-r5fr-rjxr-66jc
Aliases
  • CVE-2026-4800
Downstream
Related
Published
2026-04-01T23:51:12Z
Modified
2026-04-02T17:29:57.498155673Z
Severity
  • 8.1 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
lodash vulnerable to Code Injection via `_.template` imports key names
Details

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: 1. Validate importsKeys against the existing reForbiddenIdentifierChars regex (same check already used for the variable option) 2. Replace assignInWith with assignWith when 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.

Database specific
{
    "nvd_published_at": "2026-03-31T20:16:29Z",
    "severity": "HIGH",
    "github_reviewed_at": "2026-04-01T23:51:12Z",
    "cwe_ids": [
        "CWE-94"
    ],
    "github_reviewed": true
}
References

Affected packages

npm / lodash

Package

Affected ranges

Type
SEMVER
Events
Introduced
4.0.0
Fixed
4.18.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-r5fr-rjxr-66jc/GHSA-r5fr-rjxr-66jc.json"
last_known_affected_version_range
"<= 4.17.23"

npm / lodash-es

Package

Affected ranges

Type
SEMVER
Events
Introduced
4.0.0
Fixed
4.18.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-r5fr-rjxr-66jc/GHSA-r5fr-rjxr-66jc.json"
last_known_affected_version_range
"<= 4.17.23"

npm / lodash-amd

Package

Affected ranges

Type
SEMVER
Events
Introduced
4.0.0
Fixed
4.18.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-r5fr-rjxr-66jc/GHSA-r5fr-rjxr-66jc.json"
last_known_affected_version_range
"<= 4.17.23"

npm / lodash.template

Package

Affected ranges

Type
SEMVER
Events
Introduced
4.0.0
Fixed
4.18.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-r5fr-rjxr-66jc/GHSA-r5fr-rjxr-66jc.json"