CVE-2026-32289: stdlib Package XSS Vulnerability in html/template Due to JsBraceDepth Context Tracking Bugs
Summary
CVE-2026-32289: JsBraceDepth Context Tracking Bugs (XSS) in html/template. Affects stdlib across 2 version ranges.
< 1.25.9
>= 1.26.0-0, < 1.26.2
Fixed in 1.25.9 or 1.26.2, depending on the release line you run. How to fix ↓
Also tracked for
The same CVE-2026-32289 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The stdlib package in Go provides a comprehensive standard library that includes various functionalities for developers. One of its key components is the html/template package, which allows for safe HTML rendering and templating. However, this package is vulnerable to specific context tracking bugs that can lead to cross-site scripting (XSS) attacks, compromising the security of applications that utilize it.
Vulnerability Detail
The vulnerability arises from improper context tracking across template branches for JavaScript template literals. This flaw can lead to incorrect escaping of content when branches are used, potentially allowing malicious scripts to be executed in the user's browser. Additionally, template actions within JavaScript template literals do not correctly track brace depth, further exacerbating the risk of XSS vulnerabilities. As a result, attackers could exploit this vulnerability to inject harmful scripts into web applications, affecting user data and application integrity.
How To Fix
Latest published version: go1.25.5 as of 22 Oct 2026
go get stdlib@vgo1.25.5
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 1.25.91.25.9go get stdlib@v1.25.9 -
>= 1.26.0-0, < 1.26.21.26.2go get stdlib@v1.26.2
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary measure, developers can avoid using JavaScript template literals in their templates until the package is updated. Additionally, careful validation and sanitization of user inputs can help mitigate the risk of XSS attacks.
Conclusion
The CVE-2026-32289 vulnerability in the stdlib package's html/template component poses significant security risks due to improper context tracking in JavaScript template literals. It is crucial for developers to update to the patched versions to safeguard their applications against potential XSS attacks.
See every vulnerability recorded for stdlib →
FAQ
CVE-2026-32289 is a vulnerability in the stdlib package's html/template component that can lead to XSS attacks due to improper context tracking.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Exploiting this vulnerability can allow attackers to inject malicious scripts into web applications, potentially compromising user data and application security.
Versions prior to 1.25.9 and 1.26.2 (for pre-release) are affected by this vulnerability.
If an immediate update is not possible, consider implementing input validation and sanitization as a temporary workaround to mitigate risks.
References
Related vulnerabilities
Recent vulnerabilities recorded for stdlib.