Detection: O365 Email Hard Delete Excessive Volume
Description
The following analytic identifies when an O365 email account hard deletes an excessive number of emails within a short period (within 1 hour). This behavior may indicate a compromised account where the threat actor is attempting to permanently purge a large amount of items from the mailbox. Threat actors may attempt to remove evidence of their activity by purging items from the compromised mailbox. --- Some account owner legitimate behaviors can trigger this alert, however these actions may not be aligned with organizational expectations / best practice behaviors.
Search
1`o365_management_activity` Workload=Exchange (Operation IN ("HardDelete") AND Folder.Path IN ("\\Sent Items","\\Recoverable Items\\Deletions"))
2
3| eval user = lower(UserId), sender = lower(CASE(isnotnull(SendAsUserSmtp),SendAsUserSmtp,isnotnull(SendOnBehalfOfUserSmtp),SendOnBehalfOfUserSmtp,true(),MailboxOwnerUPN)), subject = trim(CASE(Operation IN ("Send","SendAs","SendOnBehalf"),'Item.Subject',Operation IN ("SoftDelete","HardDelete"),'AffectedItems{}.Subject')), -time = _time,file_name = CASE(Operation IN ("Send","SendAs","SendOnBehalf"),split('Item.Attachments',"; "),Operation IN ("SoftDelete","HardDelete"),split('AffectedItems{}.Attachments',"; ")), file_size = CASE(Operation IN ("Send","SendAs","SendOnBehalf"),round(tonumber('Item.SizeInBytes')/1024/1024,2),true(),round(tonumber(replace(file_name, "(.+)\s\((\d+)(b\)$)", "\2"))/1024/1024,2))
4
5| bin _time span=1hr
6
7| stats values(sender) as sender, values(ClientIPAddress) as src, values(ClientInfoString) as http_user_agent, values(Operation) as signature, latest(file_name) as file_name, sum(file_size) as file_size, values(Folder.Path) as file_path, min(-time) as firstTime, max(-time) as lastTime, dc(subject) as count by _time,user
8
9| where count > 50 OR file_size > 10
10
11| `security_content_ctime(firstTime)`
12
13| `security_content_ctime(lastTime)`
14
15| `o365_email_hard_delete_excessive_volume_filter`
Data Source
Macros Used
| Name |
Value |
| o365_management_activity |
sourcetype=o365:management:activity |
| o365_email_hard_delete_excessive_volume_filter |
search * |
o365_email_hard_delete_excessive_volume_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
| ID |
Technique |
Tactic |
| T1070.008 |
Clear Mailbox Data |
Stealth |
| T1485 |
Data Destruction |
Impact |
Exploitation
Actions on Objectives
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting |
Value |
| Disabled |
true |
| Cron Schedule |
0 * * * * |
| Earliest Time |
-70m@m |
| Latest Time |
-10m@m |
| Schedule Window |
auto |
| Creates Finding (Notable) |
No |
| Creates Intermediate Finding (Risk Event) |
Yes |
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.
Implementation
You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events.
Known False Positives
Users that habitually/proactively cleaning the recoverable items folder may trigger this alert.
Associated Analytic Story
| Message |
Entity Field |
Entity Type |
Risk Score |
| The user $user$ deleted an excessing number of emails [$count$] within a short timeframe |
user |
user |
20 |
Threat Objects
| Field |
Type |
| src |
ip_address |
References
Detection Testing
| Test Type |
Status |
Dataset |
Source |
Sourcetype |
| Validation |
✅ Passing |
N/A |
N/A |
N/A |
| Unit |
✅ Passing |
Dataset |
o365 |
o365:management:activity |
| Integration |
✅ Passing |
Dataset |
o365 |
o365:management:activity |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub |
Version: 6