Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Request.Write and Request.WriteProxy insufficiently validate User-Agent header #61824

Closed
neild opened this issue Aug 7, 2023 · 2 comments
Assignees

Comments

@neild
Copy link
Contributor

neild commented Aug 7, 2023

The net/http Request.Write and Request.WriteProxy functions do not validate the contents of the User-Agent header. A maliciously-crafted User-Agent field can inject request headers or entire new requests into the output.

This does not affect requests sent using Transport.RoundTrip, which validates all header values in Request.Header.

This cannot affect proxied requests or requests read with http.ReadRequest, since we would reject the invalid header at read time.

Given the limited circumstances this applies to, I'm inclined to call it a simple bug rather than a vulnerability. If it is a vulnerability, it's difficult enough to exploit that it seems reasonable to call it PUBLIC track.

Thanks to RyotaK (https://ryotak.net/) for reporting this issue.

@neild neild self-assigned this Aug 7, 2023
@gopherbot
Copy link

Change https://go.dev/cl/516836 mentions this issue: net/http: sanitize User-Agent header in request writer

@neild
Copy link
Contributor Author

neild commented Aug 8, 2023

After internal discussion: We're considering this a bug, but not a vulnerability. This requires the user to provide invalid input (garbage in, garbage out) and does not affect either the client or server request path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants