M365 SharePoint/OneDrive File Access via PowerShell
Identifies file downloads or access from OneDrive or SharePoint using PowerShell-based user agents. Adversaries may use native PowerShell cmdlets like Invoke-WebRequest or Invoke-RestMethod with Microsoft Graph API…
Description
Identifies file downloads or access from OneDrive or SharePoint using PowerShell-based user agents. Adversaries may use native PowerShell cmdlets like Invoke-WebRequest or Invoke-RestMethod with Microsoft Graph API to exfiltrate data after compromising OAuth tokens via device code phishing or other credential theft techniques. This rule detects both direct PowerShell access and PnP PowerShell module usage for file operations. FileAccessed events are included to detect adversaries reading file content via API and saving locally, bypassing traditional download methods. Normal users access SharePoint/OneDrive via browsers or sync clients, making PowerShell-based file access inherently suspicious.
Detection logic
Its licence does not clear it for publishing here
Sunturai publishes a detection's own text where the licence it arrived under has been reviewed and permits it, and Elastic License 2.0 has not. The query as its source wrote it, its canonical form and the hash that pins this revision are in the workspace record.
Detection requirements
- Platform
- ContainersESXiIaaSIdentity ProviderLinuxmacOSNetwork DevicesOffice SuiteSaaSWindows
The rule states no platform. This is derived from the 3 ATT&CK techniques it maps to.
- Log source category
- event_index
Known benign triggers
- IT administrators using PnP PowerShell for site management, migration, or backup operations.
- Legitimate automation scripts using PowerShell to interact with SharePoint or OneDrive for business purposes.
MITRE ATT&CK mappings
0 exclusive techniques.This is coverage no other published rule has; it is not this rule's total technique count.
References
| Reference | Cited by |
|---|---|
| cloud.google.com/blog/topics/threat-intelligence/expansion-shinyhunters-saas-data-theft | 7 |
| pnp.github.io/powershell/ | Only this detection cites it |
| www.volexity.com/blog/2025/02/13/multiple-russian-threat-actors-targeting-microsoft-device-code-authentication/ | 5 |
From the source
- At source
- Open at source
- Upstream identifier
- 491651da-125b-11f1-af7d-f661ea17fbce
- Tagged by the source as
- Data Source: Microsoft 365Data Source: Microsoft 365 Audit LogsDomain: CloudDomain: EmailDomain: SaaSNoise: MediumPerformance: NormalPlatform: Microsoft 365Resources: Investigation GuideRule Type: New TermsService: Microsoft OneDriveService: Microsoft SharePointTactic: CollectionTactic: ExfiltrationUse Case: Threat Detection
Licence
- Published under
- Elastic License 2.0Read the licence
- Attribution
- Required
Authorship
- Written by
- Published
- Sep 20, 2026
- Version
- 3