Detection rules › Panther
Microsoft Exchange External Forwarding
Detects when a user creates email forwarding rules to external organizations in Microsoft Exchange Online. This can indicate data exfiltration attempts, where an attacker sets up forwarding to collect emails outside the organization. The rule detects both mailbox forwarding (Set-Mailbox) and inbox rules (New-InboxRule). The detection includes: 1. External organization forwarding based on domain comparison 2. Suspicious forwarding patterns like: - Forwarding without keeping a copy - Deleting messages after forwarding - Stopping rule processing after forwarding 3. Multiple forwarding destinations 4. Various forwarding methods (SMTP, redirect, forward as attachment)
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence | T1137.005 Office Application Startup: Outlook Rules |
| Collection | T1114.003 Email Collection: Email Forwarding Rule |
| Exfiltration | T1020 Automated Exfiltration |
Rule body yaml
AnalysisType: rule
Description: >
Detects when a user creates email forwarding rules to external organizations in Microsoft Exchange Online.
This can indicate data exfiltration attempts, where an attacker sets up forwarding to collect emails outside
the organization. The rule detects both mailbox forwarding (Set-Mailbox) and inbox rules (New-InboxRule).
The detection includes:
1. External organization forwarding based on domain comparison
2. Suspicious forwarding patterns like:
- Forwarding without keeping a copy
- Deleting messages after forwarding
- Stopping rule processing after forwarding
3. Multiple forwarding destinations
4. Various forwarding methods (SMTP, redirect, forward as attachment)
DisplayName: "Microsoft Exchange External Forwarding"
Enabled: true
Filename: microsoft_exchange_external_forwarding.py
Reports:
MITRE ATT&CK:
- TA0003:T1137.005 # Persistence - Office Application Startup: Outlook Rules
- TA0009:T1114.003 # Collection - Email Collection: Email Forwarding Rule
- TA0010:T1020 # Exfiltration - Automated Exfiltration
Reference: https://learn.microsoft.com/en-us/microsoft-365/security/office-365-security/outbound-spam-policies-external-email-forwarding?view=o365-worldwide
Severity: High
Tags:
- Microsoft365
- Exchange
- Data Exfiltration
- Email Security
DedupPeriodMinutes: 60
LogTypes:
- Microsoft365.Audit.Exchange
RuleID: "Microsoft365.Exchange.External.Forwarding"
Threshold: 1
SummaryAttributes:
- userid
- parameters
- organizationname
Runbook: |
1. Investigate the forwarding configuration:
- Check if the forwarding is legitimate and approved
- Verify the destination addresses
- Review any suspicious patterns (deletion, no copy kept)
2. If unauthorized:
- Remove the forwarding rule
- Check for any data that may have been forwarded
- Review the user's recent activity
3. If authorized:
- Document the business justification
- Ensure it complies with security policies
- Monitor for any changes to the forwarding configuration
Tests:
- Name: External Organization Forwarding
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: homer.simpson@simpsons.onmicrosoft.com
- Name: ForwardingSmtpAddress
Value: smtp:peter.griffin@familyguy.com
- Name: DeliverToMailboxAndForward
Value: "False"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Internal Organization Forwarding
ExpectedResult: false
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: marge.simpson@simpsons.onmicrosoft.com
- Name: ForwardingSmtpAddress
Value: smtp:marge.simpson@simpsons.com
- Name: DeliverToMailboxAndForward
Value: "True"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Suspicious Forwarding Pattern
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: New-InboxRule
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: "Delete and Forward Rule"
- Name: Mailbox
Value: homer.simpson@simpsons.onmicrosoft.com
- Name: ForwardTo
Value: external@example.com
- Name: DeleteMessage
Value: "True"
- Name: StopProcessingRules
Value: "True"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Multiple Forwarding Addresses
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: New-InboxRule
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: "Multiple Forward Rule"
- Name: Mailbox
Value: homer.simpson@simpsons.onmicrosoft.com
- Name: ForwardTo
Value: "external1@example.com;external2@example.com;external3@example.com"
- Name: DeliverToMailboxAndForward
Value: "False"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Invalid Identity Format
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: Invalid/Path/Format
- Name: ForwardingSmtpAddress
Value: smtp:hello@familyguy.com
- Name: DeliverToMailboxAndForward
Value: "False"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Missing Organization Name
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: ""
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: ABC1.prod.outlook.com/Microsoft Exchange Hosted Organizations/simpsons.onmicrosoft.com/homer.simpson
- Name: ForwardingSmtpAddress
Value: smtp:hello@familyguy.com
- Name: DeliverToMailboxAndForward
Value: "False"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Subdomain Forwarding (Internal)
ExpectedResult: false
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: homer.simpson@simpsons.onmicrosoft.com
- Name: ForwardingSmtpAddress
Value: smtp:bart.simpson@springfield.simpsons.com
- Name: DeliverToMailboxAndForward
Value: "True"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Similar Domain Forwarding (External)
ExpectedResult: true
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: homer.simpson@simpsons.onmicrosoft.com
- Name: ForwardingSmtpAddress
Value: smtp:evil@simpsons2.com
- Name: DeliverToMailboxAndForward
Value: "True"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.com
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Non-Com TLD Organization
ExpectedResult: false
Log:
clientip: 1.2.3.4
creationtime: "2022-12-12 22:19:00"
externalaccess: false
id: 111-22-33
objectid: homer.simpson
operation: Set-Mailbox
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: Identity
Value: john@justice.org
- Name: ForwardingSmtpAddress
Value: smtp:bruce@justice.org
- Name: DeliverToMailboxAndForward
Value: "True"
recordtype: 1
resultstatus: "True"
userid: john@justice.org
userkey: "12345"
usertype: 2
workload: Exchange
- Name: Internal Forwarding with Suspicious Pattern
ExpectedResult: false
Log:
clientip: "1.2.3.4:10736"
creationtime: "2025-07-07 09:11:11.000000000"
externalaccess: false
id: 111-22-33
objectid: "ABC001.prod.outlook.com/Microsoft Exchange Hosted Organizations/simpsons.onmicrosoft.com/444-55-66\\Move GitHub emails"
operation: New-InboxRule
organizationid: 11-aa-bb
organizationname: simpsons.onmicrosoft.com
originatingserver: QWERTY (1.2.3.4)
parameters:
- Name: AlwaysDeleteOutlookRulesBlob
Value: "False"
- Name: Force
Value: "False"
- Name: MoveToFolder
Value: "MYFolder"
- Name: Name
Value: "Move emails to another folder"
- Name: FromAddressContainsWords
Value: "specialsender"
- Name: StopProcessingRules
Value: "True"
recordtype: 1
resultstatus: "True"
userid: homer.simpson@simpsons.onmicrosoft
userkey: homer.simpson@simpsons.onmicrosoft
usertype: 2
workload: Exchange
Detection logic
Condition
operation in ["Set-Mailbox", "New-InboxRule"]
This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
operation | in |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
operation | Operation |
organization_id | OrganizationId |
client_ip | ClientIp |
extended_properties | ExtendedProperties |
modified_properties | ModifiedProperties |
application | Application |
actor | Actor |
userid |