Skip to content

net/http/cgi: local Location can be misparsed as protocol-relative URL #78767

Description

@neild

A CGI handler may return a Location: header to return a reference to some document rather than the document itself.

When the Location: header value starts with a / and net/http/cgi.Handler.PathLocationHeader is set, net/http/cgi parses the Location as a URL and passes it to PathLocationHeader.

When the Location is a protocol-relative URL such as //host/path, this passes a URL with a hostname to PathLocationHeader, which is probably surprising.

This was reported to us as a potential vulnerability. Given that the Location header comes from a CGI program, where a malicious program likely has much more exciting opportunities for misbehavior, we don't feel this constitutes a vulnerability. However, it would be reasonable for net/http/cgi to better handle protocol-relative URLs in Location headers for correctness/hardening.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions