Detection rules › Kusto
Rare and potentially high-risk Office operations
Identifies Office operations that are typically rare and can provide capabilities useful to attackers.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Collection |
Telemetry coverage
Rules detecting the same action
These rules filter on the same operation.
- Detecting Impossible travel with mailbox permission tampering & Privilege Escalation attempt (Kusto)
- High risk Office operation conducted by IP Address that recently attempted to log into a disabled account (Kusto)
- Inbox Rules Creation Or Update Activity in O365 (Sigma)
- M365 Exchange Inbox Phishing Evasion Rule Created (Elastic)
- Mail Forwarding/Redirecting Activity In O365 (Sigma)
- Malicious BEC Inbox Rule (Kusto)
- O365 Mailbox Email Forwarding Enabled (Splunk)
- O365 New Email Forwarding Rule Created (Splunk)
Rule body
id: 957cb240-f45d-4491-9ba5-93430a3c08be
name: Rare and potentially high-risk Office operations
description: |
'Identifies Office operations that are typically rare and can provide capabilities useful to attackers.'
severity: Low
status: Available
requiredDataConnectors:
- connectorId: Office365
dataTypes:
- OfficeActivity
queryFrequency: 1d
queryPeriod: 1d
triggerOperator: gt
triggerThreshold: 0
tactics:
- Persistence
- Collection
relevantTechniques:
- T1098
- T1114
query: |
OfficeActivity
| where Operation in~ ( "Add-MailboxPermission", "Add-MailboxFolderPermission", "Set-Mailbox", "New-ManagementRoleAssignment", "New-InboxRule", "Set-InboxRule", "Set-TransportRule")
and not(UserId has_any ('NT AUTHORITY\\SYSTEM (Microsoft.Exchange.ServiceHost)', 'NT AUTHORITY\\SYSTEM (Microsoft.Exchange.AdminApi.NetCore)', 'NT AUTHORITY\\SYSTEM (w3wp)', 'devilfish-applicationaccount') and Operation in~ ( "Add-MailboxPermission", "Set-Mailbox"))
| extend ClientIPOnly = tostring(extract_all(@'\[?(::ffff:)?(?P<IPAddress>(\d+\.\d+\.\d+\.\d+)|[^\]]+)\]?', dynamic(["IPAddress"]), ClientIP)[0])
| extend AccountName = tostring(split(UserId, "@")[0]), AccountUPNSuffix = tostring(split(UserId, "@")[1])
entityMappings:
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: UserId
- identifier: Name
columnName: AccountName
- identifier: UPNSuffix
columnName: AccountUPNSuffix
- entityType: IP
fieldMappings:
- identifier: Address
columnName: ClientIP
- entityType: CloudApplication
fieldMappings:
- identifier: AppId
columnName: AppId
version: 2.0.5
kind: Scheduled
Stages and Predicates
Stage 1: source
OfficeActivity
Stage 2: where
| where Operation in~ ( "Add-MailboxPermission", "Add-MailboxFolderPermission", "Set-Mailbox", "New-ManagementRoleAssignment", "New-InboxRule", "Set-InboxRule", "Set-TransportRule")
and not(UserId has_any ('NT AUTHORITY\\SYSTEM (Microsoft.Exchange.ServiceHost)', 'NT AUTHORITY\\SYSTEM (Microsoft.Exchange.AdminApi.NetCore)', 'NT AUTHORITY\\SYSTEM (w3wp)', 'devilfish-applicationaccount') and Operation in~ ( "Add-MailboxPermission", "Set-Mailbox"))
Stage 3: extend
| extend ClientIPOnly = tostring(extract_all(@'\[?(::ffff:)?(?P<IPAddress>(\d+\.\d+\.\d+\.\d+)|[^\]]+)\]?', dynamic(["IPAddress"]), ClientIP)[0])
Stage 4: extend
| extend AccountName = tostring(split(UserId, "@")[0]), AccountUPNSuffix = tostring(split(UserId, "@")[1])
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
Operation | in | Add-MailboxPermission, Set-Mailbox | excludes:Operation field:"Operation" value:"Add-MailboxPermission" field:"Operation" value:"Set-Mailbox" |
UserId | match | NT AUTHORITY\SYSTEM (Microsoft.Exchange.ServiceHost), NT AUTHORITY\SYSTEM (Microsoft.Exchange.AdminApi.NetCore), NT AUTHORITY\SYSTEM (w3wp), devilfish-applicationaccount | excludes:UserId |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Operation | in |
| field:"Operation" kind:in |
Output fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
ClientIPOnly | extend |
AccountName | extend |
AccountUPNSuffix | extend |