An attacker inside a mailbox will often create one quiet rule so that the victim never sees the reply, the bounce or the security alert that would give them away. MITRE ATT&CK T1564.008 Email Hiding Rules, a sub-technique of Hide Artifacts (T1564) under the Stealth tactic (TA0005), covers rules that move, mark as read or delete inbound mail in a compromised mailbox, and organisation-wide mail flow rules that do the same for every user. This guide is about the hiding behaviour itself: where rules live on each platform, which audit events record them, how to tell a malicious rule from a user's own housekeeping, and how to remove them without losing evidence. Forwarding rules that copy mail out are covered in the T1114 Email Collection Defensive Guide, and message trace detections in the Email Gateway and Message Trace Detection Guide. It is written for SOC analysts, detection engineers and Microsoft 365 or Google Workspace administrators, and covers defence only.
Key takeaways
- A hiding rule is a symptom of account takeover, not a standalone attack. It nearly always follows valid account use (T1078), so finding one means the whole identity needs response, not just the rule.
- Rules are stored server side and sync everywhere. Microsoft notes that reinstalling Outlook or replacing the computer does not remove a malicious rule, because it syncs back from the cloud mailbox.
- The shape of a malicious rule is recognisable. Keyword conditions such as "phish", "hack" or "invoice", a move to RSS Subscriptions, Notes or Archive combined with mark as read, or delete with no condition at all.
- Different tools create rules through different audit operations. In Exchange Online, Outlook on the web logs New-InboxRule and Set-InboxRule, while the Outlook desktop client logs UpdateInboxRules. Detections that watch only one miss the other.
- Organisation-wide rules are the high-impact variant. A mail flow (transport) rule with DeleteMessage or RedirectMessageTo can silently suppress a topic for every mailbox, so treat changes to them as privileged changes.
How T1564.008 works in ATT&CK v20
ATT&CK describes adversaries using email rules in a compromised user's mailbox to delete or move messages to less noticeable folders, to hide security alerts, command and control traffic, or replies to internal spearphishing (MITRE ATT&CK T1534 Internal Spearphishing) sent from the account. It lists Windows, Linux, macOS and Office Suite as platforms and calls out the New-InboxRule and Set-InboxRule cmdlets (PowerShell, T1059.001) as a creation path. It also notes that administrators, or an attacker holding an administrator account, can create organisation-wide rules such as Exchange transport rules that act on all mail.
ATT&CK v20 records two named groups using the sub-technique. FIN4 (G0085) created Outlook rules to delete messages containing words such as "hacked", "phish" and "malware". Scattered Spider (G1015) created rules in security staff mailboxes to delete email from vendor security products. The single mitigation mapped is Audit (M1047): review inbox and transport rules regularly.
| Variant | Where it lives | Typical attacker goal | Related ATT&CK |
|---|---|---|---|
| User inbox rule (move, mark read, delete) | Mailbox, applied server side | Hide replies, bounces, bank or supplier queries and security notices from the victim | T1564.008 |
| Forwarding or redirect rule | Mailbox rule or mailbox forwarding setting | Copy mail out of the organisation | T1114.003 Email Forwarding Rule |
| Rule that starts an application | Outlook client rule | Code execution and persistence | T1137.005 Outlook Rules |
| Organisation-wide mail flow rule | Exchange transport rules, Gmail routing and content compliance settings | Delete, redirect or quarantine a topic for every user | T1564.008 |
| Local client filter | macOS Mail rule plists, Thunderbird or Evolution filters, Sieve scripts on the mail server | Hide mail on a single device or server mailbox | T1564.008 |
Hiding and forwarding are often combined in one rule, so analyse every new rule for both behaviours. For the parent technique, see the MITRE ATT&CK T1564 Hide Artifacts guide.
What a malicious hiding rule looks like
Microsoft's alert classification playbook for inbox manipulation rules and its compromised account guidance list the patterns below. They are a good starting rule set for triage and for detection logic.
| Rule property | Suspicious pattern | Why it matters |
|---|---|---|
| Conditions | SubjectContainsWords, BodyContainsWords or SubjectOrBodyContainsWords with terms such as phish, spam, suspicious, hacked, do not reply, invoice, payment | Targets the messages that would warn the victim, or the replies in a payment fraud thread |
| No conditions | Rule applies to all inbound mail | Microsoft calls a delete-all rule with no keyword filtering a strong indicator of malicious activity |
| Destination folder | MoveToFolder to RSS Subscriptions, Notes, Junk Email or a folder unrelated to the keywords | Low-visibility folders that users rarely open |
| Combined actions | MoveToFolder with MarkAsRead, or a delete action with no keyword condition | Removes unread counters so nothing draws the user's eye |
| Rule name | Single characters, dots, or names copied from legitimate rules | Designed not to stand out in the rules list |
| Hidden state | Rule returned only with Get-InboxRule -IncludeHidden | Not visible in the normal Outlook rules interface |
| Context | Created minutes after a sign-in from an unfamiliar IP, ISP, country or user agent | Ties the rule to session or credential theft |
Benign rules can share some of these traits: newsletters moved to a folder and marked read are common. The signal is the combination of a security or finance keyword set, a low-visibility destination and an unusual session.
Telemetry and audit events by platform
Detection depends on collecting the right audit operation for each way a rule can be made. Names below are as published in vendor documentation as of November 2026; confirm current names in a real record before building a filter.
| Platform | Event or source | What it records |
|---|---|---|
| Exchange Online (Microsoft Purview audit) | New-InboxRule, Set-InboxRule | A rule created or modified in Outlook on the web; rule parameters are in the record |
| Exchange Online (Microsoft Purview audit) | UpdateInboxRules | A rule created, modified or removed by using the Outlook client |
| Exchange Online admin audit | Transport rule creation and change cmdlets (New-TransportRule, Set-TransportRule), recorded because admin audit logging covers changes made in the Exchange admin center or by cmdlets in Exchange Online PowerShell | Organisation-wide mail flow rules |
| Exchange Online | Set-Mailbox | Mailbox-level forwarding changes, often made alongside hiding rules |
| Exchange Server (on premises) | PowerShell module and script block logging, Windows events 4103 and 4104 | Cmdlet use on management hosts |
| Google Workspace | Gmail API users.settings.filters inventory; admin audit CREATE_GMAIL_SETTING, CHANGE_GMAIL_SETTING, DELETE_GMAIL_SETTING; user accounts event email_forwarding_out_of_domain | Per-user filter state (by inventory), admin changes to Gmail settings, and external forwarding being turned on |
| macOS Mail | Changes to rule plists such as SyncedRules.plist and MessageRules.plist | Local client rules |
| Microsoft Defender XDR | CloudAppEvents with ActionType in New-InboxRule, Set-InboxRule, UpdateInboxRules, Set-Mailbox | Same operations with IP, ISP and location for hunting; rule configuration in RawEventData.Parameters |
| Sieve-based mail servers | Mail server application log, file integrity monitoring on Sieve scripts | New discard, fileinto or redirect actions |
Two gaps need attention. First, Microsoft states that the default alert policy "Creation of forwarding/redirect rule" tracks only rules created in Outlook on the web or Exchange Online PowerShell, and it is about forwarding rather than hiding, so build your own detection for move and delete rules and include UpdateInboxRules. Second, the Google Workspace pages we reviewed do not list an audit event for a user creating a Gmail filter, so per-user filter state has to come from a scheduled inventory through the Gmail API (settings.filters.list) using an approved service account. Treat that service account as a privileged non-human identity: scope it to the settings read scope it needs and keep its key out of scripts (see the Google Workspace Domain-Wide Delegation Security Guide). For log onboarding and retention details, see the Microsoft 365 Unified Audit Log Guide for Detection and the Google Workspace Audit Log Detection Guide.
Detections worth building
- Keyword hiding rule: any New-InboxRule, Set-InboxRule or UpdateInboxRules record whose parameters contain a security or finance keyword list and a move, delete or mark-as-read action. Keep the keyword list in a lookup so you can tune it.
- Low-visibility destination: move to RSS Subscriptions, Notes or Junk Email combined with mark as read. In Gmail, a filter that removes the INBOX label and the UNREAD label, or adds TRASH, from a match on a security keyword.
- Delete-all or no-condition rule: any rule with no conditions and a delete or move action. Alert, do not just log.
- Rule after risky sign-in: rule creation within an hour of a sign-in flagged as risky, from a new country, new ISP or hosting provider IP, or after a token replay alert. This catches rules with innocent-looking keywords.
- Rules on high-value mailboxes: any new rule on security team, finance, payroll, executive and shared mailboxes that receive vendor security alerts. Scattered Spider targeted exactly these.
- Mail flow rule change: any transport rule created or changed with
DeleteMessage,RedirectMessageTo,BlindCopyTo,QuarantineorSetAuditSeverityset toDoNotAudit, outside a change record. Microsoft documents that DoNotAudit prevents incident reports and message tracking entries for matches. - Effect without a rule event: a burst of inbound messages delivered straight to Deleted Items or RSS Subscriptions for one user, detected from message trace. This catches rules created through paths your audit pipeline does not see.
Correlate each hit with the account's sign-in history, MFA method changes, OAuth consents and sent items before deciding severity. The Anomalous Sign-In Detection Guide covers the sign-in side.
Prevention controls
You cannot stop users creating rules, because legitimate users rely on them. Prevention therefore means making account takeover harder and making rule abuse visible quickly.
| Control | Effect on T1564.008 | Notes |
|---|---|---|
| Phishing-resistant MFA and session protection | Removes most of the account access that rule abuse depends on | See the Phishing-Resistant MFA Guide |
| Scheduled rule inventory (M1047 Audit) | Finds rules created through any path, including hidden ones | Exchange: Get-InboxRule -IncludeHidden across mailboxes and Get-TransportRule; Gmail: settings.filters.list |
| Block automatic external forwarding | Stops the combined hide and forward pattern from exfiltrating mail | Covered in the Exchange Online Security Guide |
| Least privilege for mail flow administration | Limits who can create organisation-wide hiding rules | Use a dedicated Exchange role group, privileged access workstations and just-in-time elevation |
Current Outlook builds, EnableUnsafeClientMailRules absent or 0 | Blocks the Start Application rule action | Relevant to T1137.005 rather than hiding, but found in the same review |
| Security alerts sent to more than one channel | A hidden alert email is still seen in the SIEM, ticketing or chat channel | Do not rely on a single analyst mailbox for vendor notifications |
How to implement
- Confirm collection (week 1): check that mailbox audit records for New-InboxRule, Set-InboxRule and UpdateInboxRules reach your SIEM. Create a test rule from Outlook on the web and one from the Outlook desktop client in a pilot mailbox and time how long each takes to arrive.
- Take a baseline (week 1 to 2): run a read-only tenant-wide export of inbox rules including hidden rules, transport rules and, for Google Workspace, user filters. Microsoft's archived Get-AllTenantRulesAndForms.ps1 script is read only; its page says to remove lines 154 to 158 because that connection method was deprecated in July 2023.
- Review the baseline: sort by the suspicious patterns table, starting with high-value mailboxes. Treat any confirmed malicious rule as an account compromise (see response below).
- Deploy detections in alert-only mode (weeks 2 to 4): start with detections 3, 5 and 6 (low volume, high value), then add keyword and risky sign-in correlation. Tune keyword lists against the baseline.
- Schedule the inventory: our recommendation is a daily diff for high-value mailboxes and a weekly diff for everyone else, alerting on new rules that match the suspicious patterns.
- Roll back safely: detections are read only, so rollback means disabling a noisy rule in the SIEM. Never bulk-delete rules from a baseline: disable suspect rules first so they can be restored if a user relied on them.
Responding to a hiding rule
Microsoft's compromised account guidance orders the response as: block sign-in, revoke sessions, review MFA methods, review consented applications, review admin roles, then review forwarding and inbox rules, then investigate. In practice:
- Preserve first: export the rule with
Get-InboxRule -Identity ... -IncludeHidden | Format-List, the audit record with its source IP and the contents of the destination folder before you change anything. The hidden messages are often the best evidence of what the attacker was protecting. - Contain the identity: block sign-in or reset the password, revoke sessions and refresh tokens, and remove attacker-added MFA methods and app consents. Removing the rule alone leaves the attacker able to recreate it.
- Disable, then remove:
Disable-InboxRulewhile you investigate, thenRemove-InboxRule. For mail flow rules, disable and record the full rule definition before deletion. - Read what was hidden: the destination folder shows which suppliers, banks, colleagues or security tools the attacker wanted silenced, and so who else to warn.
- Hunt sideways: search for the same IP, ISP, rule name or keyword set across the tenant. Rules with identical names in several mailboxes indicate a campaign.
For the full incident flow, see the Business Email Compromise Response Playbook and the Microsoft 365 Tenant Compromise Playbook.
Decision guidance
- Small organisation, no SIEM: rely on built-in alert policies, add a custom alert for New-InboxRule and UpdateInboxRules on finance and admin mailboxes, and run a monthly scripted inventory of all rules including hidden ones.
- Large SOC: stream audit data to the SIEM, build all seven detections, score rules by pattern and session risk, and automate disabling of rules that match the delete-all or security keyword pattern on high-value mailboxes after analyst approval.
- Hybrid Exchange: on-premises mailboxes need PowerShell logging on management servers and the same scheduled inventory, because cloud audit events do not cover them.
- Google Workspace: the filter inventory through the API is the primary control, supported by admin audit events for Gmail setting changes and the external forwarding event.
Detection and measurement
- Audit coverage: percentage of mailboxes where rule creation events from both web and desktop clients reach the SIEM. Target 100 percent.
- Inventory freshness: age of the latest rule inventory for high-value mailboxes. Target under 24 hours.
- Time to detect: median time from a test hiding rule being created to an alert, measured with a scheduled, authorised test.
- Unexplained mail flow rule changes: transport rule changes per month without a change record. Target zero.
- Linked response rate: share of confirmed malicious rules where sessions were revoked and the full identity review completed. Target 100 percent.
Common failure patterns
- Watching only New-InboxRule: rules made in the Outlook desktop client arrive as UpdateInboxRules and are missed.
- Deleting the rule and closing the ticket: the attacker still holds a session, token or app consent and recreates the rule the next day.
- Skipping hidden rules: reviewing rules in the Outlook interface or without
-IncludeHiddenleaves some rules unseen. - Ignoring organisation-wide rules: transport rules are reviewed as mail routing configuration, not as a security control, so a DeleteMessage rule targeting incident notification subjects goes unnoticed.
- Single-channel alerting: vendor security alerts that go only to one analyst's mailbox can be hidden by one rule, as Scattered Spider did.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| MITRE ATT&CK v20 | T1564.008, M1047 Audit | Technique and mapped mitigation |
| NIST CSF 2.0 | DE.CM-03, DE.CM-09, DE.AE-02, RS.MI-01 | Monitoring user and software activity, analysing events, containing incidents |
| NIST SP 800-53 Rev 5 | AU-2, AU-6, AU-12, SI-4, AC-6 | Event logging, review, generation, system monitoring, least privilege for mail flow administration |
Practitioner checklist
- Confirm New-InboxRule, Set-InboxRule, UpdateInboxRules and Set-Mailbox records reach the SIEM, tested from both web and desktop clients.
- Run a tenant-wide inventory of inbox rules including hidden rules, transport rules and Gmail filters, and review it against the suspicious patterns table.
- Alert on delete-all rules, low-visibility folder moves with mark as read, and security or finance keyword rules.
- Correlate new rules with risky or unfamiliar sign-ins in the hour before creation.
- Apply stricter monitoring to security, finance, executive and shared alert mailboxes.
- Treat every transport rule change with DeleteMessage, RedirectMessageTo, BlindCopyTo or DoNotAudit as a privileged change needing a change record.
- Send vendor security alerts to the SIEM or ticketing system as well as email.
- On a confirmed rule, preserve evidence, contain the whole identity, then disable and remove the rule.
- Scope any Gmail API inventory service account tightly and manage its key as a secret.
Standards and references
- MITRE ATT&CK: Hide Artifacts: Email Hiding Rules (T1564.008)
- Microsoft Learn: Alert classification for suspicious inbox manipulation rules
- Microsoft Learn: Audit log activities
- Microsoft Learn: Responding to a compromised email account
- Microsoft Learn: Detect and remediate Outlook rules and custom forms injection attacks
- Microsoft Learn: Mail flow rule actions in Exchange Online
- Google for Developers: Managing filters (Gmail API)
- IETF: RFC 5228 Sieve: An Email Filtering Language
Related NHI Mgmt Group resources: T1114 Email Collection Defensive Guide · Email Gateway and Message Trace Detection Guide · ATT&CK Stealth and Defense Impairment Tactics Guide · Account Takeover Response Playbook