The Defender Exclusion Was Added 12 Minutes Before the Malware Ran
Microsoft Defender was running.
The device was onboarded.
The security controls looked healthy.
Yet malware executed from a folder Defender appeared to ignore.
Agent Foskett followed the timeline backwards.
Twelve minutes before the malware ran, something had changed.
A Defender exclusion had been added.
The Missing Alert Was Part Of The Evidence
The absence of a malware detection did not prove nothing malicious happened. It raised a different question: had the security control been changed before the payload arrived?
Defender looked healthy
Start with the timeline
DeviceRegistryEvents
| where Timestamp > ago(7d)
| where RegistryKey has @"Windows Defender\Exclusions"
| project Timestamp, DeviceName, ActionType,
RegistryKey, RegistryValueName, RegistryValueData,
InitiatingProcessAccountName,
InitiatingProcessFileName,
InitiatingProcessCommandLine
| order by Timestamp asc
Twelve minutes changed the investigation
Look for the command that changed Defender
DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessCommandLine has_any
("Add-MpPreference", "Set-MpPreference")
| where ProcessCommandLine has "Exclusion"
| project Timestamp, DeviceName, AccountName,
FileName, ProcessCommandLine,
InitiatingProcessFileName,
InitiatingProcessCommandLine
| order by Timestamp asc
Now follow the malware
let SuspiciousPath = @"C:\ProgramData\UpdateCache\";
DeviceFileEvents
| where Timestamp > ago(7d)
| where FolderPath startswith SuspiciousPath
| project Timestamp, DeviceName, ActionType,
FileName, FolderPath, SHA256,
InitiatingProcessFileName,
InitiatingProcessCommandLine
| order by Timestamp asc
let SuspiciousPath = @"C:\ProgramData\UpdateCache\";
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FolderPath startswith SuspiciousPath
| project Timestamp, DeviceName, AccountName,
FileName, FolderPath, SHA256,
ProcessCommandLine,
InitiatingProcessFileName,
InitiatingProcessCommandLine
| order by Timestamp asc

