What Is Fileless Malware and How to Detect It Effectively

Fileless malware runs mainly in memory and abuses trusted tools already on a system, such as PowerShell, WMI and signed Windows binaries, instead of dropping a traditional executable. That makes file-scanning antivirus less effective.

May 19, 2025 - 14:15
Updated: 
102k

Cyber Threats, Scams & Online Safety in Cybersecurity & Ethical Hacking · Tutorial

What Is Fileless Malware and How to Detect It Effectively

Quick answer: Fileless malware runs mainly in memory and abuses trusted tools already on a system, such as PowerShell, WMI and signed Windows binaries, instead of dropping a traditional executable. That makes file-scanning antivirus less effective. You detect it by watching behaviour: enable PowerShell script block logging (event ID 4104), keep the Antimalware Scan Interface (AMSI) active so scripts are scanned after deobfuscation, collect process and command-line data with Sysmon or an EDR tool, and alert on unusual parent and child processes. Reduce risk with attack surface reduction rules, application control and least privilege.

Key takeaways

  • Fileless attacks live off the land, using built-in tools like PowerShell.
  • MITRE ATT&CK tracks PowerShell abuse as T1059.001.
  • AMSI lets security tools inspect scripts at run time.
  • Script block logging and command-line auditing provide key evidence.
  • Behaviour-based EDR is more effective than file scanning alone.

Table of Contents

What Is Fileless Malware?

Fileless malware is a style of attack, not a single malware family. The attacker avoids writing a malicious program to disk. Code may run directly in memory, be stored in the registry or WMI, or be loaded by trusted system tools. Security agencies call this living off the land. The joint CISA and partner guidance on living off the land explains why these techniques blend in with normal administration.

Which Techniques Do Fileless Attacks Use?

TechniqueATT&CK IDWhat defenders see
PowerShell executionT1059.001Encoded commands, downloads into memory
Windows Management InstrumentationT1047Remote process creation, WMI event subscriptions
Signed binary proxy executionT1218mshta, rundll32 or regsvr32 running scripts
Registry run keys for persistenceT1547.001Scripts stored in registry values
Process injectionT1055Code running inside a legitimate process

Attacks often begin with phishing or social engineering. The Kimsuky ClickFix campaign is one example where victims were tricked into running PowerShell themselves.

Why Is Fileless Malware Hard to Detect?

  • There may be no file to hash or scan.
  • PowerShell and WMI are used daily by administrators.
  • Commands are often obfuscated or base64 encoded.
  • Evidence in memory disappears after a reboot.

Which Logs Should You Turn On?

ControlWhat it recordsWhere
PowerShell script block loggingScript content after deobfuscation, event ID 4104Microsoft-Windows-PowerShell/Operational
Process creation with command lineEvery new process and its arguments, event ID 4688Security log
SysmonProcess, network, registry and WMI eventsMicrosoft-Windows-Sysmon/Operational
AMSIRuntime script content passed to antimalwareDefender or EDR alerts

Microsoft's PowerShell logging documentation explains script block logging, usually enabled by Group Policy. AMSI lets antimalware inspect PowerShell, VBScript, JScript and Office macros at run time. Sysmon adds detailed telemetry. To review recent script block events on a test machine:

Get-WinEvent -LogName 'Microsoft-Windows-PowerShell/Operational' -MaxEvents 50 |
  Where-Object { $_.Id -eq 4104 } |
  Select-Object TimeCreated, Message

Under CERT-In directions, Indian organisations must keep ICT system logs for 180 days, so forward these logs to a SIEM.

What Detection Signals Should You Watch?

  • Office apps or browsers launching PowerShell, cmd, mshta or wscript.
  • PowerShell with encoded command or hidden window flags.
  • Attempts to disable AMSI, Defender or logging.
  • New WMI event subscriptions or unusual registry run keys.
  • Scripting engines making outbound network connections.

How Can You Prevent Fileless Attacks?

  • Enable Microsoft Defender attack surface reduction rules, such as blocking Office apps from creating child processes.
  • Use application control (WDAC or AppLocker) so PowerShell runs in Constrained Language Mode for normal users.
  • Remove PowerShell version 2, which lacks modern logging.
  • Limit local admin rights and patch browsers and Office.
  • Train staff to refuse instructions to paste commands into Run or terminal windows.

How Should You Respond to a Suspected Case?

Isolate the host but avoid rebooting until memory is captured, since evidence lives in RAM. Collect logs, check for persistence and reset exposed credentials. Report qualifying incidents to CERT-In within 6 hours. AI-assisted attackers are making scripts harder to spot, as covered in our piece on dark AI attacks. For hands-on detection practice, ask about our SOC analyst and threat hunting training.

References

Frequently Asked Questions

It is malicious activity that runs mainly in memory or through trusted built-in tools such as PowerShell and WMI, without dropping a traditional executable file.

Traditional file scanning often misses it. Modern tools using AMSI, behaviour monitoring and EDR telemetry detect it far more reliably.

The Antimalware Scan Interface is a Windows feature that lets security products scan script content at run time, after obfuscation is removed.

Event 4104 is a script block logging event that records the PowerShell code that ran, which helps investigators see obfuscated or in-memory scripts.

It is the MITRE ATT&CK technique ID for adversary use of PowerShell to execute commands and scripts on Windows systems.

A reboot can clear purely in-memory code, but many attacks persist through registry keys, scheduled tasks or WMI, and rebooting destroys memory evidence.

Usually not, because administrators need it. Use Constrained Language Mode, logging, application control and least privilege instead of a blanket block.

CERT-In directions require organisations to keep ICT system logs for 180 days and report qualifying incidents within 6 hours.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.