-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Defends against slow HTTP attacks. #2457
Comments
Adds `Server::http1_header_read_timeout(Duration)`. Setting a duration will determine how long a client has to finish sending all the request headers before trigger a timeout test. This can help reduce resource usage when bad actors open connections without sending full requests. Closes #2457
Should #2675 have fully closed this? Seems like the second half of this issue is |
I believe a user can handle a body timeout outside of a hyper, since you can add a timeout to any waiting on a body chunk. Is there something specific about it that hyper would need to do directly? |
Yeah, that should be sufficient. Sorry; when I read #2675 I noticed it said it partially addressed this issue, and that this issue's second half was |
PR #2675 does not actually defend against slowloris attacks. From my comment there:
What is needed is an actual "you sent no data over this period of time? close socket" timeout, and this should also be implemented for HTTP/2/3. There is a timeout field in https://recursion.wtf/embed-wasm/hyper/server/conn/struct.AddrIncoming.html but there is no way for the user to set it. Egads, the server socket is not closed until the client finally sends some data too late -- which is not how a massive open socket attack is going to go. This issue ought to be reopened. |
That's kind of hard, there are many things to take into account. For example:
That looks like the timeout for when accepting fails (usually due to "too many open files"). It's set to a sleep w/ a duration of 1 second when an error happens, when it has elapsed, it is removed. Edit: I'm facing similar issues btw, I just thought I'd share my experience. |
I think hyper needs to add capabilities such as client_header_timeout and client_body_timeout to defend against slow attacks.
The Nginx defense method is as follows:
https://www.nginx.com/blog/mitigating-ddos-attacks-with-nginx-and-nginx-plus/#client_header_timeout
The text was updated successfully, but these errors were encountered: