Windows 2000/XP/2003/Vista Win32k.sys!ImeCanDestroyDefIMEforChild内核拒绝服务漏洞

影响范围:Windows 2000/XP/2003/Vista 全补丁

在Win32k!NtUserDestroyWindow->xxxDestroyWindow时,试图为子窗口销毁IME窗口时,会调用ImeCanDestroyDefIMEforChild这个函数,这个函数会在一个while循环中取得窗口的父窗口,试图确定窗口的子窗口和当前销毁的窗口是否是属于同一个线程的,大概代码如下:

 

if (pwndDestroy->spwndParent == NULL)

return FALSE ;

pwnd = pwndDestroy;

     while (pwnd != NULL && pwnd != GetDesktopWindow(pwnd)) {

         if (IsChildSameThread(pwnd->spwndParent, pwndDestroy))

             return FALSE;

         pwnd = pwnd->spwndParent;

}

 

 

明显看到这个循环是有问题的,IsChildSameThread中不会做任何检查就直接使用第一个窗口对象参数,如果第一个窗口的父窗口不为空,且和要销毁的窗口父窗口不是一个窗口,且要销毁的窗口的父窗口的任何一个父窗口为空,就会因为访问0地址而崩溃

 

在Windows 7中(我看的7100版的WIN32K.SYS),修复了这个问题,代码修改成了:

 

 

pwnd = pwndDestroy->spwndParent;

 

     while (pwnd != NULL && pwnd != GetDesktopWindow(pwnd)) {

         if (IsChildSameThread(pwnd, pwndDestroy))

             return FALSE;

         pwnd = pwnd->spwndParent;

 

来源:

http://hi.baidu.com/mj0011/blog/item/249da3119cd3c072cb80c458.html

发表评论?

0 条评论。

发表评论