← Back to SOC feed Coverage →

File footprint

kql MEDIUM Azure-Sentinel
DeviceEventsDeviceFileEventsDeviceImageLoadEventsDeviceNetworkEventsDeviceProcessEventsDeviceRegistryEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-22T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be using a specific file to establish persistence or execute malicious payloads, as the presence of this file could indicate initial compromise or command and control activity. Proactively hunting for this file in Azure Sentinel helps identify potential threats early, allowing the SOC team to investigate and mitigate risks before significant damage occurs.

KQL Query

let fileHash = "e152f7ce2d3a4349ac583580c2caf8f72fac16ba";
find in (DeviceFileEvents, DeviceProcessEvents, DeviceEvents, DeviceRegistryEvents, DeviceNetworkEvents, DeviceImageLoadEvents)
where SHA1 == fileHash or InitiatingProcessSHA1 == fileHash
project DeviceName, ActionType, FileName, InitiatingProcessFileName, Timestamp, SHA1, InitiatingProcessSHA1
| project DeviceName, ActionType, Timestamp, 
          FileName = iff(SHA1 == fileHash, FileName, InitiatingProcessFileName),
          MatchedSide=iff(SHA1 == fileHash, iff(InitiatingProcessSHA1 == fileHash, "Both", "Child"), "Parent")
| summarize makeset(ActionType), FirstTimestamp=min(Timestamp), (LastTimestamp, LastActionType)=arg_max(Timestamp, ActionType) by FileName, MatchedSide, DeviceName
| top 1000 by LastTimestamp desc
| sort by DeviceName, LastTimestamp desc

Analytic Rule Definition

id: 20f3eec2-63e5-459c-aa61-64996ee2971d
name: File footprint
description: |
  Query #1 - Find the machines on which this file was seen.
  TODO - set file hash to be a SHA1 hash of your choice...
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceFileEvents
  - DeviceProcessEvents
  - DeviceEvents
  - DeviceRegistryEvents
  - DeviceNetworkEvents
  - DeviceImageLoadEvents
query: |
  let fileHash = "e152f7ce2d3a4349ac583580c2caf8f72fac16ba";
  find in (DeviceFileEvents, DeviceProcessEvents, DeviceEvents, DeviceRegistryEvents, DeviceNetworkEvents, DeviceImageLoadEvents)
  where SHA1 == fileHash or InitiatingProcessSHA1 == fileHash
  project DeviceName, ActionType, FileName, InitiatingProcessFileName, Timestamp, SHA1, InitiatingProcessSHA1
  | project DeviceName, ActionType, Timestamp, 
            FileName = iff(SHA1 == fileHash, FileName, InitiatingProcessFileName),
            MatchedSide=iff(SHA1 == fileHash, iff(InitiatingProcessSHA1 == fileHash, "Both", "Child"), "Parent")
  | summarize makeset(ActionType), FirstTimestamp=min(Timestamp), (LastTimestamp, LastActionType)=arg_max(Timestamp, ActionType) by FileName, MatchedSide, DeviceName
  | top 1000 by LastTimestamp desc
  | sort by DeviceName, LastTimestamp desc

Required Data Sources

Sentinel TableNotes
DeviceEventsEnsure this data connector is enabled
DeviceFileEventsEnsure this data connector is enabled
DeviceImageLoadEventsEnsure this data connector is enabled
DeviceNetworkEventsEnsure this data connector is enabled
DeviceProcessEventsEnsure this data connector is enabled
DeviceRegistryEventsEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/General queries/File footprint.yaml