CVE-2020-24553: Cross-Site Scripting Vulnerability in net/http/cgi and net/http/fcgi Packages

stdlib Updated 02 Oct 2025

Summary

13/01/2022
Yes i
Unrated
Not published

CVE-2020-24553: Cross-site scripting in net/http/cgi and net/http/fcgi. Affects stdlib across 2 version ranges.

< 1.14.8 >= 1.15.0-0, < 1.15.1

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

Also tracked for

The same CVE-2020-24553 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

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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The net/http/cgi and net/http/fcgi packages in the Go ecosystem provide functionality for handling Common Gateway Interface (CGI) and FastCGI requests in Go applications. These packages are commonly used to build web servers and handle HTTP requests. However, a vulnerability has been identified in these packages that can lead to a Cross-Site Scripting (XSS) attack if an attacker can control any part of the response content.

Vulnerability Detail

The vulnerability arises when a Handler does not explicitly set the Content-Type header in the response. In such cases, the net/http/cgi and net/http/fcgi packages default to "text/html" as the Content-Type. This default behavior can be exploited by an attacker to inject malicious scripts into the response, leading to a Cross-Site Scripting vulnerability. If successful, the attacker can execute arbitrary JavaScript code in the context of the victim's browser, potentially compromising sensitive user information or performing unauthorized actions.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

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

  • < 1.14.8 1.14.8
    go get stdlib@v1.14.8
  • >= 1.15.0-0, < 1.15.1 1.15.1
    go get stdlib@v1.15.1

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 workaround, developers can manually set the Content-Type header to a safe value, such as "text/plain", for responses that do not contain HTML content. This prevents the browser from interpreting the response as HTML and mitigates the risk of XSS attacks. Here is an example of how to set the Content-Type header in a Go HTTP handler:

func handler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "text/plain")
    // Rest of the handler code
}

Conclusion

The net/http/cgi and net/http/fcgi packages in the Go ecosystem are vulnerable to a Cross-Site Scripting (XSS) attack when the Content-Type header is not explicitly set in the response. This can allow an attacker to inject and execute arbitrary JavaScript code in the victim's browser. To mitigate this vulnerability, developers should ensure that the Content-Type header is set appropriately for each response. It is recommended to review the code and apply the necessary fixes to prevent potential exploitation. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

The vulnerability allows an attacker to inject and execute arbitrary JavaScript code in the context of a victim's browser. This can lead to various consequences, including the theft of sensitive user information, session hijacking, or performing unauthorized actions on behalf of the victim.

The vulnerability was introduced in version 0 of both packages and was fixed in version 1.14.8 and 1.15.1. Versions between 1.15.0 and 1.15.1 are also affected.

There are currently no known public exploits of this vulnerability. However, it is important to apply the recommended fixes to prevent potential exploitation.

Yes, this vulnerability has been assigned the CVE identifier CVE-2020-24553.

You can find more information about this vulnerability, including technical details and the affected package versions, in the vulnerability database entry: https://pkg.go.dev/vuln/GO-2021-0143.

Related vulnerabilities

Recent vulnerabilities recorded for stdlib.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

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

  • < 1.14.8 1.14.8
    go get stdlib@v1.14.8
  • >= 1.15.0-0, < 1.15.1 1.15.1
    go get stdlib@v1.15.1

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