BUGTRAQ ID: 25302
CVE(CAN) ID: CVE-2007-3034
Microsoft Windows是微软发布的非常流行的操作系统。
Windows的图形设备接口(GDI)的GDI32函数AttemptWrite处理Windows元文件时可能会出现整数溢出,远程攻击者可能利用此漏洞提升自己的权限。
如下反汇编所示,很多GDI32 API函数都会调用AttemptWrite,如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***
如果创建了包含有超大记录长度的元文件就会触发堆溢出,因为memcpy试图将大约4GB的任意数据拷贝到堆块。这个拷贝大小会导致访问破坏,但在可以处理这种异常的程序中会导致执行任意指令。
Microsoft已经为此发布了一个安全公告(MS07-046)以及相应补丁:
MS07-046:Vulnerability in GDI Could Allow Remote Code Execution (938829)
链接:<a href=“http://www.microsoft.com/technet/security/Bulletin/MS07-046.mspx?pf=true” target=“_blank”>http://www.microsoft.com/technet/security/Bulletin/MS07-046.mspx?pf=true</a>