← Back to SOC feed Coverage →

File Malware Detection Trend

kql MEDIUM Azure-Sentinel
T1566
CloudAppEvents
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-11T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be exfiltrating or deploying malware through SharePoint, OneDrive, or Teams by leveraging file-based malware detection patterns. SOC teams should proactively hunt for this behavior to identify potential lateral movement or data exfiltration tactics early in the attack lifecycle.

KQL Query

let TimeStart = startofday(ago(30d));
let TimeEnd = startofday(now());
CloudAppEvents
| where Timestamp >= TimeStart
| where ActionType == 'FileMalwareDetected'
| make-series Count = count() default = 0 on Timestamp from TimeStart to TimeEnd step 1d
| render timechart

Analytic Rule Definition

id: 71cdf9cb-39b7-40fe-a81f-2c125efc7d07
name: File Malware Detection Trend
description: |
  This query visualises total files located on SharePoint, OneDrive and Teams with Malware detections over time summarizing the data daily.
description-detailed: |
  This query visualises total files located on SharePoint, OneDrive and Teams with Malware detections over time summarizing the data daily.
  Query is also included as part of the Defender for Office 365 solution in Sentinel: https://techcommunity.microsoft.com/blog/microsoftdefenderforoffice365blog/part-2-build-custom-email-security-reports-and-dashboards-with-workbooks-in-micr/4411303
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - CloudAppEvents
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  let TimeStart = startofday(ago(30d));
  let TimeEnd = startofday(now());
  CloudAppEvents
  | where Timestamp >= TimeStart
  | where ActionType == 'FileMalwareDetected'
  | make-series Count = count() default = 0 on Timestamp from TimeStart to TimeEnd step 1d
  | render timechart
version: 1.0.0

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Email and Collaboration Queries/Malware/File Malware Detection Trend.yaml