Go html/template Escaper Bypass Vulnerability Leading to Cross-Site Scripting

Vulnerability

A vulnerability exists in the Go programming language's html/template package, specifically in versions prior to 1.25.10 and from 1.26.0 up to but not including 1.26.3. This vulnerability allows for cross-site scripting (XSS) attacks by bypassing the template escaper. If a trusted template author includes a <script> tag with an empty 'type' attribute or one containing ASCII whitespace, any data passed into the <script> block will be improperly escaped. This issue was reported by a user named Mundur.

Impact

Exploitation of this vulnerability allows for cross-site scripting (XSS) attacks, where an attacker can inject malicious scripts that are executed in the context of the user's browser.

Reproduction

To reproduce this vulnerability, create a template using the html/template package in Go. Include a <script> tag with an empty 'type' attribute or a 'type' attribute that contains ASCII whitespace. When the template is executed with data passed into the <script> block, the data will be incorrectly escaped, allowing for potential XSS exploitation.

Remediation

Users can upgrade to Go versions 1.26.3 or 1.25.10, both of which include the necessary fix. Instructions for downloading these versions are available on the Go website.

Added: May 7, 2026, 8:53 PM
Updated: May 7, 2026, 8:53 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
1.7
exploitability
7.2
remediation
0.0
relevance
7.7
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.