Skip to content
Pwnversity
CLOUD-M365intermediate · 5 min · upd. 2026-10

Microsoft 365 and Entra ID

Microsoft 365 (Exchange Online, SharePoint, Teams, OneDrive) and Entra ID (formerly Azure AD) are the identity and productivity of most companies. They share the same directory as Azure (see Azure Pentesting), so compromising M365 can give access to Azure and vice versa. The vectors combine identity attacks (phishing, spraying, app consent) with abuse of collaboration features.

The attacker almost always starts without credentials: they enumerate the tenant, find valid users, and hunt for the weak authentication link (missing MFA, legacy protocols, password spraying, illicit consent). Once inside an account, they pivot to email, files, and Teams, enumerate the tenant from within, and look for escalation to privileged roles up to Global Administrator, which in turn allows elevation into the Azure plane. The final asset is control of the tenant (identity + data of the whole organization).

flowchart TD
    A[No credentials] --> B[Enumerate tenant and users]
    B --> C{Initial access}
    C -->|password spraying| D[User account]
    C -->|no MFA / legacy| D
    C -->|illicit consent| E[User tokens]
    D --> F[Email / files / Teams]
    F --> G[Enumerate tenant from inside]
    G --> H[Escalate to Global Admin]
    H --> I[Elevate into Azure: cloud-azure]
  • Entra ID: identity directory (users, groups, apps, roles). The key role is Global Administrator = full tenant control.
  • M365 workloads: Exchange Online (email), SharePoint/OneDrive (files), Teams (collaboration).

Entra ID is the same directory that governs Azure, hence the bridge between both worlds.

Ventana de terminal
# does the domain use M365/Entra? and tenant data
curl -s "https://login.microsoftonline.com/target.com/.well-known/openid-configuration" | jq .
# valid-user and tenant enumeration
o365spray --validate --domain target.com
# AADInternals (PowerShell): Get-AADIntLoginInformation, tenant info
# federation: managed or federated? (affects the authentication attack)
Ventana de terminal
# password spraying against M365 endpoints (see ad-spray)
o365spray --spray -U users.txt -p 'Summer2025!' --domain target.com
# MFASweep: which services do NOT require MFA? (MFA gaps)
# leaked credentials (see recon-personas / HIBP)
# illicit consent grant: malicious app requests permissions -> user consents -> tokens

The absence of MFA on some endpoint (or legacy protocols that bypass it) is the key finding for initial access.

  • Access to the victim’s email, files, and Teams.
  • Email forwarding rules (stealthy exfiltration / BEC).
  • Searching for secrets in email/SharePoint/OneDrive (passwords, documents).
  • Enumerate the tenant from inside (ROADrecon, AzureHound → see Azure Pentesting).
  • Internal phishing (from a legitimate account, with greater trust).
  • App/Service Principal with excessive permissions.
  • Illicit consent → tokens of more users.
  • Privileged Role Administrator role → Global Admin.
  • A Global Admin can elevate to control the Azure subscriptions (see Azure Pentesting).
  • Forwarding / inbox rules (BEC).
  • Add credentials to a Service Principal or app with permissions.
  • Register your own device or MFA method on the victim account.
  • Federation backdoors (AADInternals) → very stealthy, requires Global Admin.
  • MFA everywhere (Conditional Access); block legacy protocols (basic IMAP/POP/SMTP) that bypass MFA.
  • Block user consent to apps; review apps/Service Principals and their permissions.
  • PIM for privileged roles; minimum number of Global Admins; anomalous sign-in alerts.
  • Detection: new forwarding rules, consents, impossible sign-ins (Entra ID Protection, Defender for Office/Cloud Apps).
  • SPF/DKIM/DMARC (anti-spoofing, see Email Enumeration); anti-phishing training.
  • Does the domain use M365/Entra? tenant info (openid-configuration)
  • Enumerate valid users (o365spray/AADInternals)
  • Password spraying against M365 (Password Spraying)
  • MFASweep: endpoints without MFA / legacy protocols
  • Illicit consent grant (malicious app)
  • Post-compromise: email/files/forwarding rules
  • Enumerate tenant and escalate to Global Admin (Azure Pentesting)
  • Bridge to Azure and persistence