Attackers use Donut to turn a .NET assembly or other executable code into shellcode that can be run in memory. That helps bypass file-based controls, deliver payloads through scripting or exploitation, and reduce obvious artefacts on disk. Defenders should watch for memory injection, unusual script activity, and processes loading code that does not match normal software behaviour.
How Donut turns managed code into in-memory payloads
Donut is used to convert a .NET assembly or other executable into shellcode that can be loaded and run from memory. That changes the delivery problem from “drop a file and execute it” to “inject or stage code directly,” which can reduce disk artefacts and make file-based scanning less effective.
That in-memory form is why attackers pair Donut with script hosts, exploit chains, loaders, or post-exploitation tooling. The underlying goal is usually not the converter itself, but the ability to move a payload into a process where execution looks closer to normal runtime behaviour than to a standalone executable being launched from disk.
Why attackers like Donut for delivery and evasion
Donut is attractive when an attacker wants a payload that is easier to embed, harder to inspect on disk, or more flexible to hand off between stages. A shellcode form can be embedded in scripts, memory loaders, or exploitation workflows, so the payload can be delivered without the obvious file-centric artefacts defenders often look for.
That does not make the activity invisible. It shifts what defenders should watch: memory allocation patterns, suspicious script launch behaviour, unusual child processes, and code-loading activity that does not fit the host’s normal software profile. The useful question is not only “is there a file?”, but “what is causing code to appear in memory and execute there?”
For a broader view of how attackers package and stage payloads, Malware Guide is a useful reference point for loaders, fileless behaviour, and evasion patterns. When the focus is on real intrusion paths rather than theory, The State of NHI & AI Agent Breach Report 2026 is a relevant navigation aid for compromise patterns that include stolen access material and payload delivery paths.
What defenders should investigate when Donut-like activity appears
Because Donut is a delivery and execution technique, investigation should centre on process behaviour rather than only on the originating file. Look for script engines, LOLBin-style execution chains, suspicious parent-child process relationships, memory region changes, and unsigned or unexpected code being loaded into trusted processes.
It is also worth checking whether the payload was used to establish persistence, launch a secondary stage, or bridge into credential theft or lateral movement. In practice, the loader is often the first observable step in a larger intrusion path, not the end state.
When you want threat context beyond generic malware discussion, CISA advisories can help anchor observed behaviour to active attacker tradecraft, and the MITRE ATT&CK Enterprise Matrix is useful for mapping memory injection, process abuse, and credential-access follow-on activity. The CISA cyber threat advisories feed is also useful when the question is whether a technique is part of a broader active campaign rather than an isolated event.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1055 — Process Injection | Donut's in-memory execution and injection patterns map directly to process injection tradecraft. |
| T1204 — User Execution | Donut is often delivered through scripts or execution chains that rely on user or tool-driven launch. | |
| Recommendation — Correlate memory injection with parent-child process lineage and hunt for unauthorized code execution. Inspect suspicious script-launch paths and restrict execution chains that launch untrusted payloads. | ||
| NIST SP 800-53 Rev 5 | SI-4 — System Monitoring | In-memory payloads require monitoring of process behaviour, memory changes, and suspicious execution. |
| AU-6 — Audit Review, Analysis, and Reporting | Investigating Donut use depends on reviewing correlated logs across script, process, and memory events. | |
| Recommendation — Monitor process and memory activity for anomalous code loading and execution. Correlate host and process telemetry to identify nonstandard code execution chains. | ||
| CIS Controls v8 | CIS-8 — Audit Log Management | Detection of in-memory payloads depends on sufficient logging of execution, script, and process behaviour. |
| CIS-10 — Malware Defenses | Donut is a malware delivery and execution technique that malware defenses must detect and block. | |
| Recommendation — Centralise execution and script telemetry so suspicious in-memory activity can be reviewed quickly. Tune malware defenses to flag loaders, shellcode staging, and suspicious memory execution. | ||
Practitioner Guidance
What to verify: Confirm whether the suspicious activity is just a staged in-memory loader or part of a wider compromise. The key distinction is whether the host merely executed unusual code, or whether that code also reached into sensitive credentials, remote services, or persistence mechanisms.
Decision rule: If the suspicious chain includes script execution, memory injection, and a process that should not normally host custom code, treat it as a high-priority investigation even if no file was written to disk. If the payload executed in a trusted process, prioritise containment and memory-focused triage before relying on disk artefacts.
What practitioners underestimate: Donut-style tradecraft often succeeds because teams overfit detection to files, hashes, and quarantine events. A practical response plan needs visibility into process lineage, memory activity, and the behaviour of loaders, not just the presence or absence of a dropped executable.
Practitioner takeaway: The main defensive shift is from file-centric detection to execution-centric detection, because the attacker’s advantage comes from getting code running in memory under a process that looks ordinary enough to avoid casual scrutiny.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org