CVE-2023-24539: Improper sanitization of CSS values in html/template
Angle brackets (<>) are not considered dangerous characters when inserted into CSS contexts. Templates containing multiple actions separated by a '/' character can result in unexpectedly closing the CSS context and allowing for injection of unexpected HTML, if executed with untrusted input.
Other sources
Angle brackets (<>) were not considered dangerous characters when inserted into CSS contexts. Templates containing multiple actions separated by a '/' character could result in unexpectedly closing the CSS context and allowing for injection of unexpected HMTL, if executed with untrusted input.
— Red Hat
Go is vulnerable to HTML injection. A remote attacker could inject malicious HTML code into a template containing multiple actions separated by a '/' character, which when viewed, would execute in the victim's Web browser within the security context of the hosting site.
— IBM
Improper sanitization of CSS values in html/template
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/golangto a version that resolves this vulnerability.Fixed in 1.19.9 - Upgrade
Upgrade
redhat/golangto a version that resolves this vulnerability.Fixed in 1.20.4 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.20.7-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.20.11-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.21.6-1 - Configuration
Mitigate the HTML injection issue by ensuring html/template properly sanitizes CSS values so that angle brackets and other HTML-significant characters are not introduced into CSS contexts in a way that can escape/close the CSS context.
Go html/template CSS value sanitization in html/template = Ensure proper sanitization of CSS values when templates render into CSS contexts - Compensating control
Do not execute templates (or template actions separated by '/' that can be interpreted as closing/opening contexts) with untrusted input; ensure any input rendered into templates is trusted or strictly sanitized/validated so it cannot exploit context-escaping behavior.
Event History
Frequently Asked Questions
What is the vulnerability ID for this issue?
The vulnerability ID for this issue is CVE-2023-24539.
What is the severity of CVE-2023-24539?
The severity of CVE-2023-24539 is high.
Which software versions are affected by CVE-2023-24539?
Versions up to and excluding 1.19.9 of the golang package from Red Hat, as well as versions between 1.20.0 and 1.20.4, are affected by CVE-2023-24539.
What is the description of CVE-2023-24539?
CVE-2023-24539 allows for injection of unexpected HTML if executed with untrusted input due to angle brackets (<>) not being considered as dangerous characters when inserted into CSS contexts and templates with multiple actions separated by a '/' character.
How can I mitigate the vulnerability CVE-2023-24539?
To mitigate CVE-2023-24539, update the golang package to versions 1.19.9 or 1.20.4, as provided by Red Hat.