← Back to SOC feed Coverage →

Data copied to other location than C drive

kql MEDIUM Azure-Sentinel
DeviceFileEvents
backdoorhuntingmicrosoftofficial
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-21T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be exfiltrating data by copying files to non-C drive locations to avoid detection by standard script-based monitoring tools. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential data exfiltration attempts that bypass traditional script-based detection mechanisms.

KQL Query

DeviceFileEvents
| where ActionType == "FileCreated"
| extend extension= extract(@".*(\..*)$",1,FileName)
| where extension !in (".ps1",".bat",".cmd")
| extend DriveLetterOrShare=split(FolderPath,':')[0]
| where DriveLetterOrShare != 'C'
| project tostring(DriveLetterOrShare), FolderPath, FileName, DeviceId, DeviceName, ReportId, Timestamp, ShareName, IsAzureInfoProtectionApplied, SensitivityLabel, SensitivitySubLabel, InitiatingProcessFileName, InitiatingProcessAccountUpn, InitiatingProcessCommandLine

Analytic Rule Definition

id: 8899867b-0fd8-4cfd-b6f0-0f04ef37142c
name: Data copied to other location than C drive
description: |
  Check all created files.
  That does not have extension ps1, bat or cmd to avoid IT Pro scripts.
  That are not copied to C:\ to detect all file share, external drive, data partition that are not allowed, etc.
  This could help to detect malicious insider/user that has unencrypted data partition and that are using it to exfiltrate data even while removable devices & cloud storage is blocked.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceFileEvents
query: |
  DeviceFileEvents
  | where ActionType == "FileCreated"
  | extend extension= extract(@".*(\..*)$",1,FileName)
  | where extension !in (".ps1",".bat",".cmd")
  | extend DriveLetterOrShare=split(FolderPath,':')[0]
  | where DriveLetterOrShare != 'C'
  | project tostring(DriveLetterOrShare), FolderPath, FileName, DeviceId, DeviceName, ReportId, Timestamp, ShareName, IsAzureInfoProtectionApplied, SensitivityLabel, SensitivitySubLabel, InitiatingProcessFileName, InitiatingProcessAccountUpn, InitiatingProcessCommandLine

Required Data Sources

Sentinel TableNotes
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/Exfiltration/Data copied to other location than C drive.yaml