CVE-2026-106444
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
4.7
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106444- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-116
- Updated
- 2026-11-02
EUVDEUVD-2026-93974
4.7
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
EUVD-2026-93974- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-xw65-4hp5-5hc7
4.7
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Summary
Handlebars.precompile() generates JavaScript source that is commonly embedded in browser <script> elements. Before the fix, static template text containing </script> was emitted unchanged. HTML parsers recognize </script> even inside a JavaScript string literal, closing the surrounding script element and allowing following attacker-controlled markup to be parsed and executed.
This affects applications that precompile attacker-controlled templates and embed the generated source directly in an HTML <script> element. It does not affect ordinary server-side rendering or precompiled templates delivered as external JavaScript files.
Details
Static text is serialized by quotedString() in lib/handlebars/compiler/code-gen.js. The generated JavaScript is valid, but JavaScript quoting alone does not make it safe to embed in HTML. In HTML script data, the sequence </script> terminates the element regardless of JavaScript string context.
On affected releases, this template:
safe</script><script>alert("XSS")</script><script>
could produce generated source containing:
return 'safe</script><script>alert("XSS")</script><script>';
When included inline in an HTML document, the first </script> closes the script containing the precompiled template. The next <script> element is then parsed as HTML and executes.
Proof of Concept
const Handlebars = require('handlebars');
const template = 'safe</script><script>alert("XSS")</script><script>';
const output = Handlebars.precompile(template);
console.log(output.includes('</script>'));
Affected versions print true. Embedding output directly in an inline <script> element allows the injected script tag to be parsed by the browser.
Workarounds
- Do not inline precompiled output from untrusted templates into HTML documents.
- Serve generated precompiled templates as external JavaScript files where practical.
Credits
Reported by Curly-Haired-Baboon Aka Laplas
- Record
GHSA-xw65-4hp5-5hc7- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-116
- Updated
- 2026-11-02
NVD
4.7
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106444- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-116
- Updated
- 2026-11-02
OSV
4.7
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
CVE-2026-106444- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-116
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-106444
4.7
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
DEBIAN-CVE-2026-106444- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
Show 6 moreShow less
OSVGHSA-xw65-4hp5-5hc7
4.7
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Summary
Handlebars.precompile() generates JavaScript source that is commonly embedded in browser <script> elements. Before the fix, static template text containing </script> was emitted unchanged. HTML parsers recognize </script> even inside a JavaScript string literal, closing the surrounding script element and allowing following attacker-controlled markup to be parsed and executed.
This affects applications that precompile attacker-controlled templates and embed the generated source directly in an HTML <script> element. It does not affect ordinary server-side rendering or precompiled templates delivered as external JavaScript files.
Details
Static text is serialized by quotedString() in lib/handlebars/compiler/code-gen.js. The generated JavaScript is valid, but JavaScript quoting alone does not make it safe to embed in HTML. In HTML script data, the sequence </script> terminates the element regardless of JavaScript string context.
On affected releases, this template:
safe</script><script>alert("XSS")</script><script>
could produce generated source containing:
return 'safe</script><script>alert("XSS")</script><script>';
When included inline in an HTML document, the first </script> closes the script containing the precompiled template. The next <script> element is then parsed as HTML and executes.
Proof of Concept
const Handlebars = require('handlebars');
const template = 'safe</script><script>alert("XSS")</script><script>';
const output = Handlebars.precompile(template);
console.log(output.includes('</script>'));
Affected versions print true. Embedding output directly in an inline <script> element allows the injected script tag to be parsed by the browser.
Workarounds
- Do not inline precompiled output from untrusted templates into HTML documents.
- Serve generated precompiled templates as external JavaScript files where practical.
Credits
Reported by Curly-Haired-Baboon Aka Laplas
- Record
GHSA-xw65-4hp5-5hc7- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-116
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-106444
4.7
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.precompile() uses quotedString() in lib/handlebars/compiler/code-gen.js to emit static template text into generated JavaScript without escaping sequences that terminate an enclosing HTML script element. When an application precompiles attacker-controlled template text and embeds the generated source directly in an inline script element, a closing script delimiter can end the element and cause following attacker-controlled markup to be parsed and executed. Ordinary server-side rendering and precompiled templates served as external JavaScript files are not affected. This issue is fixed in version 4.7.10.
- Record
UBUNTU-CVE-2026-106444- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVCLSA-2026-1791806399 No score
TuxCare security update for handlebars (1 CVE)
TuxCare rebuilt handlebars to address 1 CVE. Fixed in 4.7.8-tuxcare.4.
- Record
CLSA-2026-1791806399- Updated
- 2026-11-02
OSVCLSA-2026-1791821351 No score
TuxCare security update for handlebars (1 CVE)
TuxCare rebuilt handlebars to address 1 CVE. Fixed in 4.5.3-tuxcare.2.
- Record
CLSA-2026-1791821351- 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
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.4, plus listed versions 4.7.84.7.8-tuxcare.14.7.8-tuxcare.24.7.8-tuxcare.3 |
4.7.8-tuxcare.4 |
handlebarsTuxCare:npm |
4.5.3-tuxcare.0 up to 4.5.3-tuxcare.2, plus listed versions 4.5.34.5.3-tuxcare.1 |
4.5.3-tuxcare.2 |
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 |
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 |
Show 10 moreShow less
| Package | Affected | Fixed |
|---|---|---|
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-106444 is a medium vulnerability (CVSS 4.7) 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.29%, the 21st percentile. Fixed in handlebars 4.7.10.
References
github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xw65-4hp5-5hc7
github.com/handlebars-lang/handlebars.js/pull/2185
github.com/handlebars-lang/handlebars.js/commit/609d1b11c833c9a3e00f56f2f34d22f425446725
github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.10
nvd.nist.gov/vuln/detail/CVE-2026-106444
github.com/advisories/GHSA-xw65-4hp5-5hc7