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.
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/andnet/http/cgi.Handler.PathLocationHeaderis set,net/http/cgiparses theLocationas a URL and passes it toPathLocationHeader.When the
Locationis a protocol-relative URL such as//host/path, this passes a URL with a hostname toPathLocationHeader, 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/cgito better handle protocol-relative URLs inLocationheaders for correctness/hardening.