CVE-2023-39318: Vulnerability in stdlib package - Improper handling of HTML-like comments within script contexts

golang-1.15 Updated 02 Oct 2025

Summary

08/09/2023
N/A
No i
Medium
6.1

CVE-2023-39318: The html/template package does not properly handle HTML-like "" comment tokens, nor hashbang "#!" comment tokens, in contexts. Affects golang-1.15 versions < d5b851804329aa547dafa278a0c35dd62298d651. No fix is published. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The stdlib package is a part of the Go programming language and provides a collection of standard libraries for various functionalities. It includes modules for file I/O, networking, cryptography, and more. The package is widely used in Go applications and is an integral part of the Go ecosystem. However, a vulnerability has been discovered in the html/template module of the stdlib package, which can lead to improper handling of HTML-like comments within script contexts.

Vulnerability Detail

The html/template module in the stdlib package does not properly handle HTML-like "" comment tokens and hashbang "#!" comment tokens within <script> contexts. This can result in the template parser misinterpreting the contents of <script> contexts, leading to actions being improperly escaped. Exploiting this vulnerability can allow an attacker to perform cross-site scripting (XSS) attacks. The vulnerability has a CVSS score of 6.1, indicating a medium severity level.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, developers can mitigate the risk by ensuring that user-generated content is properly sanitized and validated before being rendered within <script> contexts. Implementing strict input validation and output encoding can help prevent potential XSS attacks.

Conclusion

The vulnerability in the stdlib package's html/template module can lead to improper handling of HTML-like comments within script contexts, potentially enabling cross-site scripting (XSS) attacks. It is crucial for developers to update their applications to use the fixed versions of the stdlib package and implement proper input validation and output encoding to mitigate the risk. For further support and assistance in vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for golang-1.15 →

Share this vulnerability

FAQ

The vulnerability allows an attacker to perform cross-site scripting (XSS) attacks by improperly escaping actions within <script> contexts. This can lead to the execution of malicious scripts on the victim's browser, potentially compromising sensitive information or performing unauthorized actions.

To determine if your application is affected, you can use the Vulert Playground (https://vulert.com/scanner) without any signup. Vulert analyzes your manifest file, such as package-lock.json, to identify and alert in real-time for open-source vulnerabilities, including this specific vulnerability.

At the time of this report, there are no known public exploits available for this vulnerability. However, it is crucial to apply the recommended fixes promptly to mitigate the risk of potential attacks.

The primary solution is to update the stdlib package to the fixed versions. However, if updating the package is not feasible in the short term, developers can implement strict input validation and output encoding to mitigate the risk of XSS attacks within <script> contexts.

You can find more information about this vulnerability, including the CVE identifier, on the NIST National Vulnerability Database (NVD) website: https://nvd.nist.gov/vuln/detail/CVE-2023-39318

Related vulnerabilities

Recent vulnerabilities recorded for golang-1.15.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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