Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-94448 Overview
CVE-2026-94448 is a cross-site scripting (XSS) vulnerability [CWE-79] in the Go standard library's HTML template handling. The flaw affects how the templating engine tracks context inside JavaScript template literals. When a template literal contains consecutive expressions, the context tracking state fails to reset upon entering a new expression. As a result, subsequent regular expression literals are not correctly recognized and escaped. An attacker who controls data rendered into such a template literal can inject content that breaks out of the intended JavaScript context.
Critical Impact
Improper escaping inside JavaScript template literals allows attacker-influenced input to execute as script in a victim's browser, enabling reflected or stored XSS against users of applications built with the affected Go versions.
Affected Products
- Go standard library html/template package (see GO-2026-6599)
- Go applications rendering untrusted input inside JavaScript template literals with consecutive expressions
- Downstream frameworks and services depending on vulnerable Go releases
Discovery Timeline
- 2026-10-08 - CVE-2026-94448 published to the National Vulnerability Database (NVD)
- 2026-10-15 - Last updated in NVD database
Technical Details for CVE-2026-94448
Vulnerability Analysis
The Go html/template package performs contextual auto-escaping. It parses output as it is generated and selects an escaping strategy based on the surrounding syntactic context, such as HTML text, attribute values, URLs, or JavaScript. Inside a JavaScript template literal (a string enclosed in backticks), embedded ${ ... } expressions switch the parser into a JavaScript expression context.
The defect occurs when a template literal contains two or more consecutive ${ ... } expressions. On entering the second expression, context tracking variables carried over from the previous expression are not reset. The parser then misclassifies tokens that follow, including regular expression literals, and fails to apply the correct escaping. Attacker-supplied data interpolated into these positions can terminate the literal and inject executable JavaScript.
Root Cause
The root cause is incomplete state management in the template-literal expression parser. Entering a new ${ ... } block should reinitialize context flags that describe whether the next token is a regular expression literal or a division operator. Because this reset was missing, stale context led to incorrect escaping decisions. The fix ensures template-literal expression entries correctly reset context variables so all subsequent regular expression literals are accurately recognized and escaped.
Attack Vector
Exploitation requires network delivery of crafted input and user interaction, such as visiting a page that renders the vulnerable template. The attacker supplies data that reaches a JavaScript template literal containing consecutive expressions. The malformed escaping lets the input close the literal and append arbitrary script, which executes in the victim's browser session under the application's origin.
The vulnerability mechanism is documented in the upstream fix. See the Go.dev Change Log Entry, the Go.dev Issue Tracker Update, and the Go.dev Vulnerability Report for technical details.
Detection Methods for CVE-2026-94448
Indicators of Compromise
- Reflected or stored payloads containing backtick characters, ${ sequences, or regular expression literal syntax inside parameters that are later rendered by Go templates.
- Browser console errors or Content Security Policy (CSP) violations originating from pages that render user-controlled data inside JavaScript template literals.
- Outbound requests from client browsers to unexpected hosts shortly after loading pages built with Go html/template.
Detection Strategies
- Inventory Go binaries and services, then cross-reference their Go toolchain version against the fixed release listed in GO-2026-6599.
- Perform static analysis of templates for JavaScript template literals that embed multiple consecutive ${ ... } expressions interpolating external data.
- Run dynamic testing with payloads that place regular expression literals immediately after a template-literal expression to confirm whether escaping is applied.
Monitoring Recommendations
- Monitor web application firewall (WAF) logs for request parameters containing suspicious backtick and ${ patterns targeting template-rendered endpoints.
- Alert on CSP report-only violations and inline script execution reports from front-end telemetry.
- Correlate authentication anomalies with recent page views of templates known to interpolate user input into JavaScript contexts.
How to Mitigate CVE-2026-94448
Immediate Actions Required
- Upgrade the Go toolchain to the fixed version identified in the Go.dev Vulnerability Report and rebuild all affected binaries.
- Audit templates for JavaScript template literals that embed multiple consecutive expressions with untrusted data and refactor where feasible.
- Enforce a strict Content Security Policy that disables inline script execution and restricts script sources to trusted origins.
Patch Information
The fix is tracked in Go issue 81821 and change 839866. Rebuild applications with a patched Go release and redeploy. Review the Google Groups Announcement for the full list of fixed versions and release notes.
Workarounds
- Avoid interpolating untrusted data directly into JavaScript template literals; render it into JSON via json.Marshal and reference the JSON value from script instead.
- Apply server-side input validation and output encoding at the application layer as a defense-in-depth measure until the Go toolchain upgrade is complete.
- Deploy a strict CSP with script-src restrictions and nonces to limit the impact of successful script injection.
# Verify installed Go version and rebuild services after upgrading
go version
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

