-
Notifications
You must be signed in to change notification settings - Fork 103
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
HTTTP/2 (D)DoS prevention #1346
Comments
Tempesta should send SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame when initializing connection with client. Please enable http2_general.test_h2_streams.TestH2Stream.test_max_concurrent_stream test after fixes |
During developing this task we should don't forget to change
|
Related CVE and security advisory GHSA-93p3-5r25-4p75 |
However, it seems in current task we must implement rate limits for SETTINGS, PING and maybe WINDOW_UPDATE frame. But let's start from SETTINGS and PING. WINDOW_UPDATE requires some discussion, because it's not so easy and maybe it not worth it. For instance, client can send unlimited number of WINDOW_UPDATE frames to closed streams, that also not good. |
After some discussion, we came to the conclusion that we need one timer per connection and bitfield that indicates stream stream being read in the timer interval. On every shot timer clears bitfield. However this doesn't look like complete solution. |
For "slow read": A simple solution:
It works similarly to apache httpd, but here we aim at the response direction and use |
For "HTTTP/2 flood prevention":
|
In this issue must be implemented fixes for following CVEs: |
Crucial since DDoS affects our installation |
HTTTP/2 flood prevention
Low-Rate Denial-of-Service Attacks against HTTP/2 Services paper studies HTTP/2 floods using
PING
andWINDOW_UPDATE
frames. It's not good to fight against the attacks using packet rate limit since a client can send large POST requests for example. From the other hand requests rate in such attacks could be zero. So a new limits with burst, just the same as for current request limiting, must be developed.It makes sense to apply the limit to service frames only since
HEADERS
andDATA
obey existing HTTP request limits. We can limit all the service frames at once, there is no need to limit them separately.HTTTP/2 slow read
Slow Read Attack (CVE-2016-1546) uses many concurrent streams with little window updates, so
The HTTP limits must be extended by
stream_rate
,stream_burst
andjust similar to equal connection limits.concurrent_streams
response_timeout
limit must be introduced for both the HTTP/1 and HTTP/2. The limit specifies how long we can be sending a given response to a client. To not to rate limit valid Comet responses one must specify the limit for vhosts other than servicing Comet resources.HPACK bomb
Huffman decoding is an expensive operation and we must checkhttp_field_len
Frang limit before Huffman decoding execution (see also HPACK bomb). Considering implementation variants - it seems that the simplest and most effective way is to embed a hook into HTTP/2-parser (or into HPACK-decoder) directly to catch the long headers immediately.Also see corresponding TODO comment for__frang_http_field_len()
inhttp_limits.c
- we should do the same for HTTP/1.We have separate issue for this #1780Header list size limit
HTTP limiting module provides important for HTTP/2 security limithttp_header_cnt
. According to RFC 7540 chapters 10.5.1 and 6.5.2 having the limit set, Tempesta should sendSETTINGS_MAX_HEADER_LIST_SIZE
settings parameter to a client.Testing
Test to reproduce for concurrent streams.
Documentation
Please update https://github.com/tempesta-tech/tempesta/wiki/HTTP-security#frang-security-limits-enforcing-module with the reference to the paper.
The text was updated successfully, but these errors were encountered: