LoFP LoFP / legitimate applications may access multiple mailboxes via an api. you can filter by the clientappid or the clientipaddress fields.

Techniques

Sample rules

O365 Multiple Mailboxes Accessed via API

Description

The following analytic is designed to trigger when a high number of Office 365 Exchange mailboxes are accessed via API (Microsoft Graph API or Exchange Web Services) in a short time, hinting at possible unauthorized mass email access. It tracks ‘MailItemsAccessed’ operations in Exchange, using AppId and regex to identify API interactions. Crucial for SOC teams, this analytic focuses on spotting abnormal access patterns, often signaling data exfiltration or account compromise. Security teams should tailor the threshold - set here to flag over five unique mailboxes accessed within 10 minutes - to align with their environment’s norms, ensuring effective detection of potential security incidents while maintaining operational efficiency.

Detection logic

 `o365_management_activity` Workload=Exchange Operation=MailItemsAccessed AppId=* ClientAppId=* 
| bucket span=10m _time 
| eval matchRegex=if(match(ClientInfoString, "^Client=WebServices;ExchangeWebServices"), 1, 0) 
| search (AppId="00000003-0000-0000-c000-000000000000" OR matchRegex=1) 
| stats values(ClientIPAddress) as src_ip dc(user) as unique_mailboxes values(user) as user by _time ClientAppId ClientInfoString 
| where unique_mailboxes > 5 
| `o365_multiple_mailboxes_accessed_via_api_filter`