Detection: O365 Email Receive and Hard Delete Takeover Behavior
Description
The following analytic identifies when an O365 email recipient receives and then deletes emails related to password or banking/payroll changes within a short period. This behavior may indicate a compromised account where the threat actor is attempting to redirect the victims payroll to an attacker controlled bank account.
Search
1`o365_messagetrace` subject IN ("*banking*","*direct deposit*","*pay-to*","*password *","*passcode *","*OTP *","*MFA *","*Account Recovery*")
2
3| eval mailtime = _time
4
5| bin _time span=4hr
6
7| eval user = lower(RecipientAddress)
8
9| eval InternetMessageId = lower(MessageId)
10
11| join InternetMessageId, user max=0
12 [
13
14| search `o365_management_activity` Workload=Exchange Operation IN ("HardDelete") AND Folder.Path IN ("\\Sent Items","\\Recoverable Items\\Deletions")
15
16| spath path=AffectedItems{} output=AffectedItemSplit
17
18| fields _time,ClientProcessName,ClientIPAddress,ClientInfoString,UserId,Operation,ResultStatus,MailboxOwnerUPN,AffectedItemSplit,Folder.Path
19
20| mvexpand AffectedItemSplit
21| spath input=AffectedItemSplit
22
23| search Subject IN ("*banking*","*direct deposit*","*pay-to*","*password *","*passcode *","*OTP *","*MFA *","*Account Recovery*")
24
25| eval deltime = _time
26
27| bin _time span=4hr
28
29| eval InternetMessageId = lower(InternetMessageId), user = lower(UserId), subject = Subject
30 ]
31
32| stats values(ClientIPAddress) as src, values(ClientInfoString) as http_user_agent, values(Folder.Path) as file_path, values(Operation) as signature, values(ResultStatus) as result, values(InternetMessageId) as signature_id, count, min(mailtime) as firstTime, max(deltime) as lastTime by user,subject
33
34| `security_content_ctime(firstTime)`
35
36| `security_content_ctime(lastTime)`
37
38| `o365_email_receive_and_hard_delete_takeover_behavior_filter`
Data Source
Macros Used
| Name |
Value |
| o365_management_activity |
sourcetype=o365:management:activity |
| o365_email_receive_and_hard_delete_takeover_behavior_filter |
search * |
o365_email_receive_and_hard_delete_takeover_behavior_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 |
| T1114.001 |
Local Email Collection |
Collection |
| T1485 |
Data Destruction |
Impact |
Actions on Objectives
Exploitation
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 AND Message Trace events.
Known False Positives
Possible new user/account onboarding processes.
Associated Analytic Story
| Message |
Entity Field |
Entity Type |
Risk Score |
| The user $user$ received and deleted an email within a short timeframe titled [$subject$] which may contain password or banking information |
user |
user |
20 |
Threat Objects
| Field |
Type |
| subject |
email_subject |
| 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