Reconstructing a multi-stage ransomware attack using Microsoft Defender and KQL
This threat hunt investigated suspicious activity across multiple hosts using Microsoft Defender for Endpoint telemetry. The goal was to reconstruct the attack lifecycle, identify attacker techniques, and determine the scope of compromise.
The investigation revealed a multi-stage attack involving reconnaissance, credential discovery, command-and-control activity, data staging, and ransomware deployment.
This investigation identified a multi-stage ransomware intrusion affecting two hosts (AS-PC2 and AS-SRV). The attacker leveraged LOLBins for tool delivery, performed network reconnaissance and credential discovery, established remote access via AnyDesk, and staged data prior to ransomware deployment.
Key findings:
- Ransomware payload:
updater.exe - SHA256:
e609d070ee9f76934d73353be4ef7ff34b3ecc3a2d1e5d052140ed4cb9e4752b - Initial encryption timestamp: 22:18:33 UTC
- Shadow copies deleted to prevent recovery
- Evidence cleanup performed via script-based deletion
The attack demonstrates common ransomware tradecraft aligned with MITRE ATT&CK techniques.
π An Executive Summary Report can be downloaded via my cybersecurity blog, Happy Bytes
- Viewable on GitHub: Ransomware Threat Hunting Summary Report (PDF)
This repository contains cybersecurity learning exercises and defensive security analysis. The materials document investigations, threat hunting, or incident response scenarios for educational and portfolio purposes.
No malware, exploits, or offensive tooling are distributed in this repository. Any IP addresses, indicators, or artifacts are included strictly for analysis and educational demonstration.
Microsoft Defender for Endpoint Advanced Hunting (KQL)
- DeviceProcessEvents
- DeviceFileEvents
- DeviceNetworkEvents
- DeviceEvents
AS-PC2, AS-SRV
- Multi-stage intrusion observed across endpoints
- Use of LOLBins for initial payload delivery
- Network scanning using
advanced_ip_scanner.exe - Credential discovery via LSASS enumeration
- Persistence established using
AnyDesk.exe - Data staging activity detected prior to encryption
- Ransomware execution and cleanup observed
| Attack Phase | Technique |
|---|---|
| Initial Access | T1105 β Ingress Tool Transfer |
| Execution | T1059 β Command Execution |
| Discovery | T1046 β Network Service Discovery |
| Credential Access | T1003 β OS Credential Dumping |
| Command & Control | T1071 β Application Layer Protocol |
| Exfiltration Prep | T1560 β Archive Collected Data |
| Defense Evasion | T1562 β Disable Security Tools |
| Impact | T1486 β Data Encrypted for Impact |
flowchart TD
A["22:10 Reconnaissance Begins<br>Network scanning observed"]
B["22:12 Tools Downloaded<br>LOLBins used"]
C["22:14 Security Controls Disabled"]
D["22:15 Credential Discovery<br>tasklist | findstr lsass"]
E["22:16 Data Staging"]
F["22:18:33 Ransom Note Dropped<br>Encryption Begins"]
G["22:19 Shadow Copies Deleted<br>vssadmin delete shadows"]
H["22:20 Ransomware Binary Deleted"]
A --> B --> C --> D --> E --> F --> G --> H
This timeline summarizes the sequence of attacker activity reconstructed from endpoint telemetry.
The attacker conducted network reconnaissance to identify accessible systems.
advanced_ip_scanner.exe
DeviceProcessEvents
| where ProcessCommandLine has "scanner"
| project Timestamp, DeviceName, FileName, ProcessCommandLineThe attacker searched for the LSASS process to prepare for credential theft.
tasklist | findstr lsass
DeviceProcessEvents
| where ProcessCommandLine has "tasklist"
| project Timestamp, DeviceName, ProcessCommandLineA remote access tool was deployed to maintain persistence. The presence of AnyDesk indicates the attacker established persistent remote access, enabling lateral movement and command execution.
AnyDesk.exe
DeviceProcessEvents
| where FileName =~ "AnyDesk.exe"
| project Timestamp, DeviceName, ProcessCommandLineFiles were compressed prior to potential data exfiltration. This activity is consistent with pre-encryption staging, where attackers prepare data for exfiltration or impact.
DeviceFileEvents
| where FileName matches regex @".*\.(zip|7z|rar)$"
| project Timestamp, FileName, FolderPath, InitiatingProcessFileNameThe ransomware payload was deployed and executed on the compromised system, marking the transition from reconnaissance and staging to impact.
updater.exe
e609d070ee9f76934d73353be4ef7ff34b3ecc3a2d1e5d052140ed4cb9e4752b
DeviceProcessEvents
| where SHA256 == "e609d070ee9f76934d73353be4ef7ff34b3ecc3a2d1e5d052140ed4cb9e4752b"
| project Timestamp, DeviceName, FileName, ProcessCommandLineThe attacker deleted backup copies to prevent recovery.
vssadmin delete shadows /all /quiet
DeviceProcessEvents
| where ProcessCommandLine has "vssadmin delete shadows"
| project Timestamp, DeviceName, ProcessCommandLineEncryption began when the ransom note was created.
22:18:33 UTC
DeviceFileEvents
| where FileName has_any ("readme","decrypt","recover","ransom")
| project Timestamp, DeviceName, FileName, FolderPathAfter execution, the attacker removed the ransomware binary.
DeviceProcessEvents
| where ProcessCommandLine has "updater.exe"
| where ProcessCommandLine has_any ("del","Remove-Item")
| project Timestamp, DeviceName, ProcessCommandLineRansomware activity was confirmed on the following hosts:
- AS-PC2 (initial compromise / staging)
- AS-SRV (ransomware execution target)
Malware File: updater.exe
SHA256: e609d070ee9f76934d73353be4ef7ff34b3ecc3a2d1e5d052140ed4cb9e4752b
Shadow Copy Deletion Command:
vssadmin delete shadows /all /quiet
Credential Discovery Command:
tasklist | findstr lsass
To support the investigation, screenshots of key Defender Advanced Hunting queries and results are included in this repository. These screenshots provide visual confirmation of the telemetry used to reconstruct the attack timeline.
The following behaviors were used to detect malicious activity:
- Process execution with suspicious command-line arguments
- Known LOLBin abuse for tool delivery
- Creation of archive files in staging directories
- Shadow copy deletion commands
- Execution of known ransomware hash
These detections can be operationalized into SIEM or EDR alerts.
Organizations can detect similar attacks by monitoring for:
- certutil
- powershell Invoke-WebRequest
- bitsadmin
tasklist | findstr lsass
vssadmin delete shadows | wmic shadowcopy delete
Files created in: C:\ProgramData | C:\Users\Public | C:\Windows\Temp
-
The attacker followed a typical ransomware playbook:
- Initial access via tool download
- Internal reconnaissance
- Credential discovery
- Data staging
- Impact via encryption
-
Early detection opportunities existed at:
- LOLBin usage
- Network scanning activity
- Credential discovery commands
-
The use of cleanup techniques indicates attacker awareness of detection controls.
- Analysis is based on available Defender telemetry
- Full network traffic visibility was not available
- Some attacker actions may not be fully captured
This threat hunt reconstructed a ransomware intrusion using Microsoft Defender telemetry. The attacker conducted reconnaissance, credential discovery, persistence establishment, and data staging before deploying ransomware.
Monitoring LOLBin downloads, credential discovery commands, shadow copy deletion, and archive creation can significantly improve ransomware detection and response times. This investigation demonstrates how endpoint telemetry and structured threat hunting can identify ransomware activity before impact.
This project is intended for educational and portfolio demonstration purposes.
Feel free to connect on LinkedIn or review my other security projects.
Feedback and discussion are welcome. Thank you for reviewing this project. π





