Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit malicious template text to precompiler
-
DeliveryEmbed crafted </script> breakout payload
-
ExploitInline script element terminated early
-
ExecutionVictim browser parses injected markup
-
ImpactExecute attacker script in victim session
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
|
| Exploitation Conditions | Exploitation requires a specific, non-default integration: the application must (1) accept attacker-controlled Handlebars template text, (2) run Handlebars.precompile() on that untrusted text, and (3) embed the generated source directly inside an INLINE <script> element in an HTML page delivered to victims, who must then (4) load that page (UI:R). The description explicitly states ordinary server-side rendering and precompiled templates served as EXTERNAL JavaScript files are NOT affected - these are the common usage patterns, which is why real-world exposure is limited. Vulnerable versions are 4.0.0 through 4.7.9; 4.7.10 is fixed. The combination of untrusted-template precompilation into inline scripts plus required victim interaction are the primary limiting factors that keep practical risk well below a typical network XSS. |
| Impact | This is a genuine XSS/output-encoding flaw (CWE-116) but a comparatively low real-world priority, and the signals are consistent in pointing that way. The CVSS 3.1 vector (AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N, base 4.7, Medium) already encodes the key limiters: High attack complexity and required user interaction, reflecting that exploitation only occurs in a narrow, non-default integration pattern. No EPSS score was provided, so exploitation probability cannot be quantified; the CVE is not listed in CISA KEV and no public exploit code was supplied in the intelligence, so this is 'no public exploit identified at time of analysis.' The AC:H and the description's explicit carve-outs (ordinary server-side rendering and externally-served precompiled .js files are NOT affected) mean most Handlebars deployments are unaffected even though the library itself is extremely widespread - a classic case of a ubiquitous component with a tightly scoped vulnerable configuration. No conflicting signals were found between the vector and the description; both agree the issue is network-reachable but conditional and user-interaction-gated. Bottom line: patch in the normal maintenance cycle, prioritize only if your application precompiles untrusted template text into inline scripts. |
| Exploit ScenarioDerived | An application accepts user-supplied Handlebars template text, calls Handlebars.precompile() on it server-side, and inlines the generated JavaScript directly into an inline <script> element of a served HTML page. An attacker submits template text containing a '</script>' sequence followed by markup; when a victim loads the page, the injected delimiter closes the script element early and the attacker's trailing markup is parsed and executed in the victim's browser. No public exploit code was identified, and High attack complexity reflects the unusual integration required. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 06, 2026
Handlebars (the handlebars.js npm package) versions 4.0.0 through 4.7.9 emit static template text into precompiled JavaScript without escaping sequences such as '</script>' or '<!--', so an application that precompiles attacker-controlled template text and inlines the generated source inside a <script> element can have that element terminated early and followed attacker markup parsed and executed - a cross-site scripting condition (CWE-116). Exploitation is narrow rather than universal: it requires the non-default pattern of running Handlebars.precompile() on untrusted template text and embedding the output directly in an inline script, plus a victim loading the resulting page (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N, 4.7); ordinary server-side rendering and precompiled templates served as external JavaScript files are explicitly unaffected. No public exploit code or confirmed active exploitation was identified at time of analysis, and the required user interaction and unusual integration keep practical risk below a typical network XSS. The issue is fixed in Handlebars 4.7.10.
RemediationAI
Vendor-released patch: upgrade Handlebars to version 4.7.10 or later, which is available from the v4.7.10 release tag (https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.10) and incorporates commit 609d1b11c833c9a3e00f56f2f34d22f425446725 / PR 2185, escaping script delimiters via safeJsonLiteral() so that '<' in generated string literals becomes \u003C. Full details are in GHSA-xw65-4hp5-5hc7. If immediate upgrade is not possible, the most effective compensating control is architectural: stop passing attacker-controllable text to Handlebars.precompile() and stop inlining precompiled output inside <script> elements - serve precompiled templates as external .js files instead, which the advisory states are not affected, at the cost of an extra HTTP request and cache-management overhead. Where inlining is unavoidable, HTML-escape the generated source before insertion (for example replacing '<' with '\u003C' or the equivalent entity in the emitted string literals) or sanitize and strictly validate untrusted template text before compilation, accepting that such filtering may break legitimate templates containing those characters. Deploying a Content-Security-Policy with script-src nonces/hashes on pages that embed precompiled templates reduces the impact of the injected markup, though it does not fix the underlying output-encoding flaw; a strict CSP may also require reworking existing inline script usage. Custom JavaScriptCompiler subclasses that write template-derived strings into generated code should likewise be changed to use this.quotedString(), as the updated compiler API documentation now instructs. No public exploit code or confirmed active exploitation was identified at time of analysis, so remediation can be scheduled with normal change-management rather than emergency timelines.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in npm, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Handlebars is a widely used semantic templating library for JavaScript; its precompiler (lib/precompiler.js) and code generator (lib/handlebars/compiler/code-gen.js) transform templates into JavaScript source at build or runtime. The root cause is improper neutralization of special elements in output (CWE-116): the quotedString() function in code-gen.js escaped quotes, backslashes, control characters, and U+2028/U+2029, but did not escape the character sequences that HTML's 'restrictions for contents of script elements' treat as structural - specifically '<!--', '<script', and '</script'. Because the '<' of those sequences was written through verbatim into the generated string literal, a closing script delimiter contained in attacker-influenced template text could close the enclosing inline <script> element in the host HTML page, allowing subsequent attacker markup to be parsed as HTML and executed as script. The upstream fix commit 609d1b11c833c9a3e00f56f2f34d22f425446725 introduces a safeJsonLiteral() helper that wraps JSON.stringify with escaping of line separators, lone/paired UTF-16 surrogates, and script delimiters (replacing '<' with \u003C), adds a NEEDS_ESCAPING regex fast path for performance, and replaces several JSON.stringify() calls in javascript-compiler.js and precompiler.js with this.quotedString()/safeJsonLiteral() so that all names, strings, indentation options, and location metadata are emitted safely. The compiler is also affected through the JavaScriptCompiler extension API, and the patch updated docs/compiler-api.md to warn that custom compilers must use this.quotedString() rather than JSON.stringify when writing template-derived strings into generated code.
Know when JavaScript gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
Attacker-supplied template is network-delivered (AV:N) but the rare inline-script precompile integration drives AC:H; no auth to submit (PR:N), victim must load the page (UI:R), and script injection crosses into the browser context (S:C, C:L/I:L).
Primary rating from Vendor (github).
CVSS VectorVendor: github
Lifecycle Timeline
2DescriptionCVE.org
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.
Blast Radius
ecosystem impact- 3 npm packages depend on handlebars (1 direct, 2 indirect)
Ecosystem-wide dependent count for version 4.0.0.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
More in JavaScript
View allCommand injection in simple-git, the Node.js library for running git commands and published on npm, affects all releases
Stored DOM-based cross-site scripting in Paella Player's closed-caption rendering path (paella-core before 2.12.11) allo
Authorization bypass in Wiki.js through 2.5.314 allows an authenticated user who has been granted access to at least one
Untrusted git configuration includes reachable through simple-git before 4.0.0 let an attacker execute arbitrary command
Improper memory allocation control in ExifReader before 4.41.1 allows remote attackers to exhaust heap memory and termin
Deeply nested brace patterns cause unbounded recursion in the npm brace-expansion library, exhausting the native stack a
Stack exhaustion in the npm library brace-expansion (all versions prior to 1.1.19, 2.1.5, 3.0.7, and 5.0.10) lets a craf
Server-side request forgery in Wiki.js through 2.5.314 lets an authenticated user who holds page-editing permissions for
The JavaScript library ip-address (npm) fails to treat the NAT64 local-use prefix 64:ff9b:1::/48 as private, so applicat
Authorization bypass in the @grpc/grpc-js-xds package (the xDS/RBAC extension for @grpc/grpc-js) lets a request for one
Cross-family subnet comparisons in the ip-address npm library (all versions before 10.7.1) can cause isInSubnet and isHo
Denial of service in the ip-address JavaScript/npm library (all versions prior to 10.7.1) lets remote attackers stall or
EUVD-2026-93974
GHSA-xw65-4hp5-5hc7
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB