CyberAct
Publications/#Exchange Online
Tag

Exchange Online: Security & Attack Surface

Understanding Exchange Online

Definition

Exchange Online is Microsoft's cloud-hosted email and calendaring service, delivered as part of the Microsoft 365 platform. As Exchange Online handles authentication, mail flow, and delegation across entire organizations, it represents a high-value target in modern attack chains. Its attack surface extends well beyond simple phishing. Adversaries exploit Exchange Online through OAuth application consent abuse, legacy protocol authentication (IMAP, POP3, SMTP AUTH), over-permissioned service accounts, and misconfigured mail flow rules. Exchange Web Services (EWS) and the Microsoft Graph API expose mailbox data programmatically. A compromised mailbox in Exchange Online can pivot to broader tenant compromise via delegated permissions, shared calendars, and transport rules that silently redirect or copy messages. Exchange Online also integrates tightly with Azure Active Directory, meaning identity misconfiguration in one layer directly amplifies risk in the other. Understanding the architecture — connectors, accepted domains, anti-spam policies, and retention holds — is foundational for both offensive assessments and defensive posture reviews in any Microsoft 365 environment.

Detection (Blue Team / SOC)

Detection in Exchange Online relies on Unified Audit Log (UAL) events ingested via Microsoft Purview or forwarded to a SIEM such as Microsoft Sentinel. Key event types to monitor include 'MailboxLogin' with legacy authentication protocols (AuthenticationMethod containing 'BasicAuth'), 'Set-InboxRule' and 'New-InboxRule' operations that forward or delete messages, and 'Add-MailboxPermission' granting FullAccess or SendAs rights. OAuth consent events ('Add app role assignment to service principal') in Azure AD logs indicate potential application-based access. EWS and Graph API access appear under 'MailItemsAccessed' (enabled by E5 or Compliance add-on). Analysts should alert on inbox rules created by accounts that have never previously configured them, forwarding rules pointing to external domains, and service principals accessing large volumes of mailboxes in short time windows. Message trace logs in the Exchange admin center complement UAL for mail flow anomaly investigation. Correlation between Azure AD sign-in logs and Exchange audit events is critical to distinguish legitimate admin activity from adversarial access using stolen tokens or OAuth-granted permissions.

Exploitation & countermeasures (Red Team)

Red Team operators target Exchange Online through several distinct techniques. Token theft via adversary-in-the-middle (AiTM) phishing frameworks such as Evilginx or Tycoon 2FA captures session cookies and bypasses MFA, granting direct mailbox access without credential knowledge. Legacy authentication abuse uses tools like MailSniper to enumerate mailboxes and harvest credentials over IMAP when Modern Authentication is not enforced. OAuth phishing ('illicit consent grant') tricks users into authorizing malicious Azure AD applications that receive persistent delegated Mail.Read or Mail.ReadWrite permissions. Once inside, operators use ROADtools, GraphRunner, or direct Microsoft Graph API calls to exfiltrate mailbox content, enumerate contacts, and create persistence via transport rules. Hardening measures include disabling legacy authentication through Azure AD Conditional Access policies, enforcing the 'Block Legacy Authentication' named location policy, restricting EWS client access, enabling Microsoft Defender for Office 365 with anti-phishing and Safe Links, auditing OAuth app permissions regularly, and enforcing tenant-wide external forwarding blocks via the outbound anti-spam policy ('AutoForwardingMode: Off'). Privileged Exchange roles such as Discovery Management and Organization Management must follow least-privilege principles with Privileged Identity Management (PIM) activation requirements.

Articles about Exchange Online

SOCM365 Persistence: Exchange Online Rules and Silent Email Exfiltration

After an M365 breach, attackers weaponize Exchange Online rules to silently exfiltrate emails. How to detect them through the Unified Audit Log?

Jun 30, 20266 min read