网络安全 频道

让IE稍微安全一点,再安全一点

IE的0day满天飞,不过IE的粉丝还是不少地

在舒服地浏览网页的同时,不要忘了合理地规避风险

由于 很多IE的漏洞都会向system32目录下写入文件,都会去终止防火墙,AV。。而所有这些都需要有Administrator权限
基于这点,Michael Howard写了一个降低IE权限的小工具 DropMyRights

原理就是删除用户当前token的一些权限和SID,用处理过的token,去创建新进程,IE,OE,Firefox,FOXMAIL。。。

安装过程:

1.下载 DropMyRights.msi
http://download.microsoft.com/download/f/2/e/f2e49491-efde-4bca-9057-adc89c476ed4/DropMyRights.msi

2.安装之后,把DropMyRights.exe copy到一个"安全的"目录 (设置好acl,不然又会有新的隐患 )

3.创建一个快捷方式,路经的格式类似下面这样:
C:\safeDIR\dropmyrights.exe "c:\program files\internet explorer\iexplore.exe"

4.快捷方式的名字默认是dropmyrights.exe ,最好改一下,搞个IE safe ,IE (non-admin)之类的,以示区别

5.在属性里改个看着舒服点的图标,最好就用IE的

ok了,以后你上网的时候就打开这个快捷方式,去调用ie,不要直接去点原来的IE

不过还有个小问题,一些地方直接调用ie(如MSN)去打开网页的话还是会直接调用原来的iexplore.exe

//当然这个工具实现起来也很简单,下面坐着提供的核心代码
//////////////////////////////////////////////////////////////////////////////////
DWORD wmain(int argc, wchar_t **argv) {

   DWORD fStatus = ERROR_SUCCESS;

   if (2 != argc && 3 != argc) {
      Usage();
      return ERROR_INVALID_PARAMETER;
   }

   // get the SAFER level
   DWORD hSaferLevel = SAFER_LEVELID_NORMALUSER;
   if (3 == argc && argv[2]) {
      switch(argv[2][0]) {
         case 'C' :
         case 'c' :  hSaferLevel = SAFER_LEVELID_CONSTRAINED;
                  break;
         case 'U' :
         case 'u' :   hSaferLevel = SAFER_LEVELID_UNTRUSTED;
                  break;

         default  :   hSaferLevel = SAFER_LEVELID_NORMALUSER;
                  break;
      }
   }

   // get the command line, and make sure it's not bogus
   wchar_t *wszPath = argv[1];
   size_t cchLen = 0;
   if (FAILED(StringCchLength(wszPath,MAX_PATH,&cchLen)))
      return ERROR_INVALID_PARAMETER;

    SAFER_LEVEL_HANDLE hAuthzLevel = NULL;
    if (SaferCreateLevel(SAFER_SCOPEID_USER,
                         hSaferLevel,
                         0,
             &hAuthzLevel, NULL)) {

        //  Generate the restricted token we will use.
        HANDLE hToken = NULL;
        if (SaferComputeTokenFromLevel(
            hAuthzLevel,    // SAFER Level handle
            NULL,           // NULL is current thread token.
            &hToken,        // Target token
            0,              // No flags
            NULL)) {        // Reserved

         STARTUPINFO si;
         ZeroMemory(&si, sizeof(STARTUPINFO));
         si.cb = sizeof(STARTUPINFO);
         si.lpDesktop = NULL;
       
         // Spin up the new process
         PROCESS_INFORMATION pi;
         if (CreateProcessAsUser(
            hToken,
            wszPath, NULL,
            NULL, NULL,
            FALSE, CREATE_NEW_CONSOLE,
            NULL, NULL,  
            &si, &pi)) {

               CloseHandle(pi.hProcess);
               CloseHandle(pi.hThread);

         } else {
            fStatus = GetLastError();
            fwprintf(stderr,L"CreateProcessAsUser failed (%lu)\n",fStatus);
         }
      } else {
         fStatus = GetLastError();
      }

      SaferCloseLevel(hAuthzLevel);

   } else {
      fStatus = GetLastError();
   }

   return fStatus;
}



更详细的细节大家可以参考MSDN上坐着的原文
<<Browsing the Web and Reading E-mail Safely as an Administrator>>

Michael Howard
Microsoft Security Engineering

November 15, 2004

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncode/html/secure11152004.asp


ps:"c:\program files\internet explorer\iexplore.exe"
记得在快捷方式里iexplore.exe的路径加上引号
0
相关文章