← Back to SOC feed Coverage →

BEC - File sharing tactics - OneDrive or SharePoint

kql MEDIUM Azure-Sentinel
T1021
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-10T23:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use OneDrive or SharePoint to exfiltrate data or deliver malicious payloads by leveraging file sharing tactics. SOC teams should proactively hunt for this behavior to detect potential business email compromise (BEC) attacks that exploit cloud storage for lateral movement or data theft.

KQL Query

let securelinkCreated = CloudAppEvents
| where ActionType == "SecureLinkCreated"
| project FileCreatedTime = Timestamp, AccountObjectId, ObjectName;
let filesCreated = securelinkCreated
| where isnotempty(ObjectName)
| distinct tostring(ObjectName);
CloudAppEvents
| where ActionType == "AddedToSecureLink"
| where Application in ("Microsoft SharePoint Online", "Microsoft OneDrive for Business")
| extend FileShared = tostring(RawEventData.ObjectId)
| where FileShared in (filesCreated)
| extend UserSharedWith = tostring(RawEventData.TargetUserOrGroupName)
| extend TypeofUserSharedWith = RawEventData.TargetUserOrGroupType
| where TypeofUserSharedWith == "Guest"
| where isnotempty(FileShared) and isnotempty(UserSharedWith)
| join kind=inner securelinkCreated on $left.FileShared==$right.ObjectName
// Secure file created recently (in the last 1day)
| where (Timestamp - FileCreatedTime) between (1d .. 0h)
| summarize NumofUsersSharedWith = dcount(UserSharedWith) by FileShared
| where NumofUsersSharedWith >= 20

Analytic Rule Definition

id: cf8d2c27-8310-4b13-b135-1ba59ae0a3a2
name: BEC - File sharing tactics - OneDrive or SharePoint
description: |
  This query helps hunting for BEC - File sharing tactics - OneDrive or SharePoint
description-detailed: |
  This query helps hunting for BEC - File sharing tactics - OneDrive or SharePoint. 
  It highlights that a specific file has been shared by a user with multiple participants. Correlating this activity with suspicious sign-in attempts preceding this can help identify lateral movements and BEC attacks.
  Shared by Microsoft Threat Intelligence: https://www.microsoft.com/en-us/security/blog/2024/10/08/file-hosting-services-misused-for-identity-phishing/
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - CloudAppEvents
tactics:
  - LateralMovement
relevantTechniques:
  - T1021
query: |
  let securelinkCreated = CloudAppEvents
  | where ActionType == "SecureLinkCreated"
  | project FileCreatedTime = Timestamp, AccountObjectId, ObjectName;
  let filesCreated = securelinkCreated
  | where isnotempty(ObjectName)
  | distinct tostring(ObjectName);
  CloudAppEvents
  | where ActionType == "AddedToSecureLink"
  | where Application in ("Microsoft SharePoint Online", "Microsoft OneDrive for Business")
  | extend FileShared = tostring(RawEventData.ObjectId)
  | where FileShared in (filesCreated)
  | extend UserSharedWith = tostring(RawEventData.TargetUserOrGroupName)
  | extend TypeofUserSharedWith = RawEventData.TargetUserOrGroupType
  | where TypeofUserSharedWith == "Guest"
  | where isnotempty(FileShared) and isnotempty(UserSharedWith)
  | join kind=inner securelinkCreated on $left.FileShared==$right.ObjectName
  // Secure file created recently (in the last 1day)
  | where (Timestamp - FileCreatedTime) between (1d .. 0h)
  | summarize NumofUsersSharedWith = dcount(UserSharedWith) by FileShared
  | where NumofUsersSharedWith >= 20
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/Hunting/BEC - File sharing tactics - OneDrive or SharePoint.yaml