Detection rules › Kusto

Rare and potentially high-risk Office operations

Status
available
Severity
low
Time window
1d
Source
github.com/Azure/Azure-Sentinel

Identifies Office operations that are typically rare and can provide capabilities useful to attackers.

MITRE ATT&CK coverage

TacticTechniques
Persistence
Collection

Telemetry coverage

Rules detecting the same action

These rules filter on the same operation.

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.

FieldKindExcluded valuesSearch
OperationinAdd-MailboxPermission, Set-Mailboxexcludes:Operation field:"Operation" value:"Add-MailboxPermission" field:"Operation" value:"Set-Mailbox"
UserIdmatchNT AUTHORITY\SYSTEM (Microsoft.Exchange.ServiceHost), NT AUTHORITY\SYSTEM (Microsoft.Exchange.AdminApi.NetCore), NT AUTHORITY\SYSTEM (w3wp), devilfish-applicationaccountexcludes:UserId

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Operationin
  • Add-MailboxFolderPermission
  • Add-MailboxPermission
  • New-InboxRule
  • New-ManagementRoleAssignment
  • Set-InboxRule
  • Set-Mailbox
  • Set-TransportRule
field:"Operation" kind:in

Output fields

These fields are emitted when the rule matches.

FieldSource
ClientIPOnlyextend
AccountNameextend
AccountUPNSuffixextend