Microsoft Excel 2002内存破坏漏洞

漏洞起因
异常条件处理失败错误
危险等级

 
影响系统
Microsoft Excel 2002 SP3
+ Microsoft Office XP SP3
 
不受影响系统
 
危害
远程攻击者可以利用漏洞使应用程序崩溃。
 
攻击所需条件
攻击者必须构建恶意excel文件,诱使用户解析。
 
漏洞信息
Microsoft Excel是一款微软开发的电子表格处理程序。
HFPicture记录由综合加密的图片内容组成,可能是MSODRAWING或MSODRAWINGGROUP记录。
sub_305933A8函数负责解析此记录,rgb字段用于加密。在处理rgb过程中其中一个函数是mso.dll模块中的sub_30E2C12E,在函数中,rgb字段的4字节读取并传递给Ordinal578 ( 30B1C646 )函数:
.text:30E2AF61                 mov     eax, [ebp+var_14]
.text:30E2AF64                 cmp     eax, 1
.text:30E2AF67                 jbe     loc_30F089A7
.text:30E2AF6D
.text:30E2AF6D loc_30E2AF6D:                           ; CODE XREF: sub_30E2C12E+DC87Cj
.text:30E2AF6D                 push    0FFFFFFFFh
.text:30E2AF6F                 push    eax
.text:30E2AF70                 lea     eax, [edi+0F0h]
.text:30E2AF76                 push    eax
.text:30E2AF77                 call    Ordinal578
sub_30B1C646函数没有正确检查参数,并且参数可由用户控制。漏洞的触发是因为它考虑此值为无符号类型,并与有符数值进行对比:
.text:30B1C651                 mov     esi, [ebp+arg_4]
.text:30B1C654                 movzx   eax, word ptr [ebx+2]
.text:30B1C658                 cmp     eax, esi
.text:30B1C65A                 push    edi
.text:30B1C65B                 jl      loc_30B2468E
.text:30B1C661                 cmp     [ebp+arg_8], 0
.text:30B1C665                 jge     loc_30D3DAA2
.text:30B1C66B                 movzx   edi, word ptr [ebx]
.text:30B1C66E                 cmp     esi, edi
.text:30B1C670                 jle     short loc_30B1C698

.text:30B1C698                 push    1
.text:30B1C69A                 mov     [ebx], si
.text:30B1C69D                 pop     eax
.text:30B1C69E
.text:30B1C69E loc_30B1C69E:                           ; CODE XREF: Ordinal578+3BCC40j
.text:30B1C69E                 pop     edi
.text:30B1C69F                 pop     esi
.text:30B1C6A0                 pop     ebx
.text:30B1C6A1                 leave
.text:30B1C6A2                 retn    0Ch
接下来如果此函数返回1,程序就会循环读取excel值并拷贝到堆块中,但是问题是循环的值由用户可控制的负值初始化(或很大的一个正值)。
.text:30E2AE05                 mov     ecx, [esi+2Ch]
.text:30E2AE08                 push    8
.text:30E2AE0A                 lea     edx, [ebp+var_8]
.text:30E2AE0D                 call    sub_30E2CA0C
.text:30E2AE12                 test    eax, eax
.text:30E2AE14                 jz      loc_30F08A1E
.text:30E2AE1A                 mov     eax, [esi+30h]
.text:30E2AE1D                 add     dword ptr [eax], 8
.text:30E2AE20                 test    byte ptr [esi+1], 2
.text:30E2AE24                 jnz     short loc_30E2AE6F
.text:30E2AE26                 mov     eax, [edi+0FCh]
.text:30E2AE2C                 and     dword ptr [eax+ebx*8+4], 0          crash
.text:30E2AE31                 mov     ecx, [ebp+var_8]
.text:30E2AE34                 lea     eax, [eax+ebx*8]
.text:30E2AE37                 mov     [eax], ecx
.text:30E2AE39                 mov     ecx, 40000000h
.text:30E2AE3E                 mov     [eax+4], ecx
.text:30E2AE41                 mov     edx, [ebp+var_4]
.text:30E2AE44                 and     edx, 7FFFh
.text:30E2AE4A                 xor     edx, ecx
.text:30E2AE4C                 test    byte ptr [edi+0ADh], 1
.text:30E2AE53                 mov     [eax+4], edx
.text:30E2AE56                 jz      short loc_30E2AE6F
.text:30E2AE58                 mov     ecx, [edi+0B8h]
.text:30E2AE5E                 lea     eax, [edi+0B8h]
.text:30E2AE64                 cmp     [ebp+var_8], ecx
.text:30E2AE67                 ja      loc_30D09D12
.text:30E2AE6D
.text:30E2AE6D loc_30E2AE6D:                           ; CODE XREF: sub_30E2C12E-122419j
.text:30E2AE6D                 mov     [eax], ecx
.text:30E2AE6F
.text:30E2AE6F loc_30E2AE6F:                           ; CODE XREF: sub_30E2C12E-130Aj
.text:30E2AE6F                                         ; sub_30E2C12E-12D8j
.text:30E2AE6F                 inc     ebx
.text:30E2AE70                 cmp     ebx, [ebp+var_14]
.text:30E2AE73                 jb      short loc_30E2AE05
 
测试方法
http://www.exploit-db.com/exploits/15088
 
厂商解决方案
目前没有详细解决方案提供:
http://www.microsoft.com/
 
漏洞提供者
Abysssec

发表评论?

0 条评论。

发表评论