Skip to content

feat: add legacy-auth Conditional Access bypass scenario#14

Open
ChrisJr404 wants to merge 1 commit into
Semperis:mainfrom
ChrisJr404:feat/legacy-auth-ca-bypass-scenario
Open

feat: add legacy-auth Conditional Access bypass scenario#14
ChrisJr404 wants to merge 1 commit into
Semperis:mainfrom
ChrisJr404:feat/legacy-auth-ca-bypass-scenario

Conversation

@ChrisJr404
Copy link
Copy Markdown

Summary

Adds Scenario 7 – Legacy Loophole: When MFA Forgot the Side Door, a new Beginner-tier challenge that teaches the classic legacy-auth gap in Conditional Access. An MFA-only CA policy that does not also block legacy authentication leaves a real, regularly-exploited path past MFA, and this scenario lets defenders practice spotting it end-to-end.

What the lesson teaches

Conditional Access clientAppTypes is an allow-list, not deny-all. If a CA author leaves the policy scoped to browser + mobileAppsAndDesktopClients only (the modern-auth defaults), every legacy-auth path — Resource Owner Password Credentials (ROPC), IMAP, POP, SMTP AUTH, Exchange ActiveSync, "Other clients" — falls outside policy scope and is never challenged for MFA. An attacker holding a valid password can sign in via ROPC or SMTP AUTH and never see the MFA prompt.

Defender objectives

  • Audit existing Conditional Access policies for clientAppTypes coverage.
  • Apply Microsoft's Block legacy authentication Conditional Access template tenant-wide (learn.microsoft.com).
  • Use the Authentication Methods policy (and Exchange Online Set-CASMailbox / Set-OrganizationConfig) to disable basic auth per-protocol where business-justified (SMTP AUTH, POP, IMAP, MAPI, OAB, RPC, ActiveSync).
  • Filter sign-in logs on Client app == Other clients / IMAP4 / POP3 / SMTP / Exchange ActiveSync using the Microsoft-published "Sign-ins using Legacy Authentication" workbook before flipping the block.
  • For genuine legacy-auth use cases, scope the exclusion to a single SP / service account, not tenant-wide.

Red-team walkthrough summary

  1. Foothold as low-priv mail systems engineer (raj.patel).
  2. Recon the CA posture and notice the policy's clientAppTypes does not include exchangeActiveSync or other.
  3. Identify the messaging admin account (EntraGoat-admin-s7), still using a stale Helpdesk-reset password.
  4. Bypass the MFA requirement by sending a ROPC token request directly to https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token — ROPC is classified as "Other clients" and is unscoped by the policy.
  5. With the admin token, read onPremisesExtensionAttributes.extensionAttribute1 and recover the flag.

MITRE ATT&CK mapping

  • T1110.003 – Brute Force: Password Spraying (legacy-auth surface).
  • T1556.006 – Modify Authentication Process: Multi-Factor Authentication (CA misconfiguration leaves MFA path unenforced for legacy clients).
  • T1078.004 – Valid Accounts: Cloud Accounts.

Files added

  • scenarios/EntraGoat-Scenario7-Setup.ps1 – provisions the vulnerable CA policy + admin account.
  • cleanups/EntraGoat-Scenario7-Cleanup.ps1 – removes the policy + users.
  • solutions/EntraGoat-Scenario7-Solution.ps1 – step-by-step walkthrough with defender remediation checklist.
  • frontend/public/scripts/challenge7/{setup,cleanup}.ps1 – Web UI mirrors of the scenario scripts.

Files modified

  • EntraGoatGUI/Data/Challenges.ps1 – register challenge 7 (PowerShell GUI).
  • frontend/src/App.js – register challenge 7 (Web UI default state).
  • README.md, docs/challenges.md – add the new row to the scenario tables.

Prerequisites

  • Microsoft Entra ID P1 (or higher) — Conditional Access requires P1.
  • Test/trial tenant with Global Administrator (matches the existing scenario prereqs).
  • Microsoft.Graph PowerShell SDK, including Microsoft.Graph.Identity.SignIns for the CA cmdlets.

Notes

  • Setup follows the same patterns as Scenarios 1–6 (UPN convention EntraGoat-admin-s7@<tenant>, flag in extensionAttribute1, ===== separator, Write-Host colour scheme, optional -Verbose output).
  • PSScriptAnalyzer on the new files surfaces the same baseline rule classes (PSAvoidUsingWriteHost, PSAvoidUsingPlainTextForPassword) as the existing scenarios — no new rule classes were introduced.
  • Implements EntraGoat scenario suggestion: legacy-auth Conditional Access bypass.

Test plan

  • Run scenarios/EntraGoat-Scenario7-Setup.ps1 against a P1 trial tenant and verify the CA policy is created with clientAppTypes = browser, mobileAppsAndDesktopClients only.
  • Walk the solution: ROPC token request returns an access token for EntraGoat-admin-s7 with no MFA prompt.
  • Confirm onPremisesExtensionAttributes.extensionAttribute1 returns the flag.
  • Run cleanups/EntraGoat-Scenario7-Cleanup.ps1 and verify the CA policy + both users are gone.
  • Smoke-test that adding the Microsoft "Block legacy authentication" CA template breaks the bypass (defender remediation works).

Adds a Beginner-tier scenario that teaches the classic legacy-auth gap
in Conditional Access. The setup script provisions a CA policy that
requires MFA for all users on all cloud apps, but with clientAppTypes
scoped to browser + modern desktop/mobile only. exchangeActiveSync and
'other' (ROPC, IMAP, POP, SMTP AUTH) are silently out of scope, so the
target admin account is reachable via legacy auth without an MFA
prompt. The walkthrough recovers the flag via a ROPC token request to
the v2.0 token endpoint.

Defender takeaway: an MFA-only Conditional Access policy without
'Block legacy authentication' (or per-protocol disable via
Authentication Methods / Set-CASMailbox) leaves the side door open.

Files:
- scenarios/EntraGoat-Scenario7-Setup.ps1
- cleanups/EntraGoat-Scenario7-Cleanup.ps1
- solutions/EntraGoat-Scenario7-Solution.ps1
- frontend/public/scripts/challenge7/{setup,cleanup}.ps1
- EntraGoatGUI/Data/Challenges.ps1: register challenge 7
- frontend/src/App.js: register challenge 7
- README.md, docs/challenges.md: list new scenario

Requires Entra ID P1 (Conditional Access).
@apiiro
Copy link
Copy Markdown

apiiro Bot commented May 5, 2026

WORKFLOW-1 · PR Annotation (Risks)

Policies: "Secret with unknown validity in public, applicative code added"

Secrets

Repository: EntraGoat

View in Apiiro

Copy link
Copy Markdown

@orca-security-us orca-security-us Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant