M365 OneDrive Excessive File Downloads with OAuth Token

Last updated a month ago on 2025-07-16
Created 6 months ago on 2025-02-19

About

Identifies when an excessive number of files are downloaded from OneDrive using OAuth authentication. Adversaries may conduct phishing campaigns to steal OAuth tokens and impersonate users. These access tokens can then be used to download files from OneDrive.
Tags
Domain: CloudDomain: SaaSData Source: Microsoft 365Data Source: SharePointData Source: OneDriveUse Case: Threat DetectionTactic: CollectionTactic: ExfiltrationLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Collection (TA0009)(opens in a new tab or window)

Exfiltration (TA0010)(opens in a new tab or window)

False Positive Examples
Legitimate users may download files from OneDrive using OAuth authentication. Ensure that the downloads are authorized and the user is known before taking action.
License
Elastic License v2(opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

o365(opens in a new tab or window)

Query
from logs-o365.audit-*
| where
    @timestamp > now() - 14d and
    event.dataset == "o365.audit" and
    event.provider == "OneDrive" and
    event.action == "FileDownloaded" and
    o365.audit.AuthenticationType == "OAuth" and
    event.outcome == "success"
| eval
    Esql.time_window_date_trunc = date_trunc(1 minutes, @timestamp)
| keep
    Esql.time_window_date_trunc,
    o365.audit.UserId,
    file.name,
    source.ip
| stats
    Esql.file_name_count_distinct = count_distinct(file.name),
    Esql.event_count = count(*)
  by
    Esql.time_window_date_trunc,
    o365.audit.UserId,
    source.ip
| where
    Esql.file_name_count_distinct >= 25

Install detection rules in Elastic Security

Detect M365 OneDrive Excessive File Downloads with OAuth Token in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).