Advisory

GO-2021-0226

Also known as: BIT-golang-2020-24553, CVE-2020-24553

Summary

Cross-site scripting in net/http/cgi and net/http/fcgi

Details

When a Handler does not explicitly set the Content-Type header, the the package would default to “text/html”, which could cause a Cross-Site Scripting vulnerability if an attacker can control any part of the contents of a response.

The Content-Type header is now set based on the contents of the first Write using http.DetectContentType, which is consistent with the behavior of the net/http package.

Although this protects some applications that validate the contents of uploaded files, not setting the Content-Type header explicitly on any attacker-controlled file is unsafe and should be avoided.

Severity

Not rated by the source.

Dates

Published
2022-01-13 03:44 UTC
Modified
2024-05-20 16:03 UTC

Affected packages and fixes

stdlib

Go · All systems

Affected

  • introduced 0, fixed 1.14.8, introduced 1.15.0-0, fixed 1.15.1 (semver)

Fixed versions

1.14.8, 1.15.1

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: Go Vulnerability Database · CC BY 4.0

Sources & licences