Detect mailbox permission grants in M365 (KQL)
Granting delegate (Add-MailboxPermission) or send-as (Add-RecipientPermission) rights lets one account read or send from another mailbox — useful for an attacker who wants durable access to a target's mail without owning its credentials. This OfficeActivity query returns those grants, pulls out who was granted access and with what rights, and drops the routine NT AUTHORITY\SELF entries.
It complements inbox-rule hunting: where a rule exfiltrates mail, a permission grant hands over the whole mailbox.
The query
OfficeActivity
| where TimeGenerated > ago(7d)
| where Operation in ("Add-MailboxPermission", "Add-RecipientPermission")
| mv-apply p = parse_json(Parameters) on (
summarize Props = make_bag(bag_pack(tostring(p.Name), p.Value))
)
| extend Trustee = coalesce(tostring(Props.User), tostring(Props.Trustee))
| extend AccessRights = tostring(Props.AccessRights)
| where Trustee !has "NT AUTHORITY\\SELF"
| project TimeGenerated, GrantedBy = UserId, ClientIP, Operation,
Mailbox = OfficeObjectId, Trustee, AccessRights
| sort by TimeGenerated descLine-by-line explanation
| where Operation in ("Add-MailboxPermission", "Add-RecipientPermission")Add-MailboxPermission grants FullAccess/read; Add-RecipientPermission grants SendAs. Both give an attacker standing access to another mailbox.
summarize Props = make_bag(bag_pack(tostring(p.Name), p.Value))Rebuilds the parameter list into a single property bag so each parameter can be read by name regardless of its position.
| where Trustee !has "NT AUTHORITY\\SELF"Drops the self-permission entries Exchange writes routinely, leaving the grants made to another principal.
Required tables and columns
OperationAdd-MailboxPermission (delegate/FullAccess) or Add-RecipientPermission (SendAs).ParametersJSON name/value pairs holding the trustee and the access rights granted.OfficeObjectIdThe mailbox whose permissions were changed.UserIdThe account that made the grant.
MITRE ATT&CK mapping
Tuning and false positives
- Allow-list expected delegation (shared mailboxes, admin assistants) by Trustee or Mailbox to focus on unexpected grants.
- Alert at higher severity when GrantedBy equals the Trustee, i.e. an account granting itself access to another mailbox.
Limitations
- Folder-level permissions (Add-MailboxFolderPermission) are a separate operation and are not covered here.
- Parameter positions vary between operations; the property-bag approach is resilient but verify the field names in your tenant's log sample.
Related queries
References
Last reviewed 2026-11-18.