Detect Additional Email Delegate Permissions in Elastic Security
Adversaries may grant additional permission levels to maintain persistent access to an adversary-controlled email account. Using cmdlets like Add-MailboxPermission in Exchange/Office 365, or assigning folder-level permissions, attackers can ensure continued access to target mailboxes. This technique is commonly used in BEC incidents and persistent threat campaigns (APT28, APT29, Magic Hound) to maintain covert email access, enable internal spearphishing, and evade detection by reading communications without triggering login alerts.
MITRE ATT&CK
- Tactic
- Persistence Privilege Escalation
- Technique
- T1098 Account Manipulation
- Sub-technique
- T1098.002 Additional Email Delegate Permissions
- Canonical reference
- https://attack.mitre.org/techniques/T1098/002/
Elastic Detection Query
any where
(
event.dataset == "o365.audit" and
event.action in (
"Add-MailboxPermission",
"Add-MailboxFolderPermission",
"Set-MailboxFolderPermission",
"Add-RecipientPermission",
"Set-Mailbox",
"New-ManagementRoleAssignment"
) and (
o365.audit.Parameters : "*FullAccess*" or
o365.audit.Parameters : "*SendAs*" or
o365.audit.Parameters : "*SendOnBehalf*" or
o365.audit.Parameters : "*ApplicationImpersonation*" or
o365.audit.Parameters : "*ChangePermission*" or
o365.audit.Parameters : "*ChangeOwner*"
)
) or
(
event.dataset == "azure.auditlogs" and
event.action in (
"Add app role assignment to service principal",
"Add delegated permission grant",
"Add member to role",
"Update application"
) and (
azure.auditlogs.properties.target_resources.0.modified_properties.new_value : "*ApplicationImpersonation*" or
azure.auditlogs.properties.target_resources.0.modified_properties.new_value : "*Exchange.ManageAsApp*"
)
) Detects Exchange mailbox permission grants (FullAccess, SendAs, SendOnBehalf, ApplicationImpersonation) via O365 Exchange Admin audit events and Azure AD ApplicationImpersonation role assignments via Azure Audit Logs. Covers both branches of the KQL detection: OfficeActivity cmdlet operations with suspicious access rights, and AAD-level role assignment events for Exchange impersonation.
Data Sources
Required Tables
False Positives & Tuning
- IT helpdesk legitimately granting FullAccess to shared team or department mailboxes during provisioning workflows
- Email compliance and archiving platforms (Mimecast, Proofpoint, Barracuda) configured with ApplicationImpersonation service accounts for mail flow
- Exchange Online hybrid migration tooling or Microsoft 365 admin scripts that temporarily assign full mailbox access during tenant consolidation or onboarding
Other platforms for T1098.002
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Grant FullAccess Mailbox Permission via PowerShell
Expected signal: Office 365 Unified Audit Log: Operation='Add-MailboxPermission', RecordType='ExchangeAdmin', UserId=<admin UPN>, [email protected], Parameters containing 'FullAccess' and '[email protected]'. PowerShell Event ID 4104 (ScriptBlock) if logging is enabled on the workstation running the cmdlet.
- Test 2Grant ApplicationImpersonation Role for Tenant-Wide Mailbox Access
Expected signal: Office 365 Unified Audit Log: Operation='New-ManagementRoleAssignment', RecordType='ExchangeAdmin', Parameters containing 'ApplicationImpersonation' and '[email protected]'. Azure AD Audit Logs may also show a role assignment event. PowerShell ScriptBlock Log (Event ID 4104) captures the New-ManagementRoleAssignment cmdlet with parameters.
- Test 3Set Default User Reviewer Permission on Mailbox Inbox Folder
Expected signal: Office 365 Unified Audit Log: Operation='Set-MailboxFolderPermission' and 'Add-MailboxFolderPermission', Parameters containing 'Default' and 'Reviewer'. Two separate audit events expected — one for Inbox and one for root folder. RecordType='ExchangeAdmin'.
- Test 4Grant SendAs Permission to Attacker Account for BEC
Expected signal: Office 365 Unified Audit Log: Operation='Add-RecipientPermission', RecordType='ExchangeAdmin', [email protected], Parameters containing 'SendAs' and '[email protected]'. ClientIP of the admin session performing the grant.
References (10)
- https://attack.mitre.org/techniques/T1098/002/
- https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/add-mailboxpermission
- https://www.mandiant.com/resources/blog/remediation-and-hardening-strategies-for-microsoft-365-to-defend-against-unc2452
- https://www.crowdstrike.com/blog/hiding-in-plain-sight-using-the-office-365-activities-api-to-investigate-business-email-compromises/
- https://static.carahsoft.com/concrete/files/1015/2779/3571/M-Trends-2018-Report.pdf
- https://www.slideshare.net/slideshow/shmoocon-2019-becs-and-beyond-investigating-and-defending-office-365/128744511
- https://support.google.com/a/answer/7223765?hl=en
- https://learn.microsoft.com/en-us/microsoft-365/compliance/mailbox-audit-logging
- https://learn.microsoft.com/en-us/exchange/permissions/role-assignments
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1098.002/T1098.002.md
Unlock Pro Content
Get the full detection package for T1098.002 including response playbook, investigation guide, and atomic red team tests.