Description
The net/http
client does not sufficiently sanitize or check the validity of the Request.Host
field. A maliciously-crafted Host
field can inject request headers or entire new requests into the sent request. For example, setting Request.Host
to "hostname\r\nX-Header: oops"
adds an X-Header: oops
header to the request.
Whether this is a vulnerability or just a bug depends on whether the Request.Host
field is expected to be secured against untrusted inputs. We don't document this one way or the other. Exploiting this in practice seems difficult, since it requires requests to be sent using an unsanitized and untrusted Request.Host
value, so if this is a vulnerability it seems reasonable to treat it as PUBLIC track. Either way, we should fix it.
This is a continuation of #11206, which reports the same issue but had an incomplete fix.
Thanks to @bartekn for reporting this issue.