CVE-2023-39318

published 8 Sep 2023 · updated 12 Nov 2026

Improper handling of HTML-like comments in script contexts in html/template

6.1MediumCVSS 6.1EPSS 1%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 1%. Fixed in 1.20.8 and 1.21.1.

The html/template package does not properly handle HTML-like "" comment tokens, nor hashbang "#!" comment tokens, in <script> contexts. This may cause the template parser to improperly interpret the contents of <script> contexts, causing actions to be improperly escaped. This may be leveraged to perform an XSS attack.

Affected

Vendors, products and packages with version ranges

VendorProductVersionsFixed
Go standard library<1.20.8, >=1.21.0-0 <1.21.11.20.8, 1.21.1

Timeline

Every event on this vulnerability

Embed

A live severity badge for an advisory, README or ticket

CVE-2023-39318 severity on Zeptric[![CVE-2023-39318](https://zeptric.io/badge/cve/CVE-2023-39318.svg)](https://zeptric.io/cve/CVE-2023-39318)