Preventing Account Compromise in Microsoft 365: MFA Enforcement and Auto-Forwarding Protection

📄 Article

Preventing Account Compromise in Microsoft 365: MFA Enforcement and Auto-Forwarding Protection

A common security incident in Microsoft 365 environments involves user account compromise due to weak authentication controls, particularly the absence of Multi-Factor Authentication (MFA). Attackers gain access through credential phishing or password spray attacks, then abuse mailbox auto-forwarding rules to exfiltrate data or send bulk spam emails.

This article outlines how to identify such compromises and implement Microsoft-recommended remediation steps — including enforcing MFA via Conditional Access and blocking external auto-forwarding at the tenant level.

🔍 Symptoms

⚠️ What You May Experience

  • Multiple suspicious sign-ins detected in Entra ID sign-in logs
  • Unfamiliar IP addresses and geographic locations in authentication logs
  • Sudden spike in outbound email volume from affected accounts
  • Inbox rules or mailbox forwarding configured to external recipients

🧠 Root Cause

Why accounts get compromised

  • Lack of Multi-Factor Authentication (MFA) — allows attackers to access accounts using stolen credentials alone
  • Malicious inbox rules or forwarding settings — created post-compromise to exfiltrate data or relay spam
  • No restriction on auto-forwarding — enables bulk email abuse without detection at the tenant level

⚠️ Attack Pattern

Attackers typically use credential phishing or password spray attacks to gain initial access, then configure persistence mechanisms — such as inbox forwarding rules — to maintain access and exfiltrate data silently.

🛠️ Step-by-Step Resolution

1

Identify Compromised Accounts (Microsoft Entra ID)

Review sign-in logs to detect suspicious authentication activity before taking remediation action.

✅ GUI Method — Microsoft Entra Admin Center

  • Navigate to Microsoft Entra Admin CenterSign-in logs
  • Filter by: Risky sign-ins and Unknown locations / IPs
  • Identify and note all affected user accounts
2

Enable MFA for All Users

Enforce MFA via Conditional Access — the Microsoft-recommended approach for all tenant sizes.

✅ GUI Method — Microsoft Entra Admin Center

  • Go to Microsoft Entra Admin CenterProtectionAuthentication Methods
  • For small tenants: enable Security Defaults
  • For larger tenants: configure a Conditional Access Policy — Require MFA for all users, exclude break-glass accounts
PowerShell — Microsoft Graph

Connect-MgGraph -Scopes "Policy.ReadWrite.ConditionalAccess","Directory.ReadWrite.All"

$policy = @{
    displayName = "Require MFA for All Users"
    state = "enabled"
    conditions = @{
        users = @{ includeUsers = @("All") }
    }
    grantControls = @{
        operator = "OR"
        builtInControls = @("mfa")
    }
}

New-MgIdentityConditionalAccessPolicy -BodyParameter $policy
3

Remove Malicious Inbox Rules and Forwarding

Clean up any forwarding rules or inbox rules created by the attacker post-compromise.

✅ GUI Method — Exchange Admin Center

  • Go to Microsoft 365 Admin CenterUsers
  • Select the affected user → MailManage email apps/settings
  • Remove any forwarding addresses and suspicious inbox rules
PowerShell — Exchange Online

Connect-ExchangeOnline

# Check forwarding
Get-Mailbox -Identity user@yourdomain.com | Select ForwardingSmtpAddress,DeliverToMailboxAndForward

# Disable forwarding
Set-Mailbox -Identity user@yourdomain.com -ForwardingSmtpAddress $null -DeliverToMailboxAndForward $false

# List inbox rules
Get-InboxRule -Mailbox user@yourdomain.com

# Remove suspicious rule
Remove-InboxRule -Mailbox user@yourdomain.com -Identity "YourRuleName"
4

Block External Auto-Forwarding at Tenant Level

Prevent any user from auto-forwarding emails externally by configuring an outbound anti-spam policy.

💡 Why This Matters

Without a tenant-level block, any compromised account can silently forward all received emails to an external address — a common data exfiltration technique.

PowerShell — Exchange Online

Connect-ExchangeOnline

# Create anti-spam outbound policy
New-HostedOutboundSpamFilterPolicy -Name "Block External Forwarding" -AutoForwardingMode Off

# Apply the policy
New-HostedOutboundSpamFilterRule -Name "Apply Block Forwarding Policy" -HostedOutboundSpamFilterPolicy "Block External Forwarding"
5

Reset Credentials and Revoke Sessions

Force a password reset and invalidate all active sessions for compromised accounts immediately.

PowerShell — Microsoft Graph

Connect-MgGraph -Scopes "User.ReadWrite.All"

# Reset password
Update-MgUser -UserId user@yourdomain.com -PasswordProfile @{
    Password = "TempP@ssword123!"
    ForceChangePasswordNextSignIn = $true
}

# Revoke all active sessions
Revoke-MgUserSignInSession -UserId user@yourdomain.com

✅ Expected Outcome

The user will be signed out of all devices and apps immediately. They will be required to set a new password on next sign-in and complete MFA registration before regaining access.

💡 Best Practices & Recommendations

  • Enforce MFA using Conditional Access for all users — apply stricter policies (phishing-resistant MFA) for admin accounts
  • Disable external auto-forwarding by default at the tenant level to prevent silent data exfiltration
  • Regularly monitor Entra ID sign-in logs and mailbox audit logs for anomalous activity
  • Implement Microsoft Defender for Office 365 anti-phishing and Safe Links policies for enhanced protection
  • Enable Mailbox Audit Logging to capture inbox rule creation and forwarding changes for all users

✅ Key Takeaway

The most effective defence against account compromise in Microsoft 365 is a two-layer approach: enforce MFA so stolen credentials alone cannot grant access, and block external auto-forwarding so that even a compromised account cannot be used to exfiltrate data silently.

📚 References & Further Reading

Leave a Comment

Your email address will not be published. Required fields are marked *