10.29 Slow HTTP Denial of Service Attack (Slowloris)

站長日誌 109.10.29

弱點掃描偵測到Slow HTTP Denial of Service Attack弱點一隻

Server-Specific Recommendations

Applying the above steps to the HTTP servers tested in the previous article indicates the following server-specific settings:

Apache

  • Using the <Limit> and <LimitExcept> directives to drop requests with methods not supported by the URL alone won’t help, because Apache waits for the entire request to complete before applying these directives. Therefore, use these parameters in conjunction with the LimitRequestFieldsLimitRequestFieldSizeLimitRequestBodyLimitRequestLineLimitXMLRequestBody directives as appropriate. For example, it is unlikely that your web app requires an 8190 byte header, or an unlimited body size, or 100 headers per request, as most default configurations have. 
  • Set reasonable TimeOut and KeepAliveTimeOut directive values. The default value of 300 seconds for TimeOut is overkill for most situations.
  • ListenBackLog’s default value of 511 could be increased, which is helpful when the server can’t accept connections fast enough.
  • Increase the MaxRequestWorkers directive to allow the server to handle the maximum number of simultaneous connections.
  • Adjust the AcceptFilter directive, which is supported on FreeBSD and Linux, and enables operating system specific optimizations for a listening socket by protocol type. For example, the httpready Accept Filter buffers entire HTTP requests at the kernel level.

A number of Apache modules are available to minimize the threat of slow HTTP attacks. For example, mod_reqtimeout’s RequestReadTimeout directive helps to control slow connections by setting timeout and minimum data rate for receiving requests.

I also recommend switching apache2 to experimental Event MPM mode where available.  This uses a dedicated thread to handle the listening sockets and all sockets that are in a Keep Alive state, which means incomplete connections use fewer resources while being polled.



Slow HTTP Denial of Service Attack 是以緩速發出http request,耗用伺服器資源,達到癱瘓服務的目的,解決方案即是設定 Timeout

打開apache 設定檔,HP-UX位置是在/opt/hpws22/apache/conf/httpd.conf:

在最下方加入以下設定

RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500




在 Apache 2.4 中已經內建 mod_reqtimeout,只需要先在 httpd.conf 中把 # 拿掉啟用即可
1
2
3
4
5
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
 
改為
LoadModule reqtimeout_module modules/mod_reqtimeout.so
接下來就是設定
1
2
3
4
<IfModule reqtimeout_modeule>
RequestReadTimeout header=10-20,MinRate=500
RequestReadTimeout body=10,MinRate=500
</IfModule>



resin沒有以上參數 調整maxIdelTime為5000 (millisecend) 
弱點消失

留言

這個網誌中的熱門文章

在CentOS 8 Stream安裝NTP Client與設定時區