The question
Someone asked me how you find a rule that was built so nobody would find it.
You don't find it by looking in the inbox. The inbox is the one place it was designed to fool. You find it by asking the mailbox what changed, who changed it, and from where. Then you keep asking until the answers stop disagreeing with each other.
Here's the method, using a case from April. A director's mailbox, an anonymous proxy in Frankfurt, and one inbox rule that did exactly three things. It took me 42 questions and 5 minutes 9 seconds. You can take longer. Most people do.
Step 1: Read the rule like it's a confession
Pull the rule's full definition before you do anything else. Name, conditions, actions, order. In Exchange Online PowerShell that's Get-InboxRule -Mailbox <user> -IncludeHidden | Format-List *. The -IncludeHidden switch matters. Some rules don't show up in Outlook at all.
This one was named after a person. Call them [PERSON_1]. Its conditions matched any message whose subject or body contained that person's name or either of two external email addresses. Its actions:
- Mark as read.
- Move to RSS Subscriptions.
- Stop processing more rules.
Each action has a job. Marking it read kills the unread badge. Moving it to RSS Subscriptions puts it in a folder nobody has opened since 2011. Stopping further rules means no other rule gets a chance to surface it. Together they make a specific conversation with two specific outside contacts disappear from a director's view while it keeps arriving.
People don't build that to tidy up newsletters. They build it to sit in the middle of a conversation. That's business email compromise, and the rule told me the attacker already knew who the director talks to about money.
Folder choice is a tell on its own. RSS Subscriptions, RSS Feeds, Conversation History, Archive and Deleted Items are the usual hiding spots. Microsoft's own alert grading guidance for inbox manipulation calls out the RSS folder and the MoveToFolder plus MarkAsRead pairing.
Step 2: Find out how the rule was made
Exchange logs rule changes differently depending on the client, so check all of them:
- New-InboxRule and Set-InboxRule come from Outlook on the web or PowerShell.
- UpdateInboxRules comes from the Outlook desktop client, and it can bundle several changes into one event with a different parameter layout.
- Enable-InboxRule turns on a rule that was sitting there disabled. Attackers like that one.
If your detection only watches New-InboxRule, it misses most of the ways in.
Here, the audit log recorded Set-InboxRule through Outlook on the web at 20:01:40 UTC, with ResultStatus True. The client IP belonged to DataCamp Limited (AS212238) in Frankfurt am Main. IP enrichment flagged it as anonymous, datacenter and VPN, with a VPN score of 100 and a listing on a VPN blocklist. The user had no history with that address.
A director in a known city doesn't edit mailbox rules from a German datacenter proxy on a Thursday. That's one data point. I wanted several more.
Step 3: Trace the session, not the password
Most write-ups of this attack stop at the rule. Don't. This step explains the whole case.
Pull the sign-in logs for the user across the window and line them up:
- 17:56 and 17:59. The user clicks Safe Links to an external personal SharePoint site from the corporate IP.
- 17:58:32. A sign-in from Santa Clara on a Tencent IP completes MFA by mobile app notification. That's two minutes after the first click.
- 18:49. Last legitimate activity from the corporate IP.
- 19:15 and 19:49. Sign-ins from Chicago and Sand Springs, Oklahoma, both on AT&T, both marked "Previously satisfied" for MFA.
- 19:15:59 to 20:02:00. 81 Exchange operations from the Frankfurt proxy.
"Previously satisfied" means nobody answered an MFA prompt. The token did. Somebody completed MFA once in Santa Clara, and the resulting session got reused from three other places. The session ID is what ties it together. Correlate it across Exchange, Entra ID and Defender for Cloud Apps, and four locations turn into one session.
So resetting the password alone would have accomplished very little. The attacker never needed it again. (Greg's attacker got past MFA twice by abusing password reset. This one got past it zero times. It just borrowed a session that had already passed.)
Step 4: Count what they touched
81 operations in 46 minutes. I broke them down:
- 44 MailItemsAccessed events across Sent Items, Inbox subfolders and a folder called Legal.
- 36 Update operations on AttachmentCollection, on emails about invoices, payments and licensing.
- 1 Set-InboxRule, at the very end.
Look at the order. They read first. They touched attachments on the money emails. Then, with 20 seconds left in the session, they set the rule so the replies would go somewhere quiet. That's a tidy worker.
Make sure you can see MailItemsAccessed at all. Microsoft moved it into Purview Audit (Standard) in 2024, but mailboxes with a customized audit configuration may still need it added by hand. One more thing: MailItemsAccessed records can be aggregated, so one event may cover several items. Count events, then open them.
Step 5: Rule out the boring explanations
A rule from a VPN can be a person on hotel Wi-Fi. A strange rule can be a person with strange habits. Test those before you call anything.
- Corporate VPN or approved remote access? Failed. DataCamp is nobody's corporate egress.
- A benign rule the user made? Failed. No benign rule hides two named outside contacts and stops further processing.
- Admin confirmation was a mistake or automation? Passed. An administrator marked the account confirmed compromised at 20:32:09, 31 minutes after the rule went in.
Then the bigger hypotheses. A malicious insider? Ruled out, because the access came from a proxy with no history for the user. A fully compromised workstation? Ruled out for lack of evidence, with medium confidence. The workstation, ws-001, showed 165 on-premises logons, all normal, and I found no lateral movement, staging, exfiltration or command and control. No forwarding rules either.
Medium confidence is the honest number there. I said it. You should too.
The user's address also appeared in 10 known breaches, including Operation Endgame and the Anti Public combo list. That's context. It explains why the account was worth phishing. It doesn't prove anything about April 23.
Verdict: account compromise, high confidence.
Step 6: Contain in the right order
Order matters because of Step 3.
- Revoke sessions first. The token is the attacker's key. Kill every refresh token for the user.
- Reset the password and re-register MFA. The mobile app method was used to approve the original sign-in.
- Remove the rule, then list every rule. Use
-IncludeHidden. Attackers who set one rule sometimes set a spare. - Warn the two outside contacts. The rule told you exactly who the attacker wanted to impersonate or intercept. If an invoice from this mailbox changes bank details next week, they should call before they pay.
- Keep scoping. Check the rule's keywords against other mailboxes, and check the proxy IP and session ID across the tenant.
Hunt queries you can run this afternoon
These run in Microsoft Defender XDR Advanced Hunting (CloudAppEvents) and Microsoft Sentinel (SigninLogs). Tune folder names for your tenant's language.
Rules that hide, move or forward mail:
CloudAppEvents| where Timestamp > ago(30d)| where Application == "Microsoft Exchange Online"| where ActionType in ("New-InboxRule", "Set-InboxRule", "Enable-InboxRule", "UpdateInboxRules")| extend Params = tostring(RawEventData.Parameters)| where Params has_any ("RSS", "Conversation History", "Archive", "Deleted Items", "Junk") or Params has_any ("MarkAsRead", "StopProcessingRules", "DeleteMessage", "ForwardTo", "RedirectTo")| project Timestamp, AccountDisplayName, ActionType, IPAddress, ISP, CountryCode, IsAnonymousProxy, Params| order by Timestamp desc
UpdateInboxRules stores its details under OperationProperties instead of Parameters, so expand RawEventData if that action shows up empty.
Heavy mailbox reading from anonymous infrastructure:
CloudAppEvents| where Timestamp > ago(7d)| where Application == "Microsoft Exchange Online"| where ActionType in ("MailItemsAccessed", "Update")| summarize Accessed = countif(ActionType == "MailItemsAccessed"), Updates = countif(ActionType == "Update"), FirstSeen = min(Timestamp), LastSeen = max(Timestamp) by AccountObjectId, AccountDisplayName, IPAddress, ISP, IsAnonymousProxy| where Accessed > 30 and (IsAnonymousProxy == true or Updates > 0)
One session, several cities:
SigninLogs| where TimeGenerated > ago(7d)| where ResultType == "0"| extend City = tostring(LocationDetails.city)| summarize IPs = make_set(IPAddress), Cities = make_set(City), Start = min(TimeGenerated), End = max(TimeGenerated) by UserPrincipalName, SessionId| where array_length(Cities) > 1
The last one gets noisy with mobile users. Pair it with IP enrichment and it gets quiet fast.
What to watch for
- Alert on New-InboxRule, Set-InboxRule, Enable-InboxRule and UpdateInboxRules. All four.
- Treat MoveToFolder to RSS, Archive or Conversation History plus MarkAsRead as suspicious until someone explains it.
- Correlate session IDs across Entra ID, Exchange and Defender for Cloud Apps. Token reuse lives in that join.
- Flag "Previously satisfied" MFA from a new location while the user's own device is active somewhere else.
- Compare rule keywords with the user's recent Safe Links clicks and email threads. The attacker did reconnaissance. You can read it back.
The full case is in the Casebook: all 42 questions, the timeline, the four hypotheses and the MITRE mapping (T1564.008, T1114.003, T1078.004). Read the investigation. Then go open your own RSS Subscriptions folder. I'll wait.
FAQ
What is a malicious inbox rule?
An inbox rule an attacker creates in a compromised mailbox to hide, move, delete or forward messages. In business email compromise it usually hides replies from specific contacts so the real user doesn't notice a conversation being hijacked. MITRE tracks it as T1564.008, Email Hiding Rules.
Why do attackers move email to the RSS Subscriptions folder?
Almost nobody opens it. The folder exists in every Exchange mailbox and syncs to Outlook, but few users read RSS through Outlook anymore, so mail moved there and marked as read can sit unnoticed for weeks.
What's the difference between New-InboxRule, Set-InboxRule and UpdateInboxRules?
New-InboxRule and Set-InboxRule are logged when a rule is created or changed in Outlook on the web or through PowerShell. UpdateInboxRules is logged when the Outlook desktop client changes rules, and it can group several changes into one record. A complete detection watches all of them, plus Enable-InboxRule.
Does MFA stop inbox rule attacks?
Not when the attacker steals a session token after MFA is complete. In this case one MFA approval in Santa Clara produced a session that was reused from three other locations, each logged as "Previously satisfied." Revoking sessions, not just resetting the password, is what cuts that access off.
Sources
- Command Zero investigation: Account Compromise, Inbox Rule & Session Token Reuse
- Microsoft: Alert classification for suspicious inbox manipulation rules
- Microsoft: Alert classification for suspicious inbox forwarding rules
- Microsoft Tech Community: New Standard logs in Microsoft Purview Audit (MailItemsAccessed)
- Elastic: M365 Exchange inbox phishing evasion rule created



