🔴 Identity Security · Penetration Testing Perspective

Entra ID Conditional Access —
The Gaps Attackers Look For

From an admin who's built and reviewed CA policies in enterprise tenants — common bypass conditions and how to build policies that actually hold under pressure.

May 2026 ~14 min read Updated · October 2026
⚠️

Updated October 2026: Microsoft has finished closing the OIDC enforcement gap (Gap 03), but tenants that opted out are still exposed. Gap 01 now focuses on SMTP AUTH, where Basic auth is disabled by default at the end of December 2026. The baseline adds a user-risk policy, because the legacy Identity Protection risk policies retired on October 1, 2026.

Most organizations believe they are protected once Conditional Access is enabled. The board gets a reassuring slide: "MFA deployed, identity secured." That is a dangerous oversimplification. I've spent years building CA policies for enterprises and auditing them for the weak spots an attacker would look for. The gaps are predictable, consistent, and surprisingly easy to miss from the inside.

GAP 01
Legacy Auth Protocols
CRITICAL
GAP 02
Unmanaged Exclusion Groups
CRITICAL
GAP 03
OIDC Scope Bypass (Fixed 2026)
CRITICAL
GAP 04
Device Compliance Spoofing
HIGH
GAP 05
Token Lifetime & Session Gaps
HIGH
GAP 06
Report-Only Policies Never Enforced
HIGH
01
Authentication Protocols

Legacy Authentication — MFA's Blind Spot

Legacy authentication protocols — SMTP AUTH, IMAP, POP3, Exchange ActiveSync over Basic auth — authenticate with username and password only. They can't process an MFA challenge, so Conditional Access can only block them, never challenge them.

In Exchange Online, Microsoft turned off Basic auth for IMAP, POP, ActiveSync and EWS back in October 2022, so the classic IMAP password spray no longer works there. The big exception is SMTP AUTH (client submission): Basic auth still works in tenants that haven't switched it off. Microsoft will disable it by default at the end of December 2026 and plans to announce final removal in the second half of 2027. Legacy auth also still matters for hybrid on-premises Exchange and third-party apps.

⚔️ Attack Path — Password Spray via SMTP AUTH
01
Attacker builds a list of valid usernames from LinkedIn and the company's email format
02
Runs a password spray against SMTP AUTH (smtp.office365.com:587) — one password attempt per account avoids lockout
03
A successful Basic auth login bypasses MFA entirely — unless a CA policy blocks legacy auth, nothing stops it
04
Attacker sends phishing or BEC email from a real internal mailbox — it passes SPF, DKIM and DMARC because it genuinely is your domain
⚠️

December 2026 deadline: When Microsoft disables SMTP AUTH Basic auth by default, anything still relying on it — printers, scanners, line-of-business apps — will stop sending mail. Find them now with the query below and move them to OAuth or a connector. Otherwise the quick fix under pressure will be to switch Basic auth back on.

Entra ID · KQL — Legacy Auth Sign-ins
# Log Analytics → Entra ID Sign-in logs
SigninLogs
| where ClientAppUsed in (
    "Exchange ActiveSync", "IMAP4", "POP3",
    "SMTP", "Other clients", "Authenticated SMTP"
  )
| where ResultType == "0"
| summarize LastSeen=max(TimeGenerated), Count=count()
    by UserPrincipalName, ClientAppUsed, AppDisplayName
| order by LastSeen desc

# Run for 30 days minimum before blocking
# Any result here = active legacy auth usage = active bypass risk
Entra Admin Center · CA Policy — Block Legacy Auth
# Entra ID → Conditional Access → Policies → New policy

Name:          "BLOCK — Legacy Authentication"
Users:         All users
Exclude:       Break-glass accounts only  ← keep this list SHORT

Target:        All resources
Conditions → Client apps:
  ☑ Exchange ActiveSync clients
  ☑ Other clients
  # Do NOT check modern auth boxes

Grant:         Block access
State:         Report-only  ← run 2 weeks, review, then enable

✦
02
Policy Exclusions

Exclusion Groups — The Unmaintained Backdoor

Every CA policy has an exclusion list — accounts or groups that bypass the policy entirely. In every mature tenant I've reviewed, these exclusion groups have grown silently over years. Break-glass accounts, service accounts, vendor accounts, VIP user requests, "temporary" exceptions that became permanent. In many cases, ex-employees or ex-contractors remain in these groups long after their accounts are otherwise disabled.

⚔️ Attack Path — Exclusion Group Abuse
01
Attacker compromises any Global Admin or Privileged Role Admin account
02
Enumerates CA policy exclusion groups via Microsoft Graph API
03
Adds a controlled account to the exclusion group — that account now bypasses all CA policies
04
Operates from the excluded account with no MFA, no device compliance, no location restrictions
⚠️

The real risk: Exclusion groups are rarely monitored. An attacker who adds a user to an exclusion group and removes themselves hours later may never be caught — unless you have an alert on group membership changes for CA-excluded groups.

PowerShell · Graph — Enumerate CA Exclusions
# List all CA policies and their exclusions
Connect-MgGraph -Scopes "Policy.Read.All"
Get-MgIdentityConditionalAccessPolicy | Select-Object DisplayName, State,
  @{N='ExcludedUsers';E={$_.Conditions.Users.ExcludeUsers}},
  @{N='ExcludedGroups';E={$_.Conditions.Users.ExcludeGroups}}

# Then for each excluded group, list members:
Get-MgGroupMember -GroupId "<GroupId>" | Select-Object DisplayName, UserPrincipalName

# Alert rule: Sentinel — Group membership change on CA exclusion groups
AuditLogs
| where OperationName == "Add member to group"
| where TargetResources[0].DisplayName in ("CA-Exclusions", "BreakGlass-Accounts")
| project TimeGenerated, InitiatedBy, TargetResources

✦
03
✅ Closed · Mid-2026

OIDC Scope Bypass — The Silent 2026 Fix

This is the gap most enterprise admins didn't know existed. When a CA policy targets "All resources" with at least one resource exclusion, and an application requests only low-privilege OIDC or directory scopes (openid, profile, email, User.Read), the policy was silently skipped entirely. No MFA prompt. No device compliance check. Nothing.

Your policy said "require MFA for all cloud apps." The reality was "require MFA for all cloud apps, except when an app requests only basic scopes and your policy has any resource exclusion." Most admins had no idea this was happening.

🚨

Who was affected: Any tenant with a CA policy targeting "All cloud apps" or "All resources" that had at least one resource exclusion configured — almost every mature enterprise tenant. Developer tools and vendor apps that request only OIDC scopes were bypassing those policies silently. Microsoft let tenants opt out of the fix, and tenants that opted out are still exposed.

⚔️ Attack Path — OIDC Scope Bypass
01
Attacker has valid credentials for a user in your tenant
02
Signs in through a custom or third-party app requesting only openid + profile + User.Read
03
Because your "All resources" policy has a resource exclusion (e.g., a legacy app), the OIDC sign-in bypasses the policy entirely
04
Attacker obtains a valid token without MFA or device compliance — confirming the password works and reading the user's profile through Microsoft Graph
Sentinel KQL — Sign-ins Where CA Was Not Applied
# Find sign-ins where Conditional Access was not applied
# These may have been bypassing your policies via OIDC scope gap
SigninLogs
| where ConditionalAccessStatus == "notApplied"
| where AuthenticationRequirement == "singleFactorAuthentication"
| where TimeGenerated > ago(30d)
| summarize Count=count(), LastSeen=max(TimeGenerated)
    by UserPrincipalName, AppDisplayName, ClientAppUsed
| order by Count desc

# High count + singleFactor + notApplied = was bypassing your policy
# Since the rollout, these should show CA applied — if not, check for an opt-out
💡

Silver lining: Your existing "All resources" CA policies now actually enforce what you intended. Use the change as a prompt for a full CA audit — especially any exclusions added in a hurry to unbreak apps.


✦
04
Device Compliance

Device Compliance Spoofing

CA policies requiring "compliant device" rely on Intune's verdict, and that verdict is only as strong as the settings behind it. Two weaknesses show up again and again: the tenant-wide setting "Mark devices with no compliance policy assigned as" left at its default of Compliant, and compliance policies that check little more than OS version.

An attacker with a user's credentials registers or enrolls a device they control. If any user can register devices, and the device lands outside the scope of your compliance policies, or those policies only check OS version, it can be marked compliant without BitLocker, Secure Boot or antivirus. A "require compliant device" grant then waves the attacker straight through.

🚨

Key insight: "Compliant device" in Intune means "Intune says this device meets your policies" — not "this device is actually secure." Device compliance is only as strong as your compliance policy configuration and your health attestation requirements.

Entra ID · Audit — Suspicious Device Registrations
# Entra ID → Monitoring → Audit logs
# Filter: Activity = "Register device", "Add device"
# Look for devices registered outside business hours or from unusual locations

AuditLogs
| where OperationName == "Register device"
| where TimeGenerated > ago(7d)
| extend DeviceName = tostring(TargetResources[0].DisplayName)
| extend RegisteredBy = tostring(InitiatedBy.user.userPrincipalName)
| project TimeGenerated, RegisteredBy, DeviceName, Result
| order by TimeGenerated desc

# Cross-reference: device registered + became compliant within same hour
# = suspicious enrollment flow — investigate manually

✦
05
Session Security

Token Lifetime & Session Control Gaps

Conditional Access protects the moment of authentication — not the lifetime of the session. A valid access token obtained before a CA policy was enforced, or before a risk event was detected, continues to work until it expires. This is why the February 2026 change from "Revoke MFA sessions" to "Revoke sessions" is significant — the old action only reset per-user MFA state. Existing tokens remained valid. Attackers with stolen tokens continued operating even after admins believed they had revoked access.

⚠️

February 2026 change: The new "Revoke sessions" action in Entra ID now invalidates all user sessions including MFA, regardless of whether MFA is enforced via CA or per-user policy. Make sure your IR playbooks reference the new control name. Note that it revokes refresh tokens and session cookies — access tokens already issued stay valid until they expire, unless the app supports Continuous Access Evaluation.

⚔️ Attack Path — AiTM (Adversary-in-the-Middle) Token Theft
01
Attacker sends phishing email with link to an AiTM proxy (e.g., Evilginx) that relays the real Microsoft sign-in page
02
Victim completes legitimate MFA through the proxy — attacker captures the session cookie and access token
03
Attacker replays the token — MFA is already satisfied, CA policies are bypassed
04
Attacker has full access until the token expires — typically 60–90 minutes for access tokens, up to 90 days for refresh tokens
Sentinel KQL — Token Replay Detection
# Same user, multiple IPs in short window — possible token replay
SigninLogs
| where TimeGenerated > ago(1h)
| summarize IPCount=dcount(IPAddress), IPs=make_set(IPAddress)
    by UserPrincipalName, CorrelationId
| where IPCount > 1
| order by IPCount desc

# Also monitor for: sign-in from IP with no prior history
# immediately followed by bulk mailbox access or file downloads

✦
06
Policy State

Report-Only Policies That Never Got Enforced

Every good CA deployment starts in Report-only mode — you monitor before you enforce. The problem is that in many tenants, policies stay in Report-only indefinitely. The "we'll enforce it after we review" becomes "we never reviewed." I've seen tenants with 12–15 CA policies in Report-only mode that have been sitting there for over a year, providing zero actual protection.

From an attacker's perspective, Report-only policies are invisible. They generate log entries, but they block nothing. An attacker who enumerates your CA policies via Graph API will immediately identify which policies are enforced vs report-only — and plan their access accordingly.

PowerShell · Graph — Enumerate Policy States
# Get all CA policies and their current state
Connect-MgGraph -Scopes "Policy.Read.All"
Get-MgIdentityConditionalAccessPolicy |
  Select-Object DisplayName, State, CreatedDateTime, ModifiedDateTime |
  Sort-Object State |
  Format-Table

# States: "enabled" | "disabled" | "enabledForReportingButNotEnforcing"
# Any policy in "enabledForReportingButNotEnforcing" = report-only = not blocking
# Review CreatedDateTime — policies older than 30 days in report-only need review

✦
07
Tooling

Detection & The What If Tool

Before you can fix gaps, you need to see them. Microsoft's built-in What If tool is underused. It lets you simulate any sign-in scenario and shows exactly which CA policies would apply — and which wouldn't.

PowerShell · Graph — Enumerate All Policies for Audit
# Full CA policy audit — export for review
Connect-MgGraph -Scopes "Policy.Read.All"
Get-MgIdentityConditionalAccessPolicy |
  Select-Object DisplayName, State, Conditions, GrantControls |
  Format-List

# Review output for:
# 1. Policies in "Report-only" → not enforced
# 2. Policies with broad exclusions → potential bypass
# 3. Cloud apps with zero CA coverage → unprotected resources
# 4. No policy targeting legacy auth client apps → legacy auth open

✦
08
Enterprise Baseline

CA Baseline That Actually Holds

Here is the minimum viable CA policy set for an enterprise tenant in 2026. Every policy should be tested in Report-only first, then enforced within 30 days.

Enterprise CA Policy Baseline · 2026
POLICY 1: BLOCK — Legacy Authentication
  Users: All · Exclude: Break-glass only
  Conditions: Other clients + Exchange ActiveSync
  Grant: Block

POLICY 2: REQUIRE — MFA for All Users
  Users: All · Exclude: Break-glass, service accounts (monitored)
  Apps: All resources
  Grant: Require authentication strength → Multifactor authentication

POLICY 3: REQUIRE — Phishing-Resistant MFA for Admins
  Users: All privileged roles (GA, PA, CA Admin, Exchange Admin...)
  Apps: All resources
  Grant: Require Authentication Strength → Phishing-resistant MFA
  Session: Sign-in frequency 1 hour

POLICY 4: REQUIRE — Compliant Device for Corporate Apps
  Users: All · Exclude: Break-glass
  Apps: Exchange Online, SharePoint, Teams
  Grant: Require compliant device OR Microsoft Entra hybrid joined device

POLICY 5: BLOCK — High-Risk Sign-ins
  Users: All · Exclude: Break-glass
  Apps: All resources
  Conditions: Sign-in risk = High
  Grant: Block  ← requires Entra ID P2

POLICY 6: REQUIRE — Secure Password Change for High-Risk Users
  Users: All · Exclude: Break-glass
  Apps: All resources
  Conditions: User risk = High
  Grant: Require authentication strength (MFA) + Require password change
  Session: Sign-in frequency = Every time
  ← replaces the legacy Identity Protection user-risk policy (retired Oct 1, 2026)

POLICY 7: REQUIRE — MFA Registration from Trusted Location
  Users: All
  Target resources: User actions → Register security information
  Conditions: Location = not named location
  Grant: Require MFA  ← prevents attacker registering their own MFA method
✅

Deployment rule: Never deploy a new CA policy in "On" mode directly. Always start in Report-only, review sign-in logs for 2 weeks, identify impacted service accounts and apps, add necessary exclusions — then enforce. One wrong click can lock out your entire organization including the C-Suite.

CA Is a Framework, Not a Finish Line

The gap between "Conditional Access enabled" and "identity secured" is enormous. Every policy has conditions, exclusions, and edge cases. Attackers don't need to break your encryption — they need to find the single sign-in flow you didn't account for.

The 2026 OIDC enforcement change is a reminder that even Microsoft's own platform had silent bypass conditions that persisted for years. Your job isn't to configure CA once and move on — it's to treat it as a living architecture that requires continuous review, monitoring, and testing.

Run the What If tool. Audit your exclusion groups. Check your Report-only policies. Then do it again next quarter. The attackers are checking.

Read next · More write-ups
Top 5 M365 Misconfigurations
Legacy auth, guest sprawl, missing DLP, over-privileged admins and email-auth gaps — each with detection and remediation.
12 min read
How I Passed the CLLMSP
A practitioner’s tour of the nine LLM-security domains, mapped to real enterprise AI and Copilot Studio deployments.
18 min read
Copilot Studio HR Agent from Scratch
End-to-end build: knowledge sources, topics, authentication, and Power Automate integration in a production agent.
15 min read
View all write-ups ↗