Description
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.
Published: 2026-10-06
Score: 4.7 Medium
EPSS: < 1% Very Low
KEV: No
Impact: JavaScript injection via unsafe inline embedding of precompiled templates
Action: Immediate Patch
AI Analysis

Impact

Handlebars’ precompile function inserts template text directly into the generated JavaScript without escaping characters that could terminate an enclosing HTML <script> element. When an attacker controls the template content and the application embeds the compiled code inline, a specially crafted string can close the <script> tag and inject arbitrary markup or script that will then be parsed and executed by the victim’s browser. This flaw is a form of client‑side code injection that can lead to cross‑site scripting attacks, potentially exposing sensitive data or executing malicious actions on behalf of the user. The underlying weaknesses include improper handling of quoted strings (CWE‑116) and cross‑site scripting (CWE‑79).

Affected Systems

The vulnerability affects handlebars.js releases from 4.0.0 up to and including 4.7.9. The Handlebars.js library is maintained by the handlebars‑lang organization. The fix was introduced in version 4.7.10.

Risk and Exploitability

The CVSS score of 4.7 indicates a moderate severity, and the EPSS score is not available. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires that an attacker can influence the template text that an application precompiles and embeds inline, a scenario that may arise if user input is used as template content. Once applied, the attack occurs in the victim’s browser and can be performed remotely by simply serving malicious template data.

Generated by OpenCVE AI on October 7, 2026 at 13:45 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade handlebars.js to version 4.7.10 or later to receive the fix.
  • Avoid embedding precompiled template source directly into inline <script> elements; instead serve compiled templates as external JavaScript files or use alternative delivery methods.
  • Validate and sanitize any user‑supplied template content before precompiling, or restrict template compilation to trusted, non‑user data.

Generated by OpenCVE AI on October 7, 2026 at 13:45 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-xw65-4hp5-5hc7 Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
History

Fri, 09 Oct 2026 08:15:00 +0000

Type Values Removed Values Added
First Time appeared Handlebarsjs
Handlebarsjs handlebars
Vendors & Products Handlebarsjs
Handlebarsjs handlebars

Wed, 07 Oct 2026 12:30:00 +0000

Type Values Removed Values Added
Weaknesses CWE-79
References
Metrics threat_severity

None

threat_severity

Moderate


Tue, 06 Oct 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Tue, 06 Oct 2026 19:30:00 +0000

Type Values Removed Values Added
Description 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.
Title Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Weaknesses CWE-116
References
Metrics cvssV3_1

{'score': 4.7, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N'}


Subscriptions

Handlebarsjs Handlebars
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-06T19:48:02.050Z

Reserved: 2026-10-06T16:49:40.590Z

Link: CVE-2026-106444

cve-icon Vulnrichment

Updated: 2026-10-06T19:47:56.780Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-10-06T20:17:26.130

Modified: 2026-10-07T13:58:29.527

Link: CVE-2026-106444

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-10-06T19:01:14Z

Links: CVE-2026-106444 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-09T08:00:04Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')