← Back to SOC feed Coverage →

AV Detections with Source

kql MEDIUM Azure-Sentinel
DeviceEventsDeviceFileEvents
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-24T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use AV detection sources to exfiltrate data or establish command and control, making early identification critical. SOC teams should proactively hunt for this behavior in Azure Sentinel to detect potential malware distribution or data exfiltration attempts.

KQL Query

let avDetections =
DeviceEvents
| where ActionType == "AntivirusDetection" and isnotempty(MD5)
| extend ParsedFields=parse_json(AdditionalFields)
| project Timestamp, DeviceName, ThreatName=tostring(ParsedFields.ThreatName), FileName, FolderPath, MD5;
//Get a list of file creations
let fileCreations =
DeviceFileEvents 
| where (isnotempty(FileOriginReferrerUrl) or isnotempty(FileOriginUrl)) and isnotempty(MD5)
| project MD5, FileOriginUrl, FileOriginReferrerUrl, InitiatingProcessFileName, InitiatingProcessParentFileName;
//Join the file creations and AV detections on the MD5 of the file
avDetections | join kind=inner (fileCreations) on MD5
| project-away MD51 //Remove the duplicated MD5 field
| sort by Timestamp desc 

Analytic Rule Definition

id: 52c9e90b-84f4-4e2d-ae3d-eef85e8aa069
name: AV Detections with Source
description: |
  This query shows the source of the AV detections (e.g., the website the file was downloaded from etc.).
  Get the list of AV detections.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceEvents
  - DeviceFileEvents
query: |
  let avDetections =
  DeviceEvents
  | where ActionType == "AntivirusDetection" and isnotempty(MD5)
  | extend ParsedFields=parse_json(AdditionalFields)
  | project Timestamp, DeviceName, ThreatName=tostring(ParsedFields.ThreatName), FileName, FolderPath, MD5;
  //Get a list of file creations
  let fileCreations =
  DeviceFileEvents 
  | where (isnotempty(FileOriginReferrerUrl) or isnotempty(FileOriginUrl)) and isnotempty(MD5)
  | project MD5, FileOriginUrl, FileOriginReferrerUrl, InitiatingProcessFileName, InitiatingProcessParentFileName;
  //Join the file creations and AV detections on the MD5 of the file
  avDetections | join kind=inner (fileCreations) on MD5
  | project-away MD51 //Remove the duplicated MD5 field
  | sort by Timestamp desc 

Required Data Sources

Sentinel TableNotes
DeviceEventsEnsure this data connector is enabled
DeviceFileEventsEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Protection events/AV Detections with Source.yaml