SearchQueryInitiatedExchange: Spotting Attacker Mailbox Keyword Searches
When attackers search a compromised Exchange mailbox or SharePoint site for lucrative fraud targets, Microsoft Purview records SearchQueryInitiatedExchange and SearchQueryInitiatedSharePoint containing the exact QueryText string typed. Keywords like "wire", "invoice", "bank", "ACH", "IBAN", "password", or "MFA" from unfamiliar IPs trigger AuditVane rule AV-007 automatically.
Detection Objective & Threat Scope
A compromised executive mailbox often holds ten years of emails—far too noisy for a human attacker or BEC script to read chronologically. Instead, within two to five minutes of initial login, threat actors click straight into the OWA or SharePoint search bar and search for keywords pointing directly to cash flow or credentials.
Because SearchQueryInitiatedExchange and SearchQueryInitiatedSharePoint record the literal QueryText parameter in Purview UAL, hunting these search events gives defenders a real-time window into the attacker’s exact intent.
Both Outlook on the Web (OWA), New Outlook, and SharePoint search emit SearchQueryInitiated telemetry under RecordType 2 and SharePoint workloads. Inside AuditData, QueryText contains the raw query terms, QuerySource shows whether OWA or REST/Substrate originated the query, and ClientIP pins down the search location.
AuditVane rule AV-007 scans every SearchQueryInitiatedExchange and SearchQueryInitiatedSharePoint event against curated BEC financial keywords (wire, invoice, bank, ach, iban, routing, payment, remittance) and credential-harvesting keywords (password, credential, mfa, recovery, payroll), cutting out everyday benign employee search noise.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
QueryText (Financial BEC) | wire, invoice, bank, ACH, IBAN, routing, payment | Classic payment-diversion targeting |
QueryText (Credential Recon) | password, VPN, MFA, secret, ssh, recovery | Lateral movement & cloud key hunting |
QuerySource | OWA, Outlook, REST, SharePoint | Compare against employee’s daily client |
ScenarioName | MailSearch vs. PeopleSearch vs. FileSearch | Shows whether attacker searched mail or org chart |
ClientIP / SessionId | Network origin & session of search call | Correlates search straight to AiTM login |
TimeDelta from Login | Typically 1–5 minutes post-compromise | Classic automated or hands-on-keyboard BEC pacing |
Hunt High-Signal Financial & Credential Searches via PowerShell & KQL
# PowerShell Purview UAL pull:
Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-14) -EndDate (Get-Date) -Operations SearchQueryInitiatedExchange,SearchQueryInitiatedSharePoint -SessionId ([guid]::NewGuid()) -SessionCommand ReturnLargeSet -ResultSize 5000 |
Export-Csv .\M365_Searches.csv -NoTypeInformation
# Microsoft Sentinel KQL equivalent:
OfficeActivity | where Operation in ("SearchQueryInitiatedExchange","SearchQueryInitiatedSharePoint")
| extend QueryText = tostring(parse_json(RawEventData).QueryText)
| where QueryText matches regex "(?i)(wire|invoice|bank|ach|iban|password|credential|payroll)"
Sample Suspicious QueryText Discovery
CreationTime UserId ClientIP QueryText
------------ ------ -------- ---------
2026-12-01T08:14:19Z finance.director@contoso.invalid 185.220.101.45 wire transfer OR invoice OR ACH
Normal Employee Search Behavior vs. Attacker Reconnaissance
| Characteristic | Normal Employee Search | Attacker BEC / Lateral Recon |
|---|---|---|
| Query Terms | Specific colleague names, project codes, ticket IDs | Broad Boolean OR queries ("wire OR invoice OR ACH") |
| Timing Pattern | Spread across business hours | Burst within minutes of anomalous login |
| Client Origin | Usual Outlook Desktop (MSExchangeRPC) | Unexpected OWA or REST API from foreign IP |
| Follow-Up Action | Opens 1–2 historical threads | Immediately followed by New-InboxRule or MailItemsAccessed burst |
SearchQueryInitiatedExchange AuditData Payload
{
"CreationTime": "2026-12-01T08:14:19Z",
"Operation": "SearchQueryInitiatedExchange",
"RecordType": 2,
"Workload": "Exchange",
"UserId": "finance.director@contoso-demo.invalid",
"ClientIP": "185.220.101.45",
"QueryText": "wire transfer OR invoice OR ACH",
"ClientInfoString": "Client=OWA;Action=Search"
}
Notice the Boolean syntax ("wire transfer OR invoice OR ACH")—a telltale signature of BEC scripts and experienced fraud operators hunting active receivables threads rapidly in OWA.
Real-World Incident Walkthrough
During an incident affecting a CFO account, initial alerts only flagged an impossible-travel login—making it unclear whether an employee merely used an unapproved VPN or a real intruder entered the mailbox.
Loading the Purview UAL CSV into AuditVane instantly fires AV-007 on SearchQueryInitiatedExchange at 08:14 UTC: QueryText = "wire transfer OR invoice OR ACH" coming from 185.220.101.45 (`Client=OWA;Action=Search`). That single keyword search removes all ambiguity and confirms active financial BEC targeting.
Step-by-Step Triage, Containment & Verification
- Load the victim’s Purview UAL export into AuditVane and review any AV-007 alerts.
- Inspect every QueryText executed during the compromise window (not just flagged financial terms—check for client/vendor names too).
- Re-run the attacker’s exact QueryText inside Purview eDiscovery scoped to the target mailbox to see the exact emails their search surfaced.
- Cross-reference timestamps immediately following the search for MailItemsAccessed Bind events and New-InboxRule creation.
- Notify internal finance/payroll stakeholders and any vendors named in the attacker’s search queries.
How to Verify Containment Completed Cleanly
- All SearchQueryInitiatedExchange and SearchQueryInitiatedSharePoint records audited.
- Sensitive files or threads matching attacker QueryText inventoried for exposure risk.
- Vendor fraud alerts issued where invoice/wire terms appeared.
Analyst Blind Spots, Licensing Quirks & False Positives
Accountants, HR managers, and procurement specialists legitimately search "invoice", "wire", and "payroll" every single day! Always evaluate QueryText alongside ClientIP, UserAgent, SessionId, and timing relative to anomalous logins rather than alerting on keywords in isolation.
Remember that SearchQueryInitiated logs can expose sensitive internal searches (like HR investigations or M&A code names)—handle exports strictly inside zero-upload tools like AuditVane.
Frequently Asked Questions
Does SearchQueryInitiatedExchange log Outlook Desktop and OWA searches?
Yes, modern Outlook search (Microsoft Search / Substrate), OWA, and SharePoint search emit SearchQueryInitiated telemetry.
Does AuditVane flag every single search query?
No—to keep noise low, AuditVane AV-007 filters SearchQueryInitiated events for high-signal BEC financial and credential keywords.
Can an attacker erase their Purview search trail by clearing Outlook search history?
No. Clearing recent UI suggestions in Outlook only removes local UI history and never deletes Purview audit logs.
Why do attackers search SharePoint too?
Using SearchQueryInitiatedSharePoint lets attackers quickly locate shared Excel vendor sheets, password spreadsheets, and AWS/VPN documentation.