CVE-2023-39318: Improper handling of HTML-like comments in script contexts in html/template
Golang Go is vulnerable to cross-site scripting, caused by improper validation of user-supplied input by the html/template package. A remote attacker could exploit this vulnerability using a specially crafted URL to execute script in a victim's Web browser within the security context of the hosting Web site, once the URL is clicked. An attacker could use this vulnerability to steal the victim's cookie-based authentication credentials.
Other sources
Improper handling of HTML-like comments in script contexts in html/template
— Microsoft
The html/template package did not properly handle HMTL-like "<!--" and "-->"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 could be leveraged to perform an XSS attack.
— Red Hat
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.
— Launchpad
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is the vulnerability ID?
The vulnerability ID is CVE-2023-39318.
What is the severity of CVE-2023-39318?
The severity of CVE-2023-39318 is medium.
What is the affected software for CVE-2023-39318?
The affected software for CVE-2023-39318 is Golang Go versions between 1.20.8 and 1.21.1.
How does CVE-2023-39318 affect the html/template package?
CVE-2023-39318 affects the html/template package by not properly handling HTML-like comment tokens and hashbang #! comment tokens in <script> contexts, leading to improper interpretation of contents and potential escaping issues.
Are there any references related to CVE-2023-39318?
Yes, here are some references related to CVE-2023-39318: [Link 1](https://go.dev/cl/526156), [Link 2](https://go.dev/issue/62196), [Link 3](https://groups.google.com/g/golang-dev/c/2C5vbR-UNkI/m/L1hdrPhfBAAJ).