跳到主要內容

哪些主機會承受(Slowloris)攻擊....Which web-server's are affected by slowloris attack?

  1. Apache (1.x & 2.x)
  2. dhttpd
  3. Goahead web server
Web server's that work on an event based architecture like nginx are not affected by a slowloris attack.
It seems that IIS is also is not affected by a slowloris attack(although not tested by us).

How does slowloris http dos attack work?

An in depth understanding of http request and response is very much necessary to comprehend this attack tool.
Because it exploits a vulnerability in the web server(which was purposely made by the authors for different advantages like serving requests for a slow connection ) which wait for a complete header to be received.
Apache & some other web server's have a mechanism of timeout.  An Apache web server will wait for this specified timeout duration for the completion of a request( if the request was incomplete ).
This timeout value is by default 300 seconds, but is modifiable. This timeout value is very much useful if a website serve's large files for download through http(because it maintains an active http connection of a slow client without breaking the download).
Another important fact to note here is that the timeout counter is reset every time the client sends some more data( so the timeout count will start again from 1 ).
But imagine a situation if somebody purposely send partial http requests and reset the timeout counter of each request by sending some bogus data very frequently.
That's exactly what slowloris does. It sends partial http request with bogus header's. Once all connections are consumed by sending partial requests, it keeps on maintaining the connection's by sending request data and reseting the timout counter.
A complete GET request looks like something below.
?
1
2
3
4
5
GET / HTTP/1.0[CRLF]
User-Agent: Wget/1.10.2 (Red Hat modified)[CRLF]
Accept: */*[CRLF]
Host: 192.168.0.103[CRLF]
Connection: Keep-Alive[CRLF][CRLF]

What are those CRLF in that get request?


CRLF stands for CR (Carriage Return) and LF (Line Feed)This character is an entity which is non printable, used to denote end of the line.
Even when you are typing on a text editor the editor puts a CRLF at the end of a line when you want a new line after that.
And two CRLF characters together is used to denote a blank line.
In the above shown GET request there are two CRLF characters at the end of the "Connection"header(which means a blank line)In http protocol, a blank line after the header's is used to represent the completion of the header.
Slowloris tool takes advantage of this in implementing its attack. It does not send a finishing blank line, which indicates the end of the http header.
Some web server's give higher priority to those requests which are complete in its header's. This is the reason why IIS is not affected by a slowloris attack.

An incomplete request send by the slowloris script is shown below. This below snippet is taken from the slowloris script

1
2
3
4
"GET /$rand HTTP/1.1\r\n"
          . "Host: $sendhost\r\n"
          . "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
          . "Content-Length: 42\r\n";

 

In the above snippet shown \r\n is used to denote carriage return and newline in perl. Two consecutive "\r\n\r\n"should be there to denote a blank line, which is not there. So thats an incomplete header in HTTP.

Slowloris perl script http dos attack and its usage


You can find the slowloris script from ha.ckers.org
Copy the script and run it against any of your web server for testing. Most of the apache web server's are vulnerable against this kind of an attack.
The usage of the script is quite simple as shown below.
?
1
[root@localhost ~]# ./slowloris.pl -dns www.example.com

You can also modify the timout interval, if known to you, used by the server with -timeout option
For a complete detailed help with slowloris tool, give the script as an argument to "perldoc"command.
?
1
[root@localhost ~]# perldoc ./slowloris.pl

noteSlowloris is mostly not noticed by IDS(Intrusion Detection system's), because it does not send a malformed request, but a legitimate request to the web server. Hence it bypasses most of the IDS system's out there.

note
slowloris works by the principle of consuming all available http connections on the server. Hence it takes time if its a high traffic web site, and are already connected by a number of clients. Because in that case slowloris needs to wait, for http connections to become available(because other clients are connected to it and are being served)
noteAn important funny thing with slowloris attack is that, as soon as the attacker stops running the script, the website will become back online. Because the connections will automatically be closed by the webserver after some time(after the timeout interval).

 

 

How to prevent/protect/mitigate a slowloris attack?


1. Use Hardware Load Balencers that accepts only full http connections.
Using hardware load balencer's with an http profile configured will be the best method to stop such an attack.
Because the loadbalencer will inspect the packet's and will forward only those http request to the web server which are complete.
If you are using a F5 based BIG-IP Load Balencer i recommend reading the below link for mitigating slowloris attacks.
Other Load balencer's like the below ones also can be configured with http profile to mitigate such an attack
  • Citrix NetScaler
  • Cisco CSS
2. Protect your web server by using IPtables by limiting connections from a particular host
You can certainly limit the number of connections with the help of iptables to port 80. For example if suppose i want to block
?
1
iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 30 -j DROP

3. Configure the timeout directive in apache
Although this is not at all a good solution, you can still increase the rate with which your web server will reap inactive connections.
You can simply modify the timout directive in /etc/httpd/conf/httpd.conf file.
Reducing it to a lower value will atleast make the attack difficult(but still the attack can take down the server, by increasing the number of requests)
This is not at all a good solution.
4.mod_antiloris apache module
Another good solution that i tested is an apache module called as mod_antiloris. This module can be installed using the below steps.
?
1
2
3
4
5
6
7
8
[root@localhost ~]# wget http://sourceforge.net/projects/mod-antiloris/files/mod_antiloris-0.4.tar.bz2/download
[root@localhost ~]# tar -xvjf mod_antiloris-0.4.tar.bz2
mod_antiloris-0.4/
mod_antiloris-0.4/ChangeLog
mod_antiloris-0.4/mod_antiloris.c
[root@localhost ~]# cd mod_antiloris-0.4
[root@localhost mod_antiloris-0.4]# apxs -a -i -c mod_antiloris.c
Now simply restart apache to load the new module.

這個網誌中的熱門文章

正確設置404頁面及其他.505,500....

正確設置404頁面 404頁面的設置是否正確直接關係到網站粘性,而現在很多網站的錯誤頁面返回碼都是200和302,只要蜘蛛爬行錯誤頁面不是404,那麼你的404頁 面設置就是錯誤的了,這裡跟大家介紹如何正確設置404頁面。 怎麼正確設置404頁面?很多人看到這個話題可能覺得下文不屑一顧,其實你是否知道自己的404頁面有沒有設置正確呢?很多開源的cms系統和博客 系統都會帶有404頁面,你是不是覺得這樣已經ok了?不用設置了?這些想法是錯誤的,我們做優化的時候,應該測試404頁面時候生效,設置是否正 確等。下面我們詳細說明怎麼設置404頁面。 這先說一下怎麼樣的404頁面才是有效的404頁面。大家應該都知道搜索引擎是通過http狀態碼來識別網頁狀態的,那麼當蜘蛛檢索到一個錯誤鏈 接時,就需要返回404狀態碼來告訴搜索引擎,這個頁面是錯誤頁面,以後不用索取了。而如果返回200,則告訴搜索引擎這個頁面是正常頁面。 所以我們要查看網站錯誤頁面的返回碼是200還是404,而現在很多網站的404頁面返回碼是200而不是404.    那怎麼正確設置404頁面?

Mac OS X Server 架設兩個網站、兩個郵件伺服器

from:http://www.bnw.com.tw/conference/viewtopic.php?t=208 我的需求要更簡單。  朋友的工作室就兩三人而已,另外一個工作室也是兩三人。  希望有屬於自己的網站及網域名稱郵件  www.123.com   abc@123.com  

Mac mini server(2012 年末和 2011 年中):如何將 OS X Server 安裝到軟體 RAID

重要事項 這些步驟會清除 Mac mini Server 中兩個磁碟機上的所有資料。雖然您可以重新安裝 OS X Server,但是請務必確認這些磁碟機上的任何其他資料都已完成備份,然後再繼續。 您無法在 RAID 卷宗上建立恢復分割區。如果沒有恢復分割區, 將無法支援 OS X 的某些功能 ,因此您應該考慮使用 恢復磁碟輔助程式 建立外接恢復磁碟,然後才建立 RAID 卷宗。 本文所提供的步驟需要使用透過 WiFi 或乙太網路的寬頻 Internet 連線。您的網路連線必須符合 這篇連結文章 的「重新安裝 OS X 的需求」一節中,針對 Internet 回復功能所述的需求。 安裝步驟 按住 Command、Option 和 R 鍵的同時啟動 Mac mini Server,以便啟動進入 Internet 回復模式。這可能要花數分鐘的時間。看到旋轉地球和“正在從網路啟動回復程序”訊息時,放開這些按鍵。