Detection rules › Splunk
O365 BEC Email Hiding Rule Created
This analytic detects mailbox rule creation, a common technique used in Business Email Compromise. It uses a scoring mechanism to identify a combination of attributes often featured in mailbox rules created by attackers. This may indicate that an attacker has gained access to the account.
Known false positives
- Short rule names may trigger false positives. Adjust the entropy and length thresholds as needed.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry coverage
Rules detecting the same action
These rules filter on the same operation.
- M365 Exchange Inbox Forwarding Rule Created (Elastic)
- M365 Exchange Inbox Rule with Obfuscated Name (Elastic)
- Malicious Inbox Rule (Kusto)
- O365 Email New Inbox Rule Created (Splunk)
Rule body
name: O365 BEC Email Hiding Rule Created
id: 603ebac2-f157-4df7-a6ac-34e8d0350f86
version: 8
creation_date: '2025-02-14'
modification_date: '2026-05-13'
author: '0xC0FFEEEE, Github Community'
status: production
type: TTP
description: This analytic detects mailbox rule creation, a common technique used in Business Email Compromise. It uses a scoring mechanism to identify a combination of attributes often featured in mailbox rules created by attackers. This may indicate that an attacker has gained access to the account.
data_source: []
search: |-
`o365_management_activity` Workload=Exchange Operation IN ("New-InboxRule", "Set-InboxRule")
| stats min(_time) as firstTime, max(_time) as lastTime, values(Operation) as Operation, latest(Name) as Name, latest(MarkAsRead) as MarkAsRead, latest(MoveToFolder) as MoveToFolder by object_id user
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| lookup ut_shannon_lookup word as Name
| eval entropy_score=if(ut_shannon<=2, 1, 0)
| eval len_score=if(len(Name)<=3, 1,0)
| eval read_score=if(MarkAsRead="True", 1, 0)
| eval folder_score=if(match(MoveToFolder, "^(RSS|Conversation History|Archive)"), 1, 0)
| eval suspicious_score=entropy_score+len_score+read_score+folder_score
| where suspicious_score>2
| `o365_bec_email_hiding_rule_created_filter`
how_to_implement: You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events. You also need to have the Splunk TA URL Toolbox (https://splunkbase.splunk.com/app/2734/) installed.
known_false_positives: Short rule names may trigger false positives. Adjust the entropy and length thresholds as needed.
references:
- https://attack.mitre.org/techniques/T1564/008/
finding:
title: Potential BEC mailbox rule - $Name$ was created by user - $user$
entity:
field: user
type: user
score: 50
threat_objects:
- field: Name
type: signature
analytic_story:
- Office 365 Account Takeover
asset_type: O365 Tenant
mitre_attack_id:
- T1564.008
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
category: cloud
security_domain: audit
Stages and Predicates
Stage 1: search
`o365_management_activity` Workload=Exchange Operation IN ("New-InboxRule", "Set-InboxRule")
Stage 2: stats
| stats min(_time) as firstTime, max(_time) as lastTime, values(Operation) as Operation, latest(Name) as Name, latest(MarkAsRead) as MarkAsRead, latest(MoveToFolder) as MoveToFolder by object_id user
Stage 3: search
| `security_content_ctime(firstTime)`
Stage 4: search
| `security_content_ctime(lastTime)`
Stage 5: lookup
| lookup ut_shannon_lookup word as Name
Stage 6: eval
| eval entropy_score=if(ut_shannon<=2, 1, 0)
entropy_score =if
ut_shannon <= 21else
0Stage 7: eval
| eval len_score=if(len(Name)<=3, 1,0)
len_score =if
len(Name) <= 31else
0Stage 8: eval
| eval read_score=if(MarkAsRead="True", 1, 0)
read_score =if
MarkAsRead = "True"1else
0Stage 9: eval
| eval folder_score=if(match(MoveToFolder, "^(RSS|Conversation History|Archive)"), 1, 0)
folder_score =if
match(MoveToFolder, "^(RSS|Conversation History|Archive)")1else
0Stage 10: eval
| eval suspicious_score=entropy_score+len_score+read_score+folder_score
Stage 11: where
| where suspicious_score>2
Stage 12: search
| `o365_bec_email_hiding_rule_created_filter`
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Operation | in |
| field:"Operation" kind:in |
Workload | eq |
| field:"Workload" kind:eq value:"Exchange" |
sourcetype | eq |
| field:"sourcetype" kind:eq value:"o365:management:activity" |
suspicious_score | gt |
| field:"suspicious_score" kind:gt value:"2" |