Investigating DeviceFileEvents in Microsoft Defender XDR
DeviceFileEvents records file activity occurring on endpoints protected by Microsoft Defender for Endpoint.
This table helps defenders investigate file creation, modification, deletion, downloads, archive files, scripts and suspicious payloads.
In this lesson, you will learn how to use DeviceFileEvents to follow file evidence, identify suspicious files and support Microsoft Defender XDR investigations.
Lesson overview
Learn how DeviceFileEvents helps defenders investigate file creation, deletion, downloads, archive files and suspicious payloads.
Why DeviceFileEvents matters
A user may download a ZIP file, an executable may appear in Downloads, a script may be created, or ransomware may rapidly modify large numbers of files.
DeviceFileEvents helps defenders investigate those file events and connect file activity back to devices, users, folders and processes.
Investigation scenario
The network activity is important, but the next question is simple: what file appeared on the device?
By querying DeviceFileEvents, the analyst can review downloads, suspicious file types, folder paths and file actions around the activity.
Step 1 — Review recent file activity
- 1
- 2
- 3
- 4
- 5
- 6
DeviceFileEvents | where Timestamp > ago(24h) | project Timestamp, DeviceName, FileName, FolderPath, ActionType, SHA256 | order by Timestamp desc
Step 2 — Investigate executable files
- 1
- 2
- 3
- 4
- 5
- 6
- 7
DeviceFileEvents | where Timestamp > ago(7d) | where FileName endswith ".exe" | project Timestamp, DeviceName, FileName, FolderPath, ActionType, SHA256 | order by Timestamp desc
Step 3 — Investigate the Downloads folder
- 1
- 2
- 3
- 4
- 5
- 6
- 7
DeviceFileEvents | where Timestamp > ago(7d) | where FolderPath contains "Downloads" | project Timestamp, DeviceName, FileName, FolderPath, ActionType, SHA256 | order by Timestamp desc
How DeviceFileEvents supports investigations
It can show the device, folder path, file name, action type, hash evidence and when the file activity occurred.
Step 4 — Find archive and disk image files
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
DeviceFileEvents | where Timestamp > ago(7d) | where FileName endswith ".zip" or FileName endswith ".rar" or FileName endswith ".7z" or FileName endswith ".iso" | project Timestamp, DeviceName, FileName, FolderPath, ActionType, SHA256 | order by Timestamp desc
Step 5 — Find script files
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
DeviceFileEvents | where Timestamp > ago(7d) | where FileName endswith ".ps1" or FileName endswith ".vbs" or FileName endswith ".js" or FileName endswith ".bat" | project Timestamp, DeviceName, FileName, FolderPath, ActionType, SHA256 | order by Timestamp desc
Common investigation uses
Common mistakes
What you learned
Related Agent Foskett Academy lessons
Continue learning with Building Investigation Timelines, KQL Threat Hunting Guide and Microsoft Security.
Develop IT. Protect IT. GEMXIT PTY LTD | GEMXIT UK LTD