Back to Blog

What If Removing the Malware Is the Easy Part? Gone From the Disk. Still in Control.

Khadija Javaid
What If Removing the Malware Is the Easy Part? Gone From the Disk. Still in Control.
Fileless MalwareMalware InvestigationMemory ForensicsMalware PersistenceIncident ResponseThreat HuntingDigital ForensicsRegistry PersistenceWMI PersistenceProcess InjectionLiving Off the Land (LOLBins)Volatility 3SysmonEndpoint DetectionCyber Threat IntelligenceMalware AnalysisDFIR (Digital Forensics and Incident Response)

A user clicks a rigged invoice. The screen doesn’t flash red. No ransom note drops. The machine just keeps humming along.

But beneath the surface, a silent chain reaction has already detonated.

Modern malware isn’t a single, clumsy file you can just drag to the trash — it is a living infection. By the time your security team finally spots a rogue network connection or a strange midnight login, the original payload is a ghost. The file they downloaded is long gone, quietly deleted to cover the attacker’s tracks.

Yet, the attack is still breathing.

To hunt modern threats, defenders have to stop chasing static files and start hunting behavior. You need to know how a threat unpacks itself, how it vanishes into volatile memory, and — crucially — how it claws its way back to life after the system shuts down.

Because nuking a malicious file is completely pointless if the invisible tripwire that respawns it is still buried in your Registry.

Malware Is Not Always the Thing You Downloaded

At its core, malware is exactly what it sounds like: malicious software or code designed to perform an unauthorized, harmful, or deceptive function on a system.

But a textbook definition won’t help you catch it. To untangle an infection, an investigator has to interrogate the system with four ruthless questions:

  1. How did it break in? Was it a weaponized email attachment, a poisoned USB, a zero-day exploit, or simply a stolen password?
  2. How did it detonate? Did it drop a classic .exe, trigger a hidden Word macro, inject directly into memory, or turn a trusted Windows tool against itself?
  3. What was the motive? Was it after ransom money, administrative access, trade secrets, or pure disruption?
  4. How did it survive — or vanish? Did it bury itself in the Registry, hijack a kernel driver, or completely evaporate the second its job was done?

Once you understand how it operates, you know what to look for. Every malware category has a distinct forensic personality:

  • Virus: The parasite. It attaches itself to clean files, leaving behind altered file hashes, corrupted binaries, and bizarre execution chains.
  • Worm: The loud neighbor. It spreads autonomously, leaving a chaotic trail of aggressive network scans, copied payloads, and lateral authentication spikes.
  • Trojan: The con artist. It masquerades as legitimate software, betraying itself through misleading filenames, hidden startup entries, and quiet beacons to command-and-control (C2) servers.
  • Ransomware: The extortionist. It doesn’t do subtle. It leaves mass file modifications, deleted shadow copies, changed extensions, and a digital ransom note.
  • Spyware: The voyeur. It quietly siphons data, leaving traces in browser artifacts, rogue extensions, keylogger hooks, and steady outbound traffic.
  • Rootkit: The illusionist. It manipulates the operating system to hide files and connections, exposing itself only through kernel-level anomalies and glaring disagreements between forensic tools.
  • RAT (Remote Access Trojan): The puppet master. It hands the attacker the keyboard, leaving behind anomalous parent-child process trees, persistent C2 heartbeats, and rogue administrative commands.
  • Infostealer: The smash-and-grab thief. It rips through browser cookies, crypto wallets, and saved passwords, leaving behind a flurry of rapid file-access logs and immediate data exfiltration.

Different threats leave different scars. The job isn’t just to find the malicious code — it is to read the crime scene it left behind.

Malware Does Not “Just Run”

Malware first gains access through phishing, malicious downloads, USB devices, vulnerable applications, stolen credentials, compromised updates, fake advertisements, or insider mistakes. Once inside, it needs execution — through a user opening a file, a script running, a macro triggering, an exploit succeeding, or a legitimate Windows tool being abused.

After execution, it checks the environment. It may look for antivirus software, sandboxes, virtual machines, administrator access, internet connectivity, domain membership, and valuable data. If conditions look useful, it may escalate privileges, create persistence, avoid security tools, discover the network, collect data, contact its command-and-control server, and exfiltrate information.

Finally, it delivers impact: encryption, deletion, surveillance, credential theft, disruption, lateral movement, or sale of access.

Initial Access → Execution → Environment Check → Privilege Escalation → Persistence → Defense Evasion → Discovery → Collection → C2 → Exfiltration → Impact

The malware lifecycle is not a straight line. It is a chain of decisions, and every decision can leave evidence.

Surviving the Reboot: The Art of Persistence

A reboot does not automatically remove malware.

If malware has created persistence, it does not need to remain visibly open. It only needs a way to return. It can wait for a user login, a scheduled event, a service start, a browser launch, or a system restart.

The malware file may disappear. The mechanism that brings it back may remain.

Registry Run Keys

Windows can automatically run programs when a user logs in. Malware may place a command, script path, or encoded payload reference inside Registry Run or RunOnce keys. Common locations include:

- HKCU\Software\Microsoft\Windows\CurrentVersion\Run
- HKLM\Software\Microsoft\Windows\CurrentVersion\Run
- HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
- HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

Look for strange paths, scripts in user-writable folders, encoded commands, or entries pointing to Temp, AppData, Public, or unusual directories.

Startup Folder

Windows runs files placed in Startup folders when a user logs in. Common locations include:

%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp

A shortcut, script, executable, or disguised document in these locations may be a persistence mechanism.

Scheduled Tasks

Scheduled tasks can trigger malware at logon, startup, on a timer, when the system becomes idle, or after a specific event occurs. The key investigative question is not only “Does this task exist?”

It is:

What does the task run, when does it run, and why does it need to run at all?

Suspicious tasks often launch PowerShell, scripts, rundll32, mshta, or binaries from user-writable directories.

Windows Services

A Windows service can launch automatically before a user even logs in.

Suspicious signs include:

  • Automatic startup with no clear business purpose
  • A vague or misleading service name
  • An unsigned binary
  • A service executable in Temp, AppData, Public, or a strange directory
  • A service pointing to a missing file or unusual command line

WMI Event Subscriptions

WMI event subscriptions are important because they can create persistence with little or no obvious malware file.

A malicious WMI subscription can wait for a trigger — such as user logon or a system event — and then launch a command or script.

The three parts to inspect are:

  • __EventFilter
  • __EventConsumer
  • __FilterToConsumerBinding

A WMI subscription can be the invisible tripwire that restarts malware after the obvious file has been removed.

DLL Hijacking

DLL hijacking happens when a legitimate program loads a malicious DLL instead of the legitimate one.

A signed application may look harmless, but it can load an unsigned DLL from a user-writable location such as AppData, Public, Temp, or its own application directory.

The executable looks normal. The library it loads is not.

Browser Extensions

A malicious browser extension can survive browser restarts and access web activity, page content, cookies, saved sessions, and sometimes credentials.

Review browser extensions for unknown publishers, unnecessary permissions, unfamiliar names, and recently installed items.

COM Object Hijacking

COM hijacking involves modifying Component Object Model-related Registry entries so that a legitimate Windows process loads attacker-controlled code.

This is harder to notice because the visible application may be genuine. The hidden Registry configuration changes what that trusted application loads.

Timestamping

Some malware changes file timestamps to make a malicious file look older or legitimate.

A more advanced method, often called double timestamping, attempts to alter both NTFS $SI and $FN timestamps. This can make basic timestamp comparison less reliable.

But timestamp manipulation can still leave inconsistencies.

Investigators compare $SI and $FN timestamps, inspect nanosecond precision, and review NTFS journal artifacts such as $LogFile and $UsnJrnl.

A timestamp can be edited. A timeline is harder to fake.

Chasing Ghosts: When the Evidence Lives in RAM

Fileless malware does not always mean that no file ever existed.

It usually means that the final malicious activity runs in memory, is stored in the Registry or WMI repository, is injected into another process, abuses legitimate Windows tools, or deletes its initial file after execution.

No file does not mean no malware. It means the evidence has changed location.

Script-Based Execution

Malware can use PowerShell, VBScript, JavaScript, batch files, Python, shell scripts, macros, or encoded commands.

The script may download, decode, and execute payloads without saving a traditional .exe file.

Living Off the Land

Attackers may abuse legitimate system binaries — often called LOLBins — because security tools may trust them.

Examples include:

- powershell.exe
- cmd.exe
- mshta.exe
- rundll32.exe
- regsvr32.exe
- certutil.exe
- bitsadmin.exe
- wmic.exe

The binary itself may be legitimate. The way it is used may not be.

Process Injection

Process injection happens when malware places malicious code into the memory of another active process and causes it to run.

This can hide malicious activity inside a legitimate process, bypass some security controls, and make attribution harder.

A process may look normal by name while carrying code that never came from its legitimate executable file.

Registry-Stored Payloads

A payload can be stored as an encoded value in the Registry, decoded at runtime, and executed through a script or trusted system tool.

The attacker does not need a visible malware file if the Registry itself becomes the storage location.

WMI-Based Execution

WMI can store event-triggered logic that runs commands or scripts without requiring a normal executable on disk.

This is why checking only files and folders is not enough.

Memory-Only Stealers and Ransomware

A payload may enter memory, steal browser data or documents, send data to an attacker-controlled server, and disappear when the process ends.

If it is captured while active, memory can reveal the payload, command line, network traffic, configuration, and sometimes encryption keys.

If the system reboots first, much of that volatile evidence disappears.

How Malware Hides

Malware is not always invisible. Sometimes it only needs to look normal long enough to avoid attention.

It may obfuscate code with Base64, XOR encoding, string encryption, renamed variables, split commands, or unusual characters. It may pack an executable so that strings and code are hidden until the program unpacks itself in memory.

It may abuse stolen code-signing certificates, mimic legitimate filenames such as svchost.exe, use a system-like icon, hide behind double extensions, delete logs, or alter timestamps.

A rootkit can go further by hiding files, processes, or network connections from normal operating-system views.

The malware does not need to become invisible. It only needs to look less suspicious than everything around it.

What Malware Changes

Malware changes systems in multiple layers.

On the file system, it may create executables, DLLs, scripts, encrypted files, ransom notes, altered documents, hidden files, backups, or deleted originals. In the Registry and system configuration, it may create Run keys, scheduled tasks, services, WMI subscriptions, firewall rules, proxy settings, browser policies, or modified security settings.

In memory, investigators may see new processes, suspicious threads, injected code, abnormal DLLs, shellcode, command history, open network sockets, or keys held temporarily by the malware. At the network level, it may generate unusual DNS queries, unknown outbound connections, suspicious ports, C2 communication, data uploads, or lateral movement.

It may also alter accounts: creating a local user, adding an administrator, changing group membership, adding SSH keys, or creating suspicious cloud-login sessions.

The file is only one artifact. Malware is a behavior — and behavior changes systems.

The Body Is Gone, but the Footprints Remain

Self-deleting malware can remove its original binary, but it cannot always erase every artifact created during execution.

Memory may contain injected code, process command lines, loaded DLLs, open connections, encryption keys, malware configuration, and C2 indicators. Process artifacts may show suspicious parent-child chains. Logs may show process creation, authentication activity, service installation, PowerShell execution, or network connections.

The Registry may retain Run keys, service configurations, WMI subscriptions, browser-extension records, or other persistence entries. The file system may retain deleted-file records, $MFT entries, Prefetch, Jump Lists, shortcuts, NTFS journal data, and artifacts from files that once existed.

Self-deletion removes the body. It rarely removes every footprint.

What Memory Can Still Tell Us

Injected Code and Suspicious Memory

Legitimate programs usually load their code from files on disk. Injected malware may appear as executable memory that has no matching file backing it.

An executable, writable, fileless memory region is a serious warning sign.

Process Trees

Memory captures running processes, parent process IDs, and creation times.

A chain such as:

explorer.exe → mshta.exe → powershell.exe

may be far more meaningful than the final PowerShell process alone.

The process name might be legitimate. The parent-child relationship may not be.

Command Lines and Loaded Modules

Memory can preserve command lines and DLLs loaded by each process.

This can reveal suspicious commands, encoded PowerShell, unusual script execution, or DLL search-order hijacking — such as a signed executable loading an unsigned DLL from AppData or Temp.

Network Connections

Memory can show open sockets and the process that owns them.

This links a suspicious connection to an actual process, even if the original malware file was deleted.

Credentials, Keys, and Configuration

While running, malware may hold C2 configuration, decryption keys, tokens, stolen credentials, or attacker commands in memory.

Sometimes this is more valuable than the malware file itself because it shows what the malware was doing and where it was communicating.

Timing Is Everything

Memory is volatile.

If you capture memory while the system is running, you may recover process lineage, injected code, command lines, loaded modules, keys, and active network connections.

If the machine reboots, the memory-resident payload is gone.

Then investigators depend on telemetry: logs, process-creation events, PowerShell logs, DNS logs, firewall logs, endpoint telemetry, and cloud records.

Memory can tell you almost everything — if you arrive before the reboot.

Telemetry: The Ultimate Digital Witness

When memory is gone, telemetry becomes the investigation’s witness.

Useful sources include:

  • Windows Event ID 4688 for process creation
  • Sysmon Event ID 1 for process creation
  • PowerShell Script Block Logging, often Event ID 4104
  • Sysmon Event ID 7 for image/DLL loading
  • Network connection logs
  • DNS logs
  • Firewall and proxy logs
  • Cloud-account and identity logs

No log entry is not proof that no activity occurred. It may only mean that logging was not enabled.

A missing PowerShell event does not prove PowerShell was never used. It may prove that Script Block Logging was not available before the incident.

How Investigators Find Hidden Malware

Static Analysis

Static analysis examines a suspicious file without executing it.

Investigators inspect hashes, strings, imports, metadata, digital signatures, embedded URLs, packed sections, and YARA matches.

Dynamic Analysis

Dynamic analysis runs a suspicious sample in an isolated environment and observes what it does.

Analysts watch process creation, file changes, Registry edits, DNS requests, network connections, dropped files, scripts, and outbound communications.

Memory Forensics

Memory forensics examines RAM to find hidden processes, injected code, rootkit artifacts, malicious drivers, network connections, encryption keys, and command-line details.

Volatility 3 is widely used for analyzing memory dumps across Windows, Linux, and macOS.

Timeline Analysis

Timeline analysis places artifacts in sequence:

Email opened → document executed → PowerShell started → network connection made → Registry changed → scheduled task created → browser data accessed → data uploaded → malware file deleted

This is how investigators reconstruct an event even when the original file is gone.

The Hunter’s Playbook: Tracing the Attack

  1. Confirm suspicion: Look for unexpected CPU usage, unfamiliar processes, redirects, disabled security tools, new startup items, encryption, strange logins, or unusual outbound traffic.
  2. Isolate the system: Disconnect it from the network. Do not rush to shut it down if memory evidence may be important.
  3. Preserve RAM: Capture memory before rebooting where possible.
  4. Preserve logs: Collect Windows Event Logs, Sysmon logs, DNS, proxy, firewall, VPN, cloud, and endpoint records.
  5. Check persistence: Review Run keys, Startup folders, scheduled tasks, services, WMI subscriptions, browser extensions, COM settings, and suspicious DLL-loading paths.
  6. Hunt indicators: Look for suspicious domains, IPs, hashes, filenames, command lines, parent-child process chains, unexpected PowerShell, new accounts, and unusual extensions.
  7. Remove persistence: Do not only delete the visible malware file. Remove the task, service, Run key, WMI subscription, browser extension, or Registry entry that restarts it.
  8. Rotate credentials: Assume passwords, tokens, browser sessions, VPN credentials, cloud access, SSH keys, and database credentials may be exposed.
  9. Patch and recover: Fix the entry point, patch vulnerable software, restore clean backups, rebuild where necessary, and monitor for recurrence.

The Forensic Arsenal

Cross-Platform Tools

  • Volatility 3: Dissect volatile memory (RAM) to expose injected code, hidden processes, and dormant payloads.
  • YARA: Create custom rules to hunt and classify malware strains based on their digital DNA.
  • osquery: Turn the operating system into a high-performance database to query for anomalies in real time.
  • Velociraptor: Deploy rapid, surgical incident response and execute deep endpoint visibility at scale.
  • Wireshark: Intercept and decode live network traffic to track command-and-control (C2) communication.
  • ClamAV: Establish a baseline scan to quickly weed out known, commodity malware signatures.
  • MISP: Correlate and share live indicators of compromise (IoCs) with the global threat intelligence community.

Windows Tools

  • Process Explorer: Map out parent-child process trees, inspect active handles, and hunt down hijacked DLLs.
  • Process Monitor: Record real-time file, Registry, and network operations to see exactly what a binary is touching.
  • Autoruns: Expose every single mechanism a payload could possibly use to survive a system reboot.
  • TCPView: Map live, active network sockets directly to the specific Windows processes that opened them.
  • Sysmon: Supercharge native Windows logging to track process creation, network connections, and file changes.
  • WinPmem: Securely acquire a physical memory dump of a live system for offline forensic analysis.
  • Eric Zimmerman Tools: Crack open complex Windows forensic artifacts like Prefetch files, Jump Lists, and the Master File Table (MFT).

The Analyst Mindset: Hunting Behavior, Not Binaries

  • Entry: How did it get in?
  • Execution: What ran it?
  • Privilege: What level of access did it gain?
  • Persistence: Can it return after reboot?
  • Evasion: How did it hide?
  • Discovery: What did it inspect?
  • Collection: What data did it target?
  • C2: Where did it communicate?
  • Exfiltration: What left the system?
  • Impact: What damage occurred?
  • Artifacts: What evidence remains?
  • Recovery: What must be removed, rotated, patched, or rebuilt?

Do not investigate malware as a file. Investigate it as a sequence of behavior.

The File Was Gone. The Evidence Wasn’t.

For decades, malware investigation was taught as a matching game: find the suspicious file, calculate its hash, identify its family, and delete it.

That approach is no longer enough. Modern malware is designed to break that exact workflow. It runs in memory, injects itself into trusted processes, hides its persistence in WMI subscriptions, communicates through normal web traffic, and deletes its own payload before the security team even receives an alert.

But as the investigation lifecycle shows, deception has its limits.

A rootkit might hide a process, but it cannot always hide the network socket. A fileless payload might evade the hard drive, but it still leaves a process tree in RAM. A self-deleting executable might erase its body, but it cannot erase the Registry run key it created to survive the next reboot.

Every action an attacker takes — from initial access to exfiltration — leaves a fingerprint on the system’s disk, memory, or telemetry.

The job of a modern security analyst is not simply to ask, “Where is the malware?” The job is to ask, “What ran, what changed, what communicated, and how is it surviving?”

Because deleting a file is easy. Uprooting an infection requires understanding the entire story.

Thanks for reading! Stay curious, question the evidence, and remember: finding an anomaly is only the beginning. 🔍

Connect with me on LinkedIn: Khadija Javaid