Pentesting Tools

Draugr : Advanced Tools For Synthetic Stack Frame Manipulation

The Draugr toolset provides a robust framework for performing synthetic stack frame manipulation, primarily designed to bypass modern Endpoint Detection and Response (EDR) systems.

It includes two key components: Draugr-Template and Draugr-Strike, which enable developers to implement advanced techniques such as return address spoofing and remote process injection.

Draugr-Template

The Draugr-Template is a Cobalt Strike BOF (Beacon Object File) template that facilitates the creation of synthetic stack frames. This technique is essential for evading detection by EDRs that monitor stack frames during sensitive API calls.

By mimicking legitimate thread start conditions, Draugr-Template ensures that the stack frame appears less suspicious.

Key Features:

  1. Return Address Spoofing: Draugr spoofs the return address of API calls to evade detection.
  2. Synthetic Stack Frames: After the gadget execution, it pushes two frames to mimic a legitimate thread start, enhancing stealth.
  3. Execution Speed: Unlike thread pool techniques, which are slower, Draugr allows API calls to execute quickly while retrieving return values.

To use Draugr-Template, dynamically resolve the function address and call it using the SPOOF_CALL macro:

HMODULE pKernel32 = GetModuleHandleA("Kernel32.dll");
void* pVirtualAlloc = (void*)GetProcAddress(pKernel32, "VirtualAlloc");
void* pAllocatedAddr = SPOOF_CALL(&stackFrame, pVirtualAlloc, NULL, 1024 * 1024, MEM_COMMIT, PAGE_EXECUTE_READWRITE);

Here, SYNTHETIC_STACK_FRAME structures manage the spoofed stack frames.

Developers can modify the code in src/core/Spoof.c to customize gadgets or fake stack frames. For example:

  • Change the module used to locate gadgets.
  • Edit the fake frame functions (BaseThreadInitThunk, RtlUserThreadStart).
  • Update gadget conditions in FindGadget for alternate implementations.

Draugr-Strike

The Draugr-Strike demonstrates how to use Draugr-Template for remote process injection. It includes steps like memory allocation, shellcode injection, memory protection changes, and creating a spoofed thread at a specific offset.

This code is a proof of concept (PoC) and may occasionally fail during injection. It is not intended for production use.

Draugr provides a powerful set of tools for synthetic stack frame manipulation and process injection. While its primary use case is educational and experimental, it highlights advanced evasion techniques against EDR systems.

However, users must exercise caution and adhere to ethical guidelines when employing these tools.

Varshini

Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies.

Recent Posts

How Web Application Firewalls (WAFs) Work

General Working of a Web Application Firewall (WAF) A Web Application Firewall (WAF) acts as…

5 days ago

How to Send POST Requests Using curl in Linux

How to Send POST Requests Using curl in Linux If you work with APIs, servers,…

5 days ago

What Does chmod 777 Mean in Linux

If you are a Linux user, you have probably seen commands like chmod 777 while…

5 days ago

How to Undo and Redo in Vim or Vi

Vim and Vi are among the most powerful text editors in the Linux world. They…

5 days ago

How to Unzip and Extract Files in Linux

Working with compressed files is a common task for any Linux user. Whether you are…

5 days ago

Free Email Lookup Tools and Reverse Email Search Resources

In the digital era, an email address can reveal much more than just a contact…

5 days ago