CVE-2023-24539: golang - Injection of Unexpected HTML via CSS Context

golang Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2023-24539: Improper sanitization of CSS values in html/template. Affects golang across 2 version ranges.

< 1.19.9 >= 1.20.0, < 1.20.4

Fixed in 1.19.9 or 1.20.4, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2023-24539 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The golang package, developed by Bitnami, is an open-source programming language that is widely used for building efficient and reliable software. It provides a rich set of libraries and tools for various applications. However, a vulnerability has been identified in golang that allows for the injection of unexpected HTML via the CSS context.

Vulnerability Detail

The vulnerability in golang arises from the fact that angle brackets (<>) are not considered dangerous characters when inserted into CSS contexts. This can lead to unexpected closing of the CSS context and enable the injection of unexpected HTML, especially when executed with untrusted input. The injection of malicious HTML can have severe consequences, such as cross-site scripting (XSS) attacks and unauthorized access to sensitive information.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.19.9 1.19.9
  • >= 1.20.0, < 1.20.4 1.20.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, developers can sanitize user input by escaping angle brackets and other potentially dangerous characters before using them in CSS contexts. Here is an example of how to sanitize user input in Go:

import "html"

func sanitizeInput(input string) string {
  return html.EscapeString(input)
}

Conclusion

The vulnerability in golang that allows for the injection of unexpected HTML via the CSS context can have severe consequences, including XSS attacks and unauthorized access to sensitive information. It is crucial to update to the latest version of golang (1.20.4 or later) or apply the provided workaround to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for golang →

Share this vulnerability

FAQ

This vulnerability allows an attacker to inject unexpected HTML into a CSS context, which can lead to cross-site scripting (XSS) attacks and unauthorized access to sensitive information.

At the time of this report, there is no known exploit for this vulnerability. However, it is crucial to apply the recommended fix or workaround to prevent any potential exploitation.

No, only versions prior to 1.20.4 are affected. It is recommended to update to the latest version to ensure the security of your application.

Input validation alone is not sufficient to mitigate this vulnerability. While input validation is a good practice, it is essential to update to the fixed version of golang to address the underlying issue.

For more information about this vulnerability, you can refer to the official CVE entry: CVE-2023-24539.

Related vulnerabilities

Recent vulnerabilities recorded for golang.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.19.9 1.19.9
  • >= 1.20.0, < 1.20.4 1.20.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback