What is fileless malware and how does it work?
Fileless malware is malicious code that doesn't install a new program file: it borrows tools Windows already trusts, like PowerShell, and runs its code in memory.

Fileless malware
Fileless malware is malicious code that doesn’t install a new program file. Instead, it borrows tools Windows already trusts, like PowerShell, and runs its code in memory. Microsoft says there is no single definition, and many fileless threats still use files indirectly. The idea isn’t new. In July 2019, Microsoft documented an Astaroth campaign that ran only system tools, like WMIC, BITSAdmin, Certutil and Regsvr32.
Today, a common way in is a trick known as ClickFix. MITRE tracks it as technique T1204.004, Malicious Copy and Paste. The attacker doesn’t need you to download anything. A fake “I’m not a robot” check gets you to paste and run the command yourself. Windows still has two safety nets for this: AMSI (Antimalware Scan Interface) and PowerShell Script Block Logging.
What fileless malware actually does
The fake CAPTCHA button copies a command to your clipboard with navigator.clipboard.writeText. Then the page tells you to press Windows plus R, Ctrl plus V, Enter. That opens the Run dialog, pastes the command and starts powershell.exe. A common pattern is powershell -w hidden -c, where -w is short for -WindowStyle and -c is short for -Command. The command downloads a script with irm (Invoke-RestMethod) and runs it in memory with iex (Invoke-Expression).
The final payload, often Lumma Stealer, loads into memory. It has been seen injected into trusted processes like msbuild.exe, regasm.exe or powershell.exe. To survive reboots, it can plant a trigger in WMI (Windows Management Instrumentation). A filter (__EventFilter) says when, a consumer such as CommandLineEventConsumer says what, and a binding (__FilterToConsumerBinding) links them. Triggers include logon, a set time or uptime. The WMI process WmiPrvSe.exe runs the action, possibly as SYSTEM.
How Windows still catches it
- The script is decoded first. Right before a script runs, PowerShell undoes the obfuscation. The scan sees the real text, not scrambled Base64.
- AMSI passes it on. PowerShell hands the decoded text to AMSI. AMSI is an interface, not a scanner, so it passes the text to your registered antivirus, such as Microsoft Defender.
- The antivirus gives a verdict. The antimalware engine returns its verdict before the script runs. That’s the moment a bad script can be stopped.
- Script Block Logging records it. When enabled by policy, it writes event 4104 to the Microsoft-Windows-PowerShell/Operational log. It records the pasted command and, separately, the script run with
iex.
The result: even with no new program file, the attack passes checkpoints that can see it and write it down.
Fileless is not invisible
The myth says fileless means invisible. That’s wrong. It means no new program file, not zero traces. Microsoft put it plainly in 2019: being fileless doesn’t mean being invisible, and it certainly doesn’t mean being undetectable. Scripts pass through AMSI, PowerShell can log them as event 4104, and WMI persistence leaves artifacts in places like the WMI repository and Registry hives.
What to do
- If a page asks you to press keyboard shortcuts to prove you’re human, close the tab. A real CAPTCHA only asks for clicks or image picks.
- Never paste a command a website gave you into the Windows Run dialog.
- Keep your antivirus turned on, so AMSI has an engine to pass scripts to.
- At work, ask IT to enable PowerShell Script Block Logging by policy, so event 4104 records commands and scripts.
Watch it in 60 seconds
