` was emitted unchanged. HTML parsers recognize `` even inside a JavaScript string literal, closing the surrounding script element and allowing following attacker-controlled markup to be parsed and executed.\n\nThis affects applications that precompile attacker-controlled templates and embed the generated sour","image":"https://o3.security/opengraph.png","datePublished":"2026-10-08T17:52:37Z","dateModified":"2026-10-08T18:00:09.713255773Z","url":"https://o3.security/vulnerability/CVE-2026-106444","inLanguage":"en","author":{"@id":"https://o3.security/#organization"},"publisher":{"@id":"https://o3.security/#organization"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://o3.security/vulnerability/CVE-2026-106444"},"speakable":{"@type":"SpeakableSpecification","cssSelector":["h1",".vuln-summary",".vuln-severity",".vuln-mitigation"]},"about":[{"@type":"SoftwareApplication","name":"handlebars","applicationCategory":"npm","softwareVersion":"4.7.10"}],"citation":[{"@type":"CreativeWork","name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-106444"},{"@type":"CreativeWork","name":"OSV.dev","url":"https://osv.dev/vulnerability/CVE-2026-106444"},{"@type":"CreativeWork","name":"FIRST.org EPSS","url":"https://www.first.org/epss/api-data?cve=CVE-2026-106444"},{"@type":"CreativeWork","url":"https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xw65-4hp5-5hc7"},{"@type":"CreativeWork","url":"https://github.com/handlebars-lang/handlebars.js/pull/2185"},{"@type":"CreativeWork","url":"https://github.com/handlebars-lang/handlebars.js/commit/609d1b11c833c9a3e00f56f2f34d22f425446725"},{"@type":"CreativeWork","url":"https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.10"}]}` was emitted unchanged. HTML parsers recognize `` even inside a JavaScript string literal, closing the surrounding script element and allowing following attacker-controlled markup to be parsed and executed.\n\nThis affects applications that precompile attacker-controlled templates and embed the generated sour","url":"https://o3.security/vulnerability/CVE-2026-106444","identifier":"CVE-2026-106444","datePublished":"2026-10-08T17:52:37Z","dateModified":"2026-10-08T18:00:09.713255773Z","inLanguage":"en","license":"https://creativecommons.org/licenses/by/4.0/","keywords":["CVE-2026-106444","MEDIUM severity","CWE-116","CVE","vulnerability","security advisory"],"creator":{"@id":"https://o3.security/#organization"},"isAccessibleForFree":true,"citation":[{"@type":"CreativeWork","name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-106444"},{"@type":"CreativeWork","name":"OSV.dev","url":"https://osv.dev/vulnerability/CVE-2026-106444"},{"@type":"CreativeWork","name":"FIRST.org EPSS","url":"https://www.first.org/epss/api-data?cve=CVE-2026-106444"}],"variableMeasured":[{"@type":"PropertyValue","name":"CVSS Base Score","value":4.7,"description":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N"},{"@type":"PropertyValue","name":"Severity","value":"MEDIUM"},{"@type":"PropertyValue","name":"EPSS Percentile","value":21}]}` was emitted unchanged. HTML parsers recognize `` even inside a JavaScript string literal, closing the surrounding script element and allowing following attacker-controlled markup to be parsed and executed.\n\nThis affects applications that precompile attacker-controlled templates and embed the generated source directly in an HTML `
Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
MEDIUM severity

Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled TemplatesGHSA-xw65-4hp5-5hc7

MEDIUMFix: handlebars-lang/handlebars.js#2185

GHSA-xw65-4hp5-5hc7 is a medium-severity (CVSS 4.7) CWE-116 vulnerability in handlebars. A fix is available for handlebars — see the affected versions and patch details below.

Also known asCVE-2026-106444
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 22, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for GHSA-xw65-4hp5-5hc7.

EPSS Exploitation Probability

via FIRST.org ↗
0.3%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs21th percentile — riskier than 21% of all scored CVEsHighest risk

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

GHSA-xw65-4hp5-5hc7 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

1 pkg affected
📦handlebars

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.

Description

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

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npmhandlebars≥ 4.0.0&&< 4.7.104.7.10npm install handlebars@4.7.10

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for handlebars, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update handlebars to 4.7.10 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-xw65-4hp5-5hc7 is resolved across your whole dependency graph.

  3. Workarounds

    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

A moderate severity cross-site scripting (XSS) flaw was found in the Handlebars JavaScript template library. When serializing static template text into generated JavaScript, Handlebars.precompile() does not escape sequences that terminate an enclosing HTML script element. An application that precompiles…

Workaround published by Red Hat
This flaw can be avoided without upgrading: do not embed precompiled output from untrusted or attacker-controlled Handlebars templates directly in inline HTML script elements. Where practical, serve generated precompiled templates as external JavaScript files, or rely on ordinary server-side rendering, since those usage patterns are not affected. Restricting template precompilation to trusted template sources also prevents attacker-controlled template text from reaching Handlebars.precompile(). Updating Handlebars to the upstream fixed version (4.7.10) also resolves this issue.
Source: Red Hat security advisory for GHSA-xw65-4hp5-5hc7 (CC BY 4.0)

Frequently Asked Questions

## 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 prec
O3 Security · Impact-Aware SCA

Is GHSA-xw65-4hp5-5hc7 in your dependencies?

Find it across npm, including transitive dependencies.

Handlebars: JavaScript Injection via Unsafe Inline…