1. Resources
  2. Detection rules
  3. Mailbox Forwarding and Hiding Rules in Exchange Online

Mailbox Forwarding and Hiding Rules in Exchange Online detection rules

After taking over a mailbox, an attacker adds an inbox rule or mailbox forwarding that sends copies of mail outside, and a second rule that deletes or hides replies and alerts. The cmdlets are in the unified audit log.

Platform
Microsoft Exchange
Severity
Medium
Log source
Microsoft 365 unified audit log (Exchange)
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Control of the mailbox through a stolen password or session, a consented application or delegate access, or an admin role that can change other users' mailboxes.
Impact
A standing copy of the mailbox's incoming mail, including password reset links and invoices, and replies that never reach the owner.
Response
Remove the rule or forwarding, disable the account or reset its password, and close the other ways back in such as unknown MFA methods and consented applications.
Mitigation
Set automatic external forwarding to Off in the outbound spam filter policies with named exceptions only, and require phishing-resistant MFA.
Operations
New-InboxRuleSet-InboxRuleUpdateInboxRulesSet-Mailbox

How the attack works

Exchange Online has two per-mailbox ways to send mail somewhere else. An inbox rule (New-InboxRule, Set-InboxRule) can forward a message, forward it as an attachment or redirect it, and can also delete it, mark it as read or move it to another folder. Mailbox forwarding (Set-Mailbox with ForwardingSmtpAddress or ForwardingAddress) forwards everything the mailbox receives. Both live in the mailbox, not in the credential, so they keep working after a password reset and session revocation.

Attackers who control a mailbox use the first kind of rule to keep a copy of the victim's mail and the second to hide their own activity: replies to fraudulent messages, bounce messages and alerts are deleted or moved to a folder the owner never opens. Rules created in Outlook on the web or with Exchange Online PowerShell are written to the Microsoft 365 unified audit log as Exchange admin records, with the cmdlet in Operation and every parameter in Parameters. Rules created, changed or removed with an Outlook client are recorded differently, as the mailbox audit operation UpdateInboxRules, and Microsoft documents no field of that record that names the rule's actions. One rule on this page therefore matches that operation alone, at a low level, as a prompt to read the rules in the mailbox. Another matches a rule that moves messages and marks them as read whatever its conditions, the combination Microsoft's alert classification playbook for inbox manipulation rules describes.

What an attacker needs

  • Control of the mailbox (a stolen password or session, a consented application, or delegate access), or an admin role that can change other users' mailboxes.
  • For forwarding outside the organization, an outbound spam filter policy that allows external automatic forwarding.

Impact

A standing copy of the mailbox's incoming mail, including password reset links, invoices and incident response messages, and replies that never reach the owner. This is the usual persistence step in business email compromise and payment fraud.

Detection rules

Inbox Rule That Deletes or Hides Messages Matching Keywords

Detects an Exchange Online inbox rule that deletes messages, marks them as read or moves them to another folder, and that selects messages by words in the subject, body or sender address. Attackers in a mailbox use such rules to hide replies and security alerts from the owner. Requires Microsoft 365 audit logging and the Exchange records of the unified audit log in the SIEM.

LevelLowStatusExperimentalLog sourceMicrosoft 365 unified audit log (Exchange)
title: Inbox Rule That Deletes or Hides Messages Matching Keywords
id: 2befe4a7-8b21-4654-a13b-7b9c30adaa99
status: experimental
description: >-
  Detects an Exchange Online inbox rule that deletes messages, marks them as
  read or moves them to another folder, and that selects messages by words in
  the subject, body or sender address. Attackers in a mailbox use such rules to
  hide replies and security alerts from the owner. Requires Microsoft 365 audit
  logging and the Exchange records of the unified audit log in the SIEM.
references:
  - https://attack.mitre.org/techniques/T1564/008/
  - https://learn.microsoft.com/en-us/powershell/module/exchangepowershell/new-inboxrule
  - https://learn.microsoft.com/en-us/purview/audit-troubleshooting-scenarios#determine-if-a-user-created-an-inbox-rule
author: Forestall
date: 2026-11-11
tags:
  - attack.stealth
  - attack.t1564.008
logsource:
  product: m365
  service: exchange
detection:
  selection_operation:
    Operation:
      - New-InboxRule
      - Set-InboxRule
  selection_action:
    Parameters|contains:
      - DeleteMessage
      - MarkAsRead
      - MoveToFolder
  selection_keywords:
    Parameters|contains:
      - SubjectOrBodyContainsWords
      - SubjectContainsWords
      - BodyContainsWords
      - FromAddressContainsWords
  condition: all of selection_*
falsepositives:
  - Users who file newsletters or notifications into folders with keyword rules. Read the words and the target folder in Parameters, and treat words such as invoice, payment, password, phishing or the name of your security tools as suspicious.
level: low

False positives

  • Users who file newsletters or notifications into folders with keyword rules. Read the words and the target folder in Parameters, and treat words such as invoice, payment, password, phishing or the name of your security tools as suspicious.

Inbox Rule That Moves Messages and Marks Them as Read

Detects an Exchange Online inbox rule, created or changed with New-InboxRule or Set-InboxRule, that both moves messages to another folder (MoveToFolder) and marks them as read (MarkAsRead), whatever its conditions. Microsoft's alert classification playbook for suspicious inbox manipulation rules describes this combination: to evade detection, an attacker moves messages to a less noticeable folder, for example an RSS folder, and marks them as read, and a rule without any keyword filter can be suspicious as well. The keyword rule of this page needs a word condition and does not match such a rule. The parameter names are matched as text in the Parameters array, so read the target folder and the conditions in the event. Requires Microsoft 365 audit logging and the Exchange records of the unified audit log in the SIEM.

LevelMediumStatusExperimentalLog sourceMicrosoft 365 unified audit log (Exchange)
title: Inbox Rule That Moves Messages and Marks Them as Read
id: 58d07741-f73b-4f86-b1dc-ec181cb634fe
status: experimental
description: >-
  Detects an Exchange Online inbox rule, created or changed with
  New-InboxRule or Set-InboxRule, that both moves messages to another folder
  (MoveToFolder) and marks them as read (MarkAsRead), whatever its
  conditions. Microsoft's alert classification playbook for suspicious inbox
  manipulation rules describes this combination: to evade detection, an
  attacker moves messages to a less noticeable folder, for example an RSS
  folder, and marks them as read, and a rule without any keyword filter can
  be suspicious as well. The keyword rule of this page needs a word
  condition and does not match such a rule. The parameter names are matched
  as text in the Parameters array, so read the target folder and the
  conditions in the event. Requires Microsoft 365 audit logging and the
  Exchange records of the unified audit log in the SIEM.
references:
  - https://learn.microsoft.com/en-us/defender-xdr/alert-grading-playbook-inbox-manipulation-rules
  - https://learn.microsoft.com/en-us/powershell/module/exchangepowershell/new-inboxrule
  - https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#exchange-admin-schema
  - https://attack.mitre.org/techniques/T1564/008/
author: Forestall
date: 2026-11-18
tags:
  - attack.stealth
  - attack.t1564.008
logsource:
  product: m365
  service: exchange
detection:
  selection_operation:
    Operation:
      - New-InboxRule
      - Set-InboxRule
  selection_move:
    Parameters|contains: MoveToFolder
  selection_read:
    Parameters|contains: MarkAsRead
  condition: all of selection_*
falsepositives:
  - Users who file newsletters, notifications or automated reports into a folder and mark them as read. Read the target folder and the conditions in Parameters. A folder the owner never opens, such as an RSS folder, a rule with no condition and a rule set from an unusual address are the signals.
  - Rules that also carry keyword conditions match the keyword rule of this page as well.
level: medium

False positives

  • Users who file newsletters, notifications or automated reports into a folder and mark them as read. Read the target folder and the conditions in Parameters. A folder the owner never opens, such as an RSS folder, a rule with no condition and a rule set from an unusual address are the signals.
  • Rules that also carry keyword conditions match the keyword rule of this page as well.

Inbox Rules Created, Changed or Removed From an Outlook Client

Detects the mailbox audit operation UpdateInboxRules, which Exchange Online records when an inbox rule is created, modified or removed with an Outlook client. Such changes are not logged as the New-InboxRule and Set-InboxRule cmdlets. Microsoft's audit schema documents no field that names the rule's conditions or actions in this record (only the generic OperationProperties collection), so the rule matches the operation alone and cannot tell a forwarding or deleting rule from a harmless one, or a new rule from a removed one. Use it as a prompt to read the rules in the mailbox. The operation is audited by default for owners, delegates and admins. For users without an E5 license, Microsoft notes that mailbox audit records reach the unified audit log only after mailbox auditing is enabled on the mailbox by hand.

LevelLowStatusExperimentalLog sourceMicrosoft 365 unified audit log (Exchange)
title: Inbox Rules Created, Changed or Removed From an Outlook Client
id: c718a94c-b5e6-4bba-9d64-753318208638
status: experimental
description: >-
  Detects the mailbox audit operation UpdateInboxRules, which Exchange Online
  records when an inbox rule is created, modified or removed with an Outlook
  client. Such changes are not logged as the New-InboxRule and Set-InboxRule
  cmdlets. Microsoft's audit schema documents no field that names the rule's
  conditions or actions in this record (only the generic OperationProperties
  collection), so the rule matches the operation alone and cannot tell a
  forwarding or deleting rule from a harmless one, or a new rule from a
  removed one. Use it as a prompt to read the rules in the mailbox. The
  operation is audited by default for owners, delegates and admins. For users
  without an E5 license, Microsoft notes that mailbox audit records reach the
  unified audit log only after mailbox auditing is enabled on the mailbox by
  hand.
references:
  - https://attack.mitre.org/techniques/T1114/003/
  - https://attack.mitre.org/techniques/T1564/008/
  - https://learn.microsoft.com/en-us/purview/audit-log-activities#exchange-mailbox-activities
  - https://learn.microsoft.com/en-us/purview/audit-mailboxes
  - https://learn.microsoft.com/en-us/purview/audit-troubleshooting-scenarios#determine-if-a-user-created-an-inbox-rule
  - https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#exchange-mailbox-schema
author: Forestall
date: 2026-11-16
tags:
  - attack.collection
  - attack.t1114.003
  - attack.stealth
  - attack.t1564.008
logsource:
  product: m365
  service: exchange
detection:
  selection:
    Operation: UpdateInboxRules
  condition: selection
falsepositives:
  - Users who create, change or remove their own rules in Outlook, which is common. Read the rules of the mailbox, hidden ones included, and escalate rules that forward, redirect or delete messages, and changes made by someone other than the owner or from an unusual client address.
level: low

False positives

  • Users who create, change or remove their own rules in Outlook, which is common. Read the rules of the mailbox, hidden ones included, and escalate rules that forward, redirect or delete messages, and changes made by someone other than the owner or from an unusual client address.

Inbox Rule or Mailbox Setting That Forwards Mail

Detects an Exchange Online inbox rule that forwards or redirects messages (New-InboxRule or Set-InboxRule with ForwardTo, ForwardAsAttachmentTo or RedirectTo) and mailbox forwarding set with Set-Mailbox (ForwardingSmtpAddress or ForwardingAddress). Requires Microsoft 365 audit logging and the Exchange records of the unified audit log in the SIEM. Parameters is an array of name and value pairs, so the rule matches the parameter name anywhere in it.

LevelMediumStatusExperimentalLog sourceMicrosoft 365 unified audit log (Exchange)
title: Inbox Rule or Mailbox Setting That Forwards Mail
id: dab9ec00-d5f4-41b6-a3be-e9d23c14290b
status: experimental
description: >-
  Detects an Exchange Online inbox rule that forwards or redirects messages
  (New-InboxRule or Set-InboxRule with ForwardTo, ForwardAsAttachmentTo or
  RedirectTo) and mailbox forwarding set with Set-Mailbox (ForwardingSmtpAddress
  or ForwardingAddress). Requires Microsoft 365 audit logging and the Exchange
  records of the unified audit log in the SIEM. Parameters is an array of name
  and value pairs, so the rule matches the parameter name anywhere in it.
references:
  - https://attack.mitre.org/techniques/T1114/003/
  - https://learn.microsoft.com/en-us/purview/audit-troubleshooting-scenarios#determine-if-a-user-created-an-inbox-rule
  - https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#exchange-admin-schema
author: Forestall
date: 2026-11-11
tags:
  - attack.collection
  - attack.t1114.003
logsource:
  product: m365
  service: exchange
detection:
  selection_inbox_rule:
    Operation:
      - New-InboxRule
      - Set-InboxRule
    Parameters|contains:
      - ForwardTo
      - ForwardAsAttachmentTo
      - RedirectTo
  selection_mailbox_forwarding:
    Operation: Set-Mailbox
    Parameters|contains:
      - ForwardingSmtpAddress
      - ForwardingAddress
  condition: 1 of selection_*
falsepositives:
  - Users and administrators who forward mail for a business reason, for example to a shared or ticketing mailbox. Allow-list approved destinations after reading the address in Parameters.
  - Removing forwarding also records the parameter name (with an empty value), so a cleanup by the help desk matches. Check the value before escalating.
level: medium

False positives

  • Users and administrators who forward mail for a business reason, for example to a shared or ticketing mailbox. Allow-list approved destinations after reading the address in Parameters.
  • Removing forwarding also records the parameter name (with an empty value), so a cleanup by the help desk matches. Check the value before escalating.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Inbox rule or forwarding set in a session that started with a risky or unfamiliar sign-in

Detection hypothesisJoins two logsNeeds a baseline

A user who creates a rule does it from a session that began with an ordinary sign-in. An attacker creates it from the session they stole or signed in to, often from an address the user never used. Microsoft's playbook for suspicious inbox forwarding rules asks the analyst to check the address that created the rule and the sign-ins before it. Joining the rule record to the sign-in that started its session turns that check into a detection.

  1. Unified audit log, Exchange admin records: New-InboxRule or Set-InboxRule, or Set-Mailbox with a forwarding parameter in Parameters. Keep UserId, ObjectId, ClientIP and the Microsoft Entra session ID in AppAccessContext.AADSessionId where the record carries it.
  2. Microsoft Entra sign-in logs (interactive and non-interactive): find the sign-ins with the same SessionId and UserPrincipalName. Without a session ID, take the successful sign-ins (ResultType 0) of the same user from the same IPAddress in the 24 hours before the rule.
  3. Alert when one of those sign-ins has RiskLevelDuringSignIn medium or high, or when its IPAddress does not appear among the user's successful sign-ins of the 30 days before.
  4. Raise the priority when the rule forwards outside the organization, or moves, deletes or marks messages as read.

EventsNew-InboxRuleSet-InboxRuleSet-Mailbox

LimitsTravel, a new phone, a new home network and VPN exits look like new addresses. RiskLevelDuringSignIn is hidden without Microsoft Entra ID P2. Microsoft marks AppAccessContext as optional and notes that ClientIP can be the address of a trusted Microsoft application acting for the user. Rules created in an Outlook client are written as UpdateInboxRules and need the same join on that record. The 24 hours and 30 days are starting points.

Same forwarding address set on several mailboxes

Detection hypothesisJoins two logsNeeds your own lists

A business email compromise campaign that takes over several mailboxes tends to send their mail to one place. Microsoft's playbook includes a check for other users who created a forwarding rule to the same destination. A destination that appears in the rules or forwarding settings of two or more mailboxes points to more than one compromised account, which a single-event rule cannot show.

  1. Unified audit log, Exchange admin records: New-InboxRule or Set-InboxRule with ForwardTo, ForwardAsAttachmentTo or RedirectTo in Parameters, and Set-Mailbox with ForwardingSmtpAddress. Take the address from the value of that parameter and the mailbox from ObjectId.
  2. Keep the addresses outside your accepted domains, and count the different mailboxes per address over the last 7 days.
  3. Alert when one address appears for two or more mailboxes, and review every mailbox in the group as compromised.

EventsNew-InboxRuleSet-InboxRuleSet-Mailbox

LimitsA shared external service such as a ticketing or archiving address that several teams forward to appears the same way. Keep a list of approved destinations. Rules created in an Outlook client are recorded as UpdateInboxRules, whose record does not name the destination, so they are not counted. The 7 days are a starting point.

Triage

  • Read Parameters for the destination (ForwardTo, RedirectTo, ForwardAsAttachmentTo, ForwardingSmtpAddress) and for the conditions; an external address or keywords such as invoice, payment or security are strong signals.
  • Compare UserId with the mailbox in ObjectId. A rule set by someone other than the owner, or from an unusual ClientIP, needs an explanation.
  • Check the account's sign-ins before the rule for unfamiliar locations, device code or legacy protocols, and look for a second rule that deletes or moves mail.
  • Rules created in an Outlook client are logged as the mailbox activity UpdateInboxRules, not as these cmdlets. A separate low-level rule on this page matches it, but the record does not name the rule's actions, so read the rules in the mailbox.
  • If the rule is not explained, remove it, revoke sessions, reset credentials and review what was forwarded.

Response

Once the attack is confirmed:

  1. Disable the account while you clean up, or reset its password if it cannot be disabled, and do not send the new password to the user by email. The attacker may still be reading the mailbox.
  2. Close the other ways back into the account that Microsoft lists for a compromised mailbox, namely unknown MFA methods and devices, applications the user consented to, and administrative roles the account should not hold.
  3. Search other mailboxes for rules or forwarding to the same destination, and check this mailbox for delegates added during the compromise.
  4. Recover the messages that the hiding rule deleted or moved and hand them to the owner. They show which replies and alerts the attacker wanted to keep out of sight.
  5. Review the messages sent from the mailbox during the compromise and warn the recipients, finance contacts in particular, about fraudulent requests.
  6. Block the destination address or domain, and replace what the forwarded mail exposed, such as password reset links and credentials.

Mitigation

  • Set automatic external forwarding to Off in the outbound spam filter policies and allow named exceptions only.
  • Require phishing-resistant MFA and block legacy authentication, so a password alone does not open the mailbox.
  • Review inbox rules (hidden ones included) and mailbox forwarding whenever an account is recovered from a compromise; resetting the password does not remove them.
  • Keep mailbox auditing on by default and send the unified audit log to your SIEM.

Frequently asked questions

Does this page detect an inbox rule created in the Outlook desktop client?

Partly. Such a rule is logged as the mailbox activity UpdateInboxRules and not as the cmdlets `New-InboxRule` and `Set-InboxRule`. A separate low-level rule on this page matches that activity. Microsoft documents no field of the record that names the rule's actions, so it cannot tell a forwarding rule from a harmless one, and the rules in the mailbox have to be read.

The user's password was reset and sessions were revoked. Is the forwarding gone?

No. An inbox rule and mailbox forwarding live in the mailbox, not in the credential, so they keep working after a password reset and session revocation. Review the inbox rules of the mailbox, hidden ones included, and its forwarding settings whenever an account is recovered.

Why does the forwarding rule fire when the help desk removes forwarding?

Removing forwarding also records the parameter name, with an empty value, and the rule matches the parameter name. Read the value in Parameters before you escalate. An external address is the signal, and an empty value is a cleanup.

Is the detection still useful if external automatic forwarding is blocked?

Yes. With automatic external forwarding set to Off, forwarding outside the organization is blocked, but the creation of the rule still shows that someone controlled the mailbox. Rules that delete messages, mark them as read or move them to another folder do not depend on that setting at all.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.