Donut is an open-source shellcode-generation and in-memory loading framework for Windows that is used in malicious infection chains to execute subsequent payloads. It supports loading .NET assemblies, native executables and DLLs, VBScript, and JScript directly in memory. For .NET payloads, Donut can use the unmanaged CLR hosting interfaces to initialize the runtime, create an application domain, load an assembly, and invoke its entry point. Its payload encryption and memory-resident execution reduce exposure of recognizable executable structures and limit payload files written to disk. The project also includes a shellcode-injection test component for execution inside a target process.
Attackers commonly embed Donut-generated shellcode within encrypted, multistage loaders implemented using PowerShell, .NET, Go, AutoIt, and other technologies. Observed deployment chains include phishing, spearphishing, and ClickFix social engineering, sometimes combined with DLL side-loading or exploitation of Windows security vulnerabilities. Donut has been used to load malware including Atlantida, Phemedrone, Remus, ValleyRAT, and VenomRAT. Void Banshee used it in a campaign exploiting CVE-2024-38112 to execute Atlantida inside a legitimate Windows process. Donut is a reusable loading component rather than an information stealer or remote-access implant itself; the capabilities and targeting of its final payloads depend on the operator.
13 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
In this attack, Donut is used to decrypt and execute the Atlantida stealer inside RegAsm.exe process memory.
It then uses a Donut shellcode loader to run a .NET payload in memory.
“The obtained shellcode is in fact Donut Loader ... that contains a non-obfuscated pinkman agent binary.”
The IMG disk image contained an executable and malicious DLL that leveraged DLL sideloading to execute Donut Loader and ultimately install PackClient.
The malware stands out for its heavy use of advanced defense evasion methods, including NTDLL unhooking, direct syscalls via the Bouncy Gate technique, ETW patching, and reflective loading using the Donut shellcode.
The loader decrypts an AES-wrapped payload stored on disk. The decrypted payload contains a Donut shellcode loader that embeds the final RAT and uses Chaskey block cipher as part of its payload protection scheme. Donut then decrypts the final 32-bit native RAT, maps it, and executes it in memory.
+7 more in the app. View in Mallory
47 distinct techniques documented for this family, organized by ATT&CK tactic.
"...compromise of legitimate... WordPress websites... to inject a ClickFix implant... The lure is designed to infect visitors with a multi-stage malware chain..."
Victims are lured to spam/malicious websites via Malvertising , Phishing and Compromised / hacked legitimate websites.
Emails delivered ZIP archives containing IMG disk images; mounted images contained an executable and malicious DLL.
The payload uses Donut-generated shellcode and encrypted PowerShell scripts hidden behind image-like extensions to evade detection and conceal malicious content.
The VBScript initiates the PowerShell process and retrieves the next stage PowerShell script. The PowerShell script downloads the next stage payload from the attackers C2 server.
APT-C-36 has embedded a VBScript within a malicious Word document which is executed upon the document opening.
Executes: python pun.py -i <payload>.bin -k <key>.txt (x5)
AppleSeed has the ability to use JavaScript to execute PowerShell. APT32 has used JavaScript for drive-by downloads and C2 communications. Astaroth uses JavaScript to perform its core functionalities.
The downloaded installer is pre-bundled with AutoIt3.exe, which drops and loads an .au3 script from the same folder location.
apc_run_payload – the APC callback that eventually executes the decrypted shellcode... The APC callback is responsible for executing the decrypted payload in memory.
Donut ... is a public position-independent code generator and in-memory loader... the Donut-derived code reconstructs the native PE, resolves imports, applies relocations... without requiring the final PE to be created as a normal file on disk.
“When victims double-click on the VHD file… Following the shortcut causes hagrala.hta to be executed”
The infection begins when the victim follows the Fake Captcha which leads them to execute malicious VBScript and PowerShell scripts.
side-loading Callback function hijacking
After patching, Donut loads mscoree.dll , calls CLRCreateInstance to start the .NET CLR (v4.0.30319), and invokes ExecuteInDefaultAppDomain with the target class and method names stored in the instance.
The second-stage payload spawns the DllHost.exe process
The malware uses the CreateProcess Windows API to launch RegAsm.exe in a suspended state.
MITRE ATT&CK Mapping Tactic Technique ID Application Execution Reflective Code Loading T1620 Donut decrypts + loads PE in-memory Defense Evasion Obfuscated Files: Embedded Payloads T1027.009 Chaskey-16 CTR encrypted Donut payloads Defense Evasion Masquerading: Legitimate Name T1036.005 Process named nsvchost.exe Defense Evasion Subvert Trust Controls T1553 Inline C# avoids pre-compiled AV detection Privilege Escalation Token Manipulation T1134.001 SeDebugPrivilege via AdjustTokenPrivileges Discovery Process Discovery T1057 CreateToolhelp32Snapshot for svchost.exe Lateral Movement Process Injection: DLL Injection T1055.001 VirtualAllocEx + WriteProcessMemory into svchost.exe
The extracted shellcode is injected into the same AutoIt process.
VirtualAllocEx -- allocates memory in explorer.exe ... WriteProcessMemory ... VirtualProtectEx ... NtCreateThreadEx -- creates a remote thread to begin execution
The ne.py Python script is used for Polymorphic Asynchronous Procedure Call (APC) Injection... defaults to injecting into the explorer.exe process if no parameter is provided.
The second-stage payload spawns the DllHost.exe process
The embedded JavaScript loader is using an indexed string table to dynamically resolve property names.
"The Python script hands off to shellcode generated by Thewover's Donut ... a tool that wraps arbitrary executables or .NET assemblies into position-independent x86-64 shellcode."
The actor in this incident compiled the cryptominer directly on the endpoint... Silent XMR Miner Builder.exe ... executed several .NET Framework utilities and an array of C compilers.
The function scans for byte sequences and string signatures characteristic of Donut shellcode, then obfuscates them with a mask composed of 144, 204, and randomly generated uppercase characters to evade detection.
DLLの.rsrcセクションには175個のRCDATAリソースが格納され、シェルコードの断片と大量のダミーデータが含まれる。
Obfuscated Files: Encrypted Payload T1027.013 Multi-layer XOR + Chaskey CTR + AES
The dropper then retrieved what appeared to be a standard web font file with a .woff extension, the kind websites routinely use to load custom typefaces. Inside that file was Donut shellcode
The next stage involved retrieving Donut shellcode through a masqueraded .woff resource... By placing malicious content behind a font-looking path or extension, the attacker makes the payload request appear like a routine static web asset.
The malware uses the CreateProcess Windows API to launch RegAsm.exe in a suspended state.
MITRE ATT&CK Mapping Tactic Technique ID Application Execution Reflective Code Loading T1620 Donut decrypts + loads PE in-memory Defense Evasion Obfuscated Files: Embedded Payloads T1027.009 Chaskey-16 CTR encrypted Donut payloads Defense Evasion Masquerading: Legitimate Name T1036.005 Process named nsvchost.exe Defense Evasion Subvert Trust Controls T1553 Inline C# avoids pre-compiled AV detection Privilege Escalation Token Manipulation T1134.001 SeDebugPrivilege via AdjustTokenPrivileges Discovery Process Discovery T1057 CreateToolhelp32Snapshot for svchost.exe Lateral Movement Process Injection: DLL Injection T1055.001 VirtualAllocEx + WriteProcessMemory into svchost.exe
The extracted shellcode is injected into the same AutoIt process.
VirtualAllocEx -- allocates memory in explorer.exe ... WriteProcessMemory ... VirtualProtectEx ... NtCreateThreadEx -- creates a remote thread to begin execution
The ne.py Python script is used for Polymorphic Asynchronous Procedure Call (APC) Injection... defaults to injecting into the explorer.exe process if no parameter is provided.
The malware patches this function by overwriting the first byte with the opcode 0xC3 (a RET instruction). This simple patch effectively disables ETW telemetry, preventing security tools from receiving critical events and creating a significant blind spot for defenders and incident responders.
“La stringa Base64 viene decodificata a runtime dal .ps1.”
Ironically, the actors used a malware protection product to execute the EDR killer to create an execution chain that would appear to be “safe” to other malware protection tools... leveraging kaba.exe, a renamed version of a legitimate Kaspersky executable
the user is immediately presented with a fake CAPTCHA verification instructions. The instructions trick the user into performing a specific sequence of clicks that ultimately spawn the MSHTA process and executes a malicious script.
Atlantida abuses RegAsm.exe to proxy malicious code execution
They also used anti-analysis methods, which suggests a “codebase continuity rather than a short-lived ‘smash-and-grab’ campaign.”
The payload actively scans the infected machine for various indicators that could reveal the presence of a debugging tools, or sandboxed environment(Ex: machine configurations, graphics/display adapters etc).
side-loading Callback function hijacking
After patching, Donut loads mscoree.dll , calls CLRCreateInstance to start the .NET CLR (v4.0.30319), and invokes ExecuteInDefaultAppDomain with the target class and method names stored in the instance.
The script calls CreateThread() and supplies the address returned by VirtualAlloc() as the thread start address.
The script calls IsDebuggerPresent and exits silently if a debugger is detected.
To evade detection and reduce security visibility, the malware employs process injection, dynamic Application Programming Interface (API) resolution, Antimalware Scan Interface (AMSI) bypass, Event Tracing for Windows (ETW) tampering, and memory-resident execution techniques.
AmsiScanBuffer is bypassed with hardware breakpoints and later patched process-wide.
This is a purpose-built Chromium browser credential stealer... The third stage queries each profile’s Login Data SQLite database... decrypts each password value with the recovered AES key, and writes results to per-browser CSV files.
The stealer embeds a complete SQLite database engine... targets browser user data directories... queries each profile’s Login Data database... decrypts each password value with the recovered AES key.
It then actively searches for the following debugging tools/ Virtual machine processes by enumerating running processes and matching names/hashes.
They also used anti-analysis methods, which suggests a “codebase continuity rather than a short-lived ‘smash-and-grab’ campaign.”
The payload actively scans the infected machine for various indicators that could reveal the presence of a debugging tools, or sandboxed environment(Ex: machine configurations, graphics/display adapters etc).
The script calls IsDebuggerPresent and exits silently if a debugger is detected.
The system profile is sent as a JSON payload via HTTP POST to /api/daemon... Command output is captured and POST-ed back to /api/result, completing the C2 loop.
The content repeatedly describes threat actors, malware, and campaigns using HTTP and/or HTTPS for command and control, including examples such as BlackEnergy communicating with C2 over HTTP POST requests and many other families using HTTP/S for C2.
"...multi-stage malware chain..."; "...Donut loader is used twice in sequence..."
The PowerShell script downloads the next stage payload from the attackers C2 server. The next stage payload – an executable is dropped to the machine.
81 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
117 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.