| Attribute | Details | |—|—| | Technique ID | COLLECT-EMAIL-003 | | MITRE ATT&CK v18.1 | Email Collection (T1114) – Remote Email Collection (T1114.002) via Exchange PowerShell / Compliance Search | | Tactic | Collection | | Platforms | M365 (Exchange Online), Exchange 2013–2019 | | Severity | High | | Technique Status | ACTIVE (Search-Mailbox retired in EXO; Compliance Search / Graph API now primary) | | Last Verified | 2024-09-30 | | Affected Versions | Exchange Online; Exchange 2013–2019 (on‑prem Search-Mailbox still supported) | | Patched In | N/A – functionality replaced/redirected in Exchange Online; risk mitigated via RBAC and audit logging | | Environment | M365 | | Author | SERVTEP – Artur Pchelnikau |
Search-Mailbox (on‑prem), New-ComplianceSearch, New-ComplianceSearchAction, and Search-UnifiedAuditLog. Adversaries with admin or eDiscovery roles can execute server‑side searches across multiple mailboxes, optionally copying or exporting matches to special mailboxes or PST files. This is a powerful way to perform targeted email collection without interactive access to Outlook or EWS coding.Search-Mailbox is retired; attackers rely on Compliance Search (content search) and New-ComplianceSearchAction -Export to stage results for PST export. On‑prem, Search-Mailbox can copy or delete messages directly. All of these actions are logged in the Unified Audit Log and Exchange admin logs, but detection depends on ingesting and analyzing those events.-DeleteContent on‑prem is often irreversible without backups.| Framework | Control / ID | Description | |—|—|—| | CIS Benchmark | M365 / Exchange Online – eDiscovery role minimization | Over‑privileged discovery roles allow bulk search and export of regulated communications. | | DISA STIG | O365 STIG – privileged role management | Inadequate separation of duties around compliance/eDiscovery roles. | | CISA SCuBA | Admin and eDiscovery controls | Weak guardrails around content search and export functions. | | NIST 800-53 | AC-5, AC-6, AU-2, AU-12 | Excessive admin privileges and missing audit/alerting for mass search/export. | | GDPR | Art. 32, Art. 25 | Failure to enforce least privilege and logging when processing personal data via search/export. | | DORA | Art. 9 | Non‑monitored access to historical communications breaches ICT logging and monitoring duties. | | NIS2 | Art. 21 | Insufficient risk‑management around powerful search/export operations on critical communications. | | ISO 27001 | A.5, A.8.12, A.8.16 | Missing controls and monitoring on use of admin/eDiscovery tooling. | | ISO 27005 | Abuse of admin/eDiscovery channels | High‑impact risk scenario where trusted tooling is turned into an exfiltration vector.
Mailbox Search rights or Discovery Management role for Search-Mailbox.Supported Versions:
New-ComplianceSearch, New-ComplianceSearchAction.Exchange on‑prem 2013–2019: Search-Mailbox, New-MailboxExportRequest.
# Connect to Exchange Online
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
# List high-privilege discovery roles
Get-RoleGroup | Where-Object { $_.Name -like '*Discovery*' -or $_.Name -like '*Compliance*' } |
Select-Object Name, ManagedBy
# List existing compliance searches
Get-ComplianceSearch | Select-Object Name, Status, ExchangeLocation, ContentMatchQuery
# List recent compliance search actions (including exports)
Get-ComplianceSearchAction | Select-Object Name, Action, Status, Workload
What to Look For:
Supported Versions: Exchange Online.
Objective: Define a KQL query and target mailboxes for collection.
Command:
Connect-IPPSSession # Purview / Compliance PowerShell
New-ComplianceSearch -Name 'HR-Keyword-Scan' `
-ExchangeLocation 'All' `
-ContentMatchQuery '"confidential" OR "wire transfer" OR "password"'
Start-ComplianceSearch -Identity 'HR-Keyword-Scan'
Expected Output:
Starting then Running, later Completed.Objective: Stage results for PST export.
Command:
New-ComplianceSearchAction -SearchName 'HR-Keyword-Scan' -Export -ExchangeArchiveFormat PerUserPST
Get-ComplianceSearchAction -SearchName 'HR-Keyword-Scan' -Action Export | fl Name,Status,Results
Expected Output:
OpSec & Evasion:
ContentMatchQuery to keep exported volume small and focused.References & Proofs:
Supported Versions: Exchange 2013–2019 (on‑prem, not Exchange Online).
Objective: Search a source mailbox and copy results to a target mailbox/folder for later export.
Command:
# Example – copy all mail from a user into a discovery mailbox
Search-Mailbox -Identity 'user@corp.local' `
-TargetMailbox 'DiscoveryMailbox{GUID}' `
-TargetFolder 'User-Collection' `
-LogLevel Full
Expected Output:
OpSec & Evasion:
References & Proofs:
Search-Mailbox.Invoke-AtomicTest T1114.002 -TestNumbers 1
Installation:
Install-Module ExchangeOnlineManagement -Scope CurrentUser
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
Usage:
Get-ComplianceSearch, New-ComplianceSearch, New-ComplianceSearchAction, Search-UnifiedAuditLog.Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) `
-Operations New-ComplianceSearch, New-ComplianceSearchAction `
-ResultSize 5000
Rule Configuration:
SPL Query:
index=o365 Workload="SecurityComplianceCenter"
| eval op=coalesce(Operation, operation)
| where op IN ("New-ComplianceSearch","New-ComplianceSearchAction")
| stats count AS op_count,
values(op) AS operations,
values(UserId) AS users
by UserId, SearchName
| where op_count >= 2
KQL Query:
OfficeActivity
| where OfficeWorkload =~ "SecurityComplianceCenter"
| where Operation in ("New-ComplianceSearch","New-ComplianceSearchAction")
| summarize Count = count(), Ops = make_set(Operation) by UserId, SearchName, bin(TimeGenerated, 1h)
| where Count >= 2 and array_length(Ops) == 2
Connect-IPPSSession, New-ComplianceSearch, or New-ComplianceSearchAction.Search-UnifiedAuditLog with Operations = New-ComplianceSearch, New-ComplianceSearchAction, Search-Mailbox (on‑prem hybrid scenarios) to reconstruct who ran what search, when, and against which locations.| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Initial Access | Compromised admin or compliance account | Entry point. |
| 2 | Collection | COLLECT-EMAIL-003 – Mail Search via PowerShell | Targeted search across many mailboxes. |
| 3 | Exfiltration | Export PST + download | Final data theft. |