Every CVE Search/ Get API key

CVE-2021-23383

Prototype Pollution

5.6 MediumPublic exploitFix available

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
Low
Integrity
Low
Availability
Low

Exploit likelihood

4.51%Up 3.3 points since May 4, 2021
90%50%10%1%

What each source reports

CVE List Score used 5.6

Prototype Pollution

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
CVE-2021-23383
CVSS 3.1
5.6 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C
Updated
2026-11-02
EUVDEUVD-2022-0882 5.6

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
EUVD-2022-0882
CVSS 3.1
5.6 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C
Updated
2026-11-02
GitHub AdvisoriesGHSA-2cf5-4w76-r9qv 7.3

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.2 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

The following template can be used to demonstrate the vulnerability:

	{{#with split as |a|}}
		{{pop (push "alert('Vulnerable Handlebars JS');")}}
		{{#with (concat (lookup join (slice 0 1)))}}
			{{#each (slice 2 3)}}
				{{#with (apply 0 a)}}
					{{.}}
				{{/with}}
			{{/each}}
		{{/with}}
	{{/with}}
{{/with}}```


## Recommendation

Upgrade to version 3.0.8, 4.5.2 or later.
Record
GHSA-2cf5-4w76-r9qv
CVSS 3.1
7.3 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L
Weakness
CWE-94
Updated
2026-11-02
GitHub AdvisoriesGHSA-442j-39wm-28r2 3.7

Handlebars.js has a Property Access Validation Bypass in container.lookup

Summary

In lib/handlebars/runtime.js, the container.lookup() function uses container.lookupProperty() as a gate check to enforce prototype-access controls, but then discards the validated result and performs a second, unguarded property access (depths[i][name]). This Time-of-Check Time-of-Use (TOCTOU) pattern means the security check and the actual read are decoupled, and the raw access bypasses any sanitization that lookupProperty may perform.

Only relevant when the compat compile option is enabled ({compat: true}), which activates depthedLookup in lib/handlebars/compiler/javascript-compiler.js.

Description

The vulnerable code in lib/handlebars/runtime.js (lines 137–144):

lookup: function (depths, name) {
  const len = depths.length;
  for (let i = 0; i < len; i++) {
    let result = depths[i] && container.lookupProperty(depths[i], name);
    if (result != null) {
      return depths[i][name];  // BUG: should be `return result;`
    }
  }
},

container.lookupProperty() (lines 119–136) enforces hasOwnProperty checks and resultIsAllowed() prototype-access controls. However, container.lookup() only uses lookupProperty as a boolean gate — if the gate passes (result != null), it then performs an independent, raw depths[i][name] access that circumvents any transformation or wrapped value that lookupProperty may have returned.

Workarounds

  • Avoid enabling { compat: true } when rendering templates that include untrusted data.
  • Ensure context data objects are plain JSON (no Proxies, no getter-based accessor properties).
Record
GHSA-442j-39wm-28r2
CVSS 3.1
3.7 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Weakness
CWE-367
Updated
2026-11-02
GitHub AdvisoriesGHSA-765h-qjxv-5f44 9.8

Prototype Pollution in handlebars

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
GHSA-765h-qjxv-5f44
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-1321
Updated
2026-11-02
GitHub AdvisoriesGHSA-q42p-pg8m-cqh6 7.3

Prototype Pollution in handlebars

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Recommendation

For handlebars 4.1.x upgrade to 4.1.2 or later. For handlebars 4.0.x upgrade to 4.0.14 or later.

Record
GHSA-q42p-pg8m-cqh6
CVSS 3.1
7.3 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weakness
CWE-471
Updated
2026-11-02
Show 27 moreShow less
GitHub AdvisoriesGHSA-g9r4-xpmj-mj65 No score

Prototype Pollution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-g9r4-xpmj-mj65
Weakness
CWE-1321
Updated
2026-11-02
GitHub AdvisoriesGHSA-q2c6-c6pm-g3gh No score

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
NVD 5.6

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
CVE-2021-23383
CVSS 3.1
5.6 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV:N/AC:L/Au:N/C:P/I:P/A:P
Weakness
CWE-1321
Updated
2026-11-02
OSV 9.8

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
CVE-2021-23383
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVDEBIAN-CVE-2021-23383 9.8

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
DEBIAN-CVE-2021-23383
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVGHSA-2cf5-4w76-r9qv 7.3

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.2 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

The following template can be used to demonstrate the vulnerability:

	{{#with split as |a|}}
		{{pop (push "alert('Vulnerable Handlebars JS');")}}
		{{#with (concat (lookup join (slice 0 1)))}}
			{{#each (slice 2 3)}}
				{{#with (apply 0 a)}}
					{{.}}
				{{/with}}
			{{/each}}
		{{/with}}
	{{/with}}
{{/with}}```


## Recommendation

Upgrade to version 3.0.8, 4.5.2 or later.
Record
GHSA-2cf5-4w76-r9qv
CVSS 3.1
7.3 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:H/A:L
Weakness
CWE-94
Updated
2026-11-02
OSVGHSA-442j-39wm-28r2 3.7

Handlebars.js has a Property Access Validation Bypass in container.lookup

Summary

In lib/handlebars/runtime.js, the container.lookup() function uses container.lookupProperty() as a gate check to enforce prototype-access controls, but then discards the validated result and performs a second, unguarded property access (depths[i][name]). This Time-of-Check Time-of-Use (TOCTOU) pattern means the security check and the actual read are decoupled, and the raw access bypasses any sanitization that lookupProperty may perform.

Only relevant when the compat compile option is enabled ({compat: true}), which activates depthedLookup in lib/handlebars/compiler/javascript-compiler.js.

Description

The vulnerable code in lib/handlebars/runtime.js (lines 137–144):

lookup: function (depths, name) {
  const len = depths.length;
  for (let i = 0; i < len; i++) {
    let result = depths[i] && container.lookupProperty(depths[i], name);
    if (result != null) {
      return depths[i][name];  // BUG: should be `return result;`
    }
  }
},

container.lookupProperty() (lines 119–136) enforces hasOwnProperty checks and resultIsAllowed() prototype-access controls. However, container.lookup() only uses lookupProperty as a boolean gate — if the gate passes (result != null), it then performs an independent, raw depths[i][name] access that circumvents any transformation or wrapped value that lookupProperty may have returned.

Workarounds

  • Avoid enabling { compat: true } when rendering templates that include untrusted data.
  • Ensure context data objects are plain JSON (no Proxies, no getter-based accessor properties).
Record
GHSA-442j-39wm-28r2
CVSS 3.1
3.7 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Weakness
CWE-367
Updated
2026-11-02
OSVGHSA-765h-qjxv-5f44 9.8

Prototype Pollution in handlebars

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
GHSA-765h-qjxv-5f44
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-1321
Updated
2026-11-02
OSVGHSA-q42p-pg8m-cqh6 7.3

Prototype Pollution in handlebars

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Recommendation

For handlebars 4.1.x upgrade to 4.1.2 or later. For handlebars 4.0.x upgrade to 4.0.14 or later.

Record
GHSA-q42p-pg8m-cqh6
CVSS 3.1
7.3 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weakness
CWE-471
Updated
2026-11-02
OSVOESA-2021-1196 9.8

nodejs-handlebars security update

Handlebars.js is an extension to the Mustache templating language created by Chris Wanstrath. Handlebars.js and Mustache are both logicless templating languages that keep the view and the code separated like we all know they should be.

Security Fix(es):

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.(CVE-2021-23383)

Record
OESA-2021-1196
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2021-23383 5.6

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to compile templates coming from an untrusted source.

Record
UBUNTU-CVE-2021-23383
CVSS 3.1
5.6 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVCLSA-2026-1773101681 No score

TuxCare security update for handlebars (9 CVEs)

TuxCare rebuilt handlebars to address 9 CVEs. Fixed in 3.0.3-tuxcare.1.

Record
CLSA-2026-1773101681
Updated
2026-11-02
OSVCLSA-2026-1774743817 No score

TuxCare security update for handlebars (1 CVE)

TuxCare rebuilt handlebars to address 1 CVE. Fixed in 1.3.0-tuxcare.1.

Record
CLSA-2026-1774743817
Updated
2026-11-02
OSVCLSA-2026-1774743830 No score

TuxCare security update for handlebars (3 CVEs)

TuxCare rebuilt handlebars to address 3 CVEs. Fixed in 1.0.12-tuxcare.2.

Record
CLSA-2026-1774743830
Updated
2026-11-02
OSVCLSA-2026-1774743831 No score

TuxCare security update for handlebars (2 CVEs)

TuxCare rebuilt handlebars to address 2 CVEs. Fixed in 1.3.0-tuxcare.2.

Record
CLSA-2026-1774743831
Updated
2026-11-02
OSVCLSA-2026-1774743832 No score

TuxCare security update for handlebars (2 CVEs)

TuxCare rebuilt handlebars to address 2 CVEs. Fixed in 2.0.0-tuxcare.2.

Record
CLSA-2026-1774743832
Updated
2026-11-02
OSVCLSA-2026-1776991069 No score

TuxCare security update for handlebars (9 CVEs)

TuxCare rebuilt handlebars to address 9 CVEs. Fixed in 4.7.9-tuxcare.1.

Record
CLSA-2026-1776991069
Updated
2026-11-02
OSVCLSA-2026-1784596337 No score

TuxCare security update for handlebars (3 CVEs)

TuxCare rebuilt handlebars to address 3 CVEs. Fixed in 3.0.8-tuxcare.1.

Record
CLSA-2026-1784596337
Updated
2026-11-02
OSVCLSA-2026-1786731948 No score

TuxCare security update for dompurify (34 CVEs)

TuxCare rebuilt dompurify to address 34 CVEs. Fixed in 3.0.3-tuxcare.1.

Record
CLSA-2026-1786731948
Updated
2026-11-02
OSVCLSA-2026-1792421536 No score

TuxCare security update for handlebars (2 CVEs)

TuxCare rebuilt handlebars to address 2 CVEs. Fixed in 4.5.3-tuxcare.4.

Record
CLSA-2026-1792421536
Updated
2026-11-02
OSVGHSA-g9r4-xpmj-mj65 No score

Prototype Pollution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-g9r4-xpmj-mj65
Weakness
CWE-1321
Updated
2026-11-02
OSVGHSA-q2c6-c6pm-g3gh No score

Arbitrary Code Execution in handlebars

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Record
GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
OSVROOT-APP-NPM-CVE-2021-23383 No score

CVE-2021-23383 in handlebars - Patched by Root

Root has patched CVE-2021-23383 in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-CVE-2021-23383
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-2cf5-4w76-r9qv No score

GHSA-2cf5-4w76-r9qv in handlebars - Patched by Root

Root has patched GHSA-2cf5-4w76-r9qv in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-2cf5-4w76-r9qv
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-g9r4-xpmj-mj65 No score

GHSA-g9r4-xpmj-mj65 in handlebars - Patched by Root

Root has patched GHSA-g9r4-xpmj-mj65 in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-g9r4-xpmj-mj65
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-q2c6-c6pm-g3gh No score

GHSA-q2c6-c6pm-g3gh in handlebars - Patched by Root

Root has patched GHSA-q2c6-c6pm-g3gh in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-q2c6-c6pm-g3gh
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-q42p-pg8m-cqh6 No score

GHSA-q42p-pg8m-cqh6 in handlebars - Patched by Root

Root has patched GHSA-q42p-pg8m-cqh6 in the handlebars package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-q42p-pg8m-cqh6
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
handlebars
npm
before 3.0.8
3.0.8
handlebars
npm
4.0.0 up to 4.5.2
4.5.2
handlebars
npm
4.0.0 to 4.7.8
4.7.9
handlebars
npm
before 4.7.7
4.7.7
handlebars
npm
4.0.0 up to 4.5.3
4.5.3
handlebars
npm
4.1.0 up to 4.1.2
4.1.2
handlebars
npm
4.0.0 up to 4.0.14
4.0.14
handlebars
npm
before 3.0.7
3.0.7
handlebars
TuxCare:npm
From an advisory covering 5 CVEs
3.0.3-tuxcare.0 up to 3.0.3-tuxcare.1, plus listed versions
3.0.3
3.0.3-tuxcare.1
handlebars
TuxCare:npm
1.3.0-tuxcare.0 up to 1.3.0-tuxcare.1, plus listed versions
1.3.0
1.3.0-tuxcare.1
Show 24 moreShow less
Affected packages
PackageAffectedFixed
handlebars
TuxCare:npm
1.0.12-tuxcare.0 up to 1.0.12-tuxcare.2, plus listed versions
1.0.121.0.12-tuxcare.1
1.0.12-tuxcare.2
handlebars
TuxCare:npm
From an advisory covering 2 CVEs
1.3.0-tuxcare.0 up to 1.3.0-tuxcare.2, plus listed versions
1.3.01.3.0-tuxcare.1
1.3.0-tuxcare.2
handlebars
TuxCare:npm
From an advisory covering 2 CVEs
2.0.0-tuxcare.0 up to 2.0.0-tuxcare.2, plus listed versions
2.0.02.0.0-tuxcare.1
2.0.0-tuxcare.2
handlebars
TuxCare:npm
From an advisory covering 5 CVEs
4.7.9-tuxcare.0 up to 4.7.9-tuxcare.1, plus listed versions
4.7.9
4.7.9-tuxcare.1
handlebars
TuxCare:npm
From an advisory covering 2 CVEs
3.0.8-tuxcare.0 up to 3.0.8-tuxcare.1, plus listed versions
3.0.8
3.0.8-tuxcare.1
handlebars
TuxCare:npm
From an advisory covering 2 CVEs
4.5.3-tuxcare.0 up to 4.5.3-tuxcare.4, plus listed versions
4.5.34.5.3-tuxcare.14.5.3-tuxcare.24.5.3-tuxcare.3
4.5.3-tuxcare.4
node-handlebars
Debian:12
before 3:4.7.6+~4.1.0-2
3:4.7.6+~4.1.0-2
node-handlebars
Debian:13
before 3:4.7.6+~4.1.0-2
3:4.7.6+~4.1.0-2
node-handlebars
Debian:14
before 3:4.7.6+~4.1.0-2
3:4.7.6+~4.1.0-2
handlebars
npm
4.0.0 up to 4.7.9
4.7.9
nodejs-handlebars
openEuler:20.03-LTS-SP1
before 4.0.13-2.oe1
4.0.13-2.oe1
handlebars
Root:npm
before 3.0.8-aikido.2
3.0.8-aikido.23.0.7-aikido.33.0.3-aikido.24.7.7-aikido.24.7.7-aikido.34.7.7-aikido.44.7.7-aikido.5
@rootio/handlebars
Root:npm
before 3.0.8-root.io.2
3.0.8-root.io.23.0.7-root.io.33.0.3-root.io.24.7.7-root.io.14.7.7-root.io.24.7.7-root.io.34.7.7-root.io.44.7.7-root.io.5
handlebars
Root:npm
before 3.0.7-aikido.3
3.0.7-aikido.33.0.3-aikido.23.0.8-aikido.13.0.8-aikido.2
@rootio/handlebars
Root:npm
before 3.0.7-root.io.3
3.0.7-root.io.33.0.3-root.io.23.0.8-root.io.13.0.8-root.io.2
handlebars
Root:npm
before 3.0.3-aikido.2
3.0.3-aikido.23.0.7-aikido.13.0.7-aikido.23.0.7-aikido.3
@rootio/handlebars
Root:npm
before 3.0.3-root.io.2
3.0.3-root.io.23.0.7-root.io.13.0.7-root.io.23.0.7-root.io.3
node-handlebars
Ubuntu:18.04:LTS
All versions, plus listed versions
3:4.0.10-5
None known
node-handlebars
Ubuntu:20.04:LTS
All versions, plus listed versions
3:4.1.0-13:4.5.3-13:4.7.2-1
None known
node-handlebars
Ubuntu:22.04:LTS
All versions, plus listed versions
3:4.7.6+~4.1.0-23:4.7.7+~4.1.0-1
None known
node-handlebars
Ubuntu:24.04:LTS
All versions, plus listed versions
3:4.7.7+~4.1.0-1
None known
node-handlebars
Ubuntu:25.10
All versions, plus listed versions
3:4.7.7+~4.1.0-1
None known
node-handlebars
Ubuntu:26.10
All versions, plus listed versions
3:4.7.7+~4.1.0-13:4.7.9-5
None known
node-handlebars
Ubuntu:26.04:LTS
All versions, plus listed versions
3:4.7.7+~4.1.0-1
None known

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubdn9uy3n/Check-CVE-2021-233832021-06-28
PoC in GitHubfazilbaig1/CVE-2021-233832024-10-19

History

History
RecordedChangedSources
affected
facts
affected
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-23383 is a medium vulnerability (CVSS 5.6) in Handlebarsjs Handlebars, published June 5, 2019. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 4.51%, the 91st percentile. Fixed in handlebars 3.0.8.

References

Show 27 moreShow less
MoveEnter Open