CVE-2023-39319
MediumSummary
The html/template package in Go improperly applies rules for handling "<script", "<!--", and "</script" sequences within JS literals in <script> contexts. This may cause the template parser to prematurely terminate script contexts, leading to improper escaping of actions.
Risk Assessment
The organization is at risk of JavaScript injection (XSS) in web applications using this package, potentially allowing an attacker to execute malicious scripts in the victim's browser.
Recommendation
Immediately update the html/template package to a patched version (e.g., Go 1.21.1 or later). Also review template code for potentially dangerous patterns.
Other vulnerabilities in html/template
See all- CVE-2024-24785Medium
A vulnerability in Go's html/template package allows bypassing contextual auto-escaping if errors returned by MarshalJSON methods contain user-controlled data. This can lead to injection of unexpected content into HTML templates.
- CVE-2023-39318Medium
The html/template package in Go improperly handles HTML-like "" and hashbang "#!" comment tokens within <script> contexts. This can cause the template parser to misinterpret script contents, leading to improper escaping of actions.
Original NVD description (English source)
The html/template package does not apply the proper rules for handling occurrences of "<script", "<!--", and "</script" within JS literals in <script> contexts. This may cause the template parser to improperly consider script contexts to be terminated early, causing actions to be improperly escaped.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

