CVE-2023-24539: Improper sanitization of CSS values in html/template

Published May 7, 2023
·
Updated

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

13 affected componentsFixes available
debian/golang-1.15<=1.15.15-1~deb11u4
debian/golang-1.19<=1.19.8-2
Golang Go<1.19.9
Golang Go>=1.20.0<1.20.4
IBM Concert Software<=1.0.0 - 1.0.1
redhat/golang<1.19.9
1.19.9
redhat/golang<1.20.4
1.20.4
Microsoft cbl2 golang 1.18.8-7
Microsoft cbl2 golang 1.17.13-2
Microsoft azl3 golang 1.20.7-1<1.20.7-1
1.20.7-1
Microsoft cbl2 golang 1.20.7-1<1.20.7-1
1.20.7-1
Microsoft cbl2 msft-golang 1.20.11-1<1.20.11-1
1.20.11-1
Microsoft cbl2 golang 1.21.6-1<1.21.6-1
1.21.6-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/golang to a version that resolves this vulnerability.

    Fixed in 1.19.9
  2. Upgrade

    Upgrade redhat/golang to a version that resolves this vulnerability.

    Fixed in 1.20.4
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.20.7-1
  4. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.20.11-1
  5. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.21.6-1
  6. 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
  7. 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

May 7, 2023
Data Sourced
via Red Hat·04:20 PM
DescriptionSeverityAffected Software
May 11, 2023
CVE Published
via MITRE·03:29 PM
Data Sourced
via MITRE·03:29 PM
DescriptionWeakness
Oct 14, 2024
Data Sourced
via Ubuntu·01:15 PM
RemedyDescriptionSeverityAffected Software
Data Sourced
via Launchpad·01:16 PM
Description
Oct 21, 2024
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Sep 4, 2025
Data Sourced
via Microsoft·11:09 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·11:09 AM
Affected Software
Updated
via Microsoft·11:09 AM
DescriptionSeverity

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the vulnerability ID for this issue?

The vulnerability ID for this issue is CVE-2023-24539.

2

What is the severity of CVE-2023-24539?

The severity of CVE-2023-24539 is high.

3

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.

4

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.

5

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.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203