Donut
- Type
- Loader
- Capabilities
- Defense evasionProcess injection
- Delivery
- PhishingSpearphishingClickfixCracked software
- Platforms
- Windows
Donut is an open-source shellcode-generation and in-memory loading framework used to execute native Windows executables, DLLs, and .NET assemblies. Although not inherently malicious, it is widely incorporated into multistage malware delivery chains to unpack and execute payloads while reducing disk artifacts. Donut shellcode can decrypt and decompress embedded payloads, manually map native PE modules into memory, and invoke their entry points or selected exports. Observed implementations use Chaskey-CTR encryption and aPLib compression. Configurable evasion features include AMSI and ETW bypass attempts and PE-header overwriting. The project also includes a component for injecting shellcode into another process.
Donut-based execution has delivered information stealers, remote-access trojans, downloaders, and modular backdoors, including Atlantida, ValleyRAT, SafeRat, and Olympic. Void Banshee used Donut in its exploitation of CVE-2024-38112 to execute Atlantida within a legitimate Windows process. Other campaigns reach Donut through phishing, ClickFix prompts, malicious archives, fraudulent software activators, script interpreters, and DLL sideloading. Donut is an execution component rather than the source of its downstream payloads' credential theft, surveillance, persistence, or command-and-control functionality, and its use does not independently establish threat-actor attribution.
Associated threat actors
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
Techniques & procedures
47 distinct techniques documented for this family, organized by ATT&CK tactic.
Initial Access
3 techniques
Initial Access
"...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.
Execution
12 techniques
Execution
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.
Persistence
1 technique
Persistence
The second-stage payload spawns the DllHost.exe process
Privilege Escalation
6 techniques
Privilege Escalation
Encrypted shellcode in manifest.json is injected into a signed windows.storage.dll whose extra .text section preserves the digital signature on disk while contents are replaced in memory, and the chain runs through Donut and an obfuscated PE loader with GhostedHollowing.
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
Stealth
24 techniques
Stealth
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.
Encrypted shellcode in manifest.json is injected into a signed windows.storage.dll whose extra .text section preserves the digital signature on disk while contents are replaced in memory, and the chain runs through Donut and an obfuscated PE loader with GhostedHollowing.
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.
Defense Impairment
2 techniques
Defense Impairment
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.
Credential Access
2 techniques
Credential Access
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.
Discovery
4 techniques
Discovery
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.
Command and Control
4 techniques
Command and Control
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.
Observables
91 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
131 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.