Windows Metafile AttemptWrite Heap Overflow

本文分析了一个在 Windows 图形设备接口 (GDI) 中发现的堆溢出漏洞,该漏洞允许攻击者通过恶意元文件执行任意代码。漏洞源于 GDI32 函数 AttemptWrite 的整数溢出问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Release Date:
August 14, 2007

Date Reported:
March 27, 2007

Severity:
High (Code Execution)

Systems Affected:
Windows 2000 SP4
Windows XP SP2
Windows Server 2003 SP1

Overview:
eEye Digital Security has discovered a heap overflow vulnerability in
the way the Windows Graphical Device Interface (GDI) processes Windows
metafiles.  If an application attempts to display a malicious metafile
in a particular way, a heap overflow will occur and result in the
execution of arbitrary code, with the privileges of the user who ran the
application.

Technical Details:
The GDI32 function AttemptWrite is susceptible to a heap overflow
vulnerability caused by an integer overflow, as depicted in the
disassembly below.  The AttemptWrite function is called by multiple
GDI32 API functions, most notably CreateMetaFileW.

    77F4B519  mov  esi, [ebp+0Ch]  ; reported size of record in bytes
     ...                           ;   (user-controlled)
    77F4B548  mov  eax, [ebx+0Ch]  ; amount of buffer used in bytes
                                   ;   (user-controlled)
    77F4B548  lea  ecx, [eax+esi]  ; *** integer overflow ***
    77F4B54E  cmp  ecx, [ebx+08h]  ; buffer capacity
    77F4B551  ja   _no_memcpy
     ...
    77F4B56D  mov  edi, [ebx]      ; pointer to start of buffer
    77F4B56F  mov  ecx, esi
    77F4B574  add  edi, eax        ; now EDI points to unused buffer
space
     ...
    77F4B5BA  mov  eax, ecx
    77F4B5BC  shr  ecx, 2
    77F4B5BF  rep movsd            ; *** complete heap overwrite ***

By constructing a metafile containing an extremely large record length,
a complete heap overwrite may occur, due to the intrinsic memcpy
attempting to copy roughly 4GB of arbitrary data into a heap block.
Because of the size of the copy, an access violation is inevitable, but
in programs (such as Microsoft Office applications) that attempt to
handle the exception, successful exploitation has been demonstrated.

Protection:
Retina Network Security Scanner has been updated to identify this
vulnerability.
Blink Endpoint Vulnerability Prevention preemptively protects from this
vulnerability.

Vendor Status:
Microsoft has released a patch for this vulnerability.  The patch is
available at:
http://www.microsoft.com/technet/security/bulletin/MS07-046.mspx

Credit:
Yuji Ukai

Related Links:
Retina - Network Security Scanner - Free Trial:
http://www.eeye.com/html/products/retina/download/index.html
Blink - Unified Client Security Personal - Free For Home Use:
http://www.eeye.com/html/products/blink/personal/download/index.html
Blink - Unified Client Security Professional - Free Trial:
http://www.eeye.com/html/products/blink/download/index.html
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值