Query Details
// X-1 - Purview label downgrade ⨯ CloudAppEvents external upload (10 min window)
// Run in: security.microsoft.com -> Hunting -> Advanced hunting (UNIFIED PORTAL ONLY)
// Requires: Sentinel onboarded to Defender XDR so MicrosoftPurviewInformationProtection is queryable beside CloudAppEvents
let downgrades =
MicrosoftPurviewInformationProtection
| where TimeGenerated > ago(7d)
| where isnotempty(OldSensitivityLabelId) and OldSensitivityLabelId != SensitivityLabelId
| project DowngradeTime=TimeGenerated, AccountUpn=UserId, ItemName, ObjectId,
OldLabel=OldSensitivityLabelId, NewLabel=SensitivityLabelId;
let cloudUploads =
CloudAppEvents
| where Timestamp > ago(7d)
| where ActionType in ("FileUploaded","FileSharedExternally","FileDownloaded")
| project UploadTime=Timestamp, AccountUpn=AccountObjectId, AccountUserName=AccountDisplayName,
ApplicationName=Application, ActionType, ObjectName, IPAddress;
downgrades
| join kind=inner cloudUploads on AccountUpn
| where UploadTime between (DowngradeTime .. (DowngradeTime + 10m))
| project DowngradeTime, UploadTime, AccountUpn, ItemName, ObjectName,
OldLabel, NewLabel, ApplicationName, ActionType, IPAddress
| order by DowngradeTime desc
This query is designed to identify and analyze instances where a sensitivity label downgrade occurs on a file, followed by an external upload action within a 10-minute window. Here's a simplified breakdown of what the query does:
Data Sources: The query uses two data sources:
Downgrade Detection:
Cloud Upload Events:
Correlation:
Output:
In essence, this query helps security analysts identify potential data exfiltration risks by highlighting cases where files have their sensitivity reduced and are then quickly shared externally.

David Alonso
Released: May 25, 2026
Tables
Keywords
Operators