Ninja UUID Dropper

Module Stomping, No New Thread, HellsGate syscaller, UUID Dropper for x64 Windows 10!

Project README

Ninja UUID Dropper

Module Stomping, No New Thread, HellsGate syscaller, UUID Dropper for x64 Windows 10!

Created by Bobby Cooke (@0xBoku) with Matt Kingstone(@n00bRage)


Shellcode is typically loaded into the Heap of the process, or the VirtualAlloc() API is used to reserve a private section of memory where the shellcode is then loaded too. Regardless of where the shellcode is in memory, that allocated memory must be marked executable for the shellcode to run. This is typically done by calling the VirtualProtect() API, after the shellcode has been written to memory, to change the allocated memory from RW (Read-Write) to RX (Read-Execute). RX sections within modules are common, such as the executable .TEXT section of the host process, and the executable .TEXT section of a Dynamically Loaded Library (DLL) which has been loaded into the memory of the process. Although, RX or RWX executable memory sections within the Heap and Privately allocated sections, not backed by a module are suspicious, and easier to detect. To evade this detection, Module Stomping can be used.

Module Stomping is where the malware will load a DLL into the processes memory using the LoadLibrary() API, change the permissions of the loaded libraries memory to RW (writable), overwrite the DLL memory with the shellcode, change the module-backed memory back to RX (executable), and then execute the shellcode from the DLL memory. When the memory is scanned, the shellcode will appear to be just the executable code from the loaded DLL. Therefor this may evade some AV/EDR dynamic memory scanners.

Sektor7 does a better job of explaining it, and I recommend you check out there courses if you'd like to dive deeper:

This dropper uses the Module Stomping technique described above, in combination with these techniques:

  • UUID Obfuscation of the shellcode payload.
    • The UUID payload helps to decrease the shellcodes entropy, which can help evade some detection methods.
    • This method also helps prevent some in-memory detections which flag on signatures.
  • Crawl the in-memory list of loaded modules to discover the base addresses of ntdll.dll and kernel32.dll.
  • Resolve NTAPI & WINAPI APIs by using a custom implementation of GetProcAddress() written in Assembly.
  • HellGate technique to resolve the Windows System Calls dynamically by reading the memory of ntdll.dll.
  • HalosGate technique to resolve the Windows System Calls if ntdll.dll is hooked by AV/EDR.
  • Direct Syscalls to changes the memory protection of the DLL which will host the shellcode.
  • "No New Thread" technique which uses EnumSystemLocalesA() to execute the UUID decoded shellcode.

Walkthrough Example with MSF PopCalc

  • First you will need a raw binary file that contains your shellcode.
  • For this example we will use MetaSploit's MSFVenom to create a simple "Pop Calc" shellcode for x64 Windows 10.
    • This shellcode was created from a Kali Linux virtual machine.

MSFVenom PopCalc Shellcode Creation

┌──([email protected])-[~]
└─$ msfvenom -p windows/x64/exec CMD=calc.exe -f raw -o calc.bin
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 276 bytes
Saved as: calc.bin

Raw Shellcode File to UUIDs

  • Now that we have our raw shellcode file calc.bin we will use the python3 script to convert our shellcode into an array of UUIDs.
  • For large shellcodes, I recommend piping the output from the python script to a file. Then transfer the file over to your windows workstation where you will be compiling the dropper with windows Visual Studios.
┌──([email protected])-[~]
└─$ python3 calc.bin
    const char* uuids[] =

Copy UUID Shellcode to main.c

  • Copy the array of UUIDs to your windows workstation either via the copy-paste buffer or a file.
  • Open this project in Microsoft Visual Studios.
  • Within the main.c file, replace the uuids[] array with your array of UUIDs.

Optionally Change Sacraficial DLL

  • You may optionally change the sacraficial DLL that has its RX section module stomped by our shellcode by changing the sLib[] array to a name of a different DLL.
  • Make sure that the DLL is large enough to hold your shellcode or else you may end up overwriting a neighbor DLL in memory of the process.
  • Use the python script to convert the DLL name into an array of chars.
  • Alternatively just use a typical string method since we are not creating a Beacon Object File (BOF) or shellcode.
┌──([email protected])-[~]
└─$ python3 sLib mshtml.dll
CHAR sLib[] = {'m','s','h','t','m','l','.','d','l','l',0};
  • Replace the CHAR sLib[] array in main.c with the newly generated one.

Compile with Visual Studios

  • Once you have made your changes, compile the EXE with Visual Studios
  • If you are using the example provided, a calculator should popup when you press the green play button within Visual Studios.

Credits / References

Implementing ASM in Visual Studio C Projects

HalosGate SysCaller

HellsGate Syscaller

Great Resource for learning Intel ASM - Vivek Ramachandran (@vivekramac)

Other Projects/References that use the UUID Shellcode Loading Technique

Open Source Agenda is not affiliated with "Ninja UUID Dropper" Project. README Source: boku7/Ninja_UUID_Dropper
Open Issues
Last Commit
2 weeks ago