Playbook ID: PB-IDP | Default severity: SEV-2 (escalate to SEV-1 the moment federation config, token-signing material, a directory-sync account, a Global Admin or Domain Admin assignment, or krbtgt is implicated) | Owner: Incident Commander
T1098 Account Manipulation).Consent to application carrying IsAdminConsent: True.krbtgt activity (T1556 Modify Authentication Process).Not this playbook: a single non-privileged SaaS takeover (14.3 PB-ATO); mailbox fraud and payment diversion (14.2 PB-BEC); a grant issued to a breached vendor's app (14.5 PB-SUPPLY); an admin abusing rights legitimately given (14.6 PB-INSIDER). If encryption is already running, 14.1 PB-RANSOM leads — but run this in parallel, because identity services are now a deliberate ransomware target, not collateral damage.
Every other playbook in this chapter assumes you can log in to fix things. This one does not. The console you would use to contain the attacker may be one the attacker also holds, and the chat channel where you would coordinate almost certainly single-signs-on through the thing you are about to declare untrustworthy. Plan the first hour assuming the adversary is reading over your shoulder.
Sophos found 79% of ransomware attacks began with an identity-based approach, despite 97% of victims having some MFA (Sophos 2026). Microsoft reports 97% of identity attacks are password attacks, and that phishing-resistant MFA blocks over 99% of them even when the attacker already holds valid credentials (MDDR 2025). So attackers stopped fighting the credential and started stealing what the credential produces: AiTM reverse-proxy kits capture the session token after genuine MFA completes (Group-IB), and vishing is now the #2 initial infection vector at 11% of Mandiant investigations (M-Trends 2026). MFA was not bypassed. It was made irrelevant. Nor are you racing someone typing — CrowdStrike measured eCrime breakout time averaging 29 minutes, fastest observed 27 seconds (CrowdStrike 2026 GTR).
The mistake teams make is nearly always the same: reset the password, watch the sign-in fail, write "contained" in the ticket. Microsoft is blunt about consented apps — "Normal remediation steps (for example, resetting passwords or requiring multifactor authentication (MFA)) aren't effective against this type of attack, because these apps are external to the organization" (illicit consent grants). A reset does not touch an OAuth grant, does not touch an application's own session cookie — "Microsoft Entra ID can't directly revoke a session token issued by an application" (revoke user access) — and does not touch an access token that, in a Continuous Access Evaluation session, lives up to 28 hours (CAE). It does lock out the real user, who calls the service desk, which tells the building something is wrong. Takeaway: the containment primitive here is revocation, not rotation — and rotation without revocation is worse than nothing, because it tips off the adversary while leaving them logged in.
| Role | Responsibility in this scenario |
|---|---|
| Incident Commander | Owns the trust-in-the-IdP call; approves every tenant-wide action; runs the out-of-band bridge. |
| Operations Lead | Sequences the containment burst; owns the cloud branches; confirms each action complete. |
| Identity Operations Lead | Holds break-glass; executes federation, token-signing, krbtgt and Tier-0 actions. Must not be someone whose own account is in scope. |
| Service Desk Lead | Freezes self-service and desk-initiated password and MFA resets; verifies exceptions out of band. |
| Communications Lead | Internal comms by phone, not email; owns the "do not discuss this in Teams or Slack" instruction. |
| Scribe | Timeline to the minute — the only evidence of when "awareness" arose for every regulatory clock. |
| Legal Liaison | Engages counsel before the first substantive assessment; opens legal hold; owns privilege. |
| Executive Sponsor | Authorises what stops the business: breaking federation, tenant-wide revocation, rebuild. |
**Step markers: EVIDENCE degrades or destroys evidence. TIP-OFF tips off the adversary.
| # | Action | Who | Done when | Evidence to capture |
|---|---|---|---|---|
| 1.1 | Declare, and stand up the out-of-band bridge first — phone plus a channel that does not authenticate against the suspect IdP. Not Teams, Slack or M365 mail. | IC | Roster acknowledged by voice | Declaration time, roster, channel |
| 1.2 | Start the append-only timeline; engage counsel and open legal hold. Holds are not retroactive. | Scribe / Legal Liaison | Timeline live; hold confirmed in writing | Timeline (hashed), hold notice, custodian list |
| 1.3 | Deconflict against change records. Time-box: 15 minutes. | Ops Lead | Match found, or absence confirmed | Ticket ID, or written "no matching change" |
| 1.4 | Export logs before touching anything: Entra audit and sign-in, Purview UAL, CloudTrail, Workspace admin/login/OAuth-token, GCP Admin Activity. | Ops Lead | Export hashed, held outside the affected tenant | Manifests, SHA-256 hashes, time ranges, exporter |
| 1.5 | Diff every privileged role assignment — including eligible assignments and nested groups — against the last known-good baseline. | Identity Ops Lead | Diff reviewed | Assignment export, diff, baseline date |
| 1.6 | Inventory federation config and token-signing material for every verified domain, plus app registrations and service principals with credentials added in the window. | Identity Ops Lead | Compared to baseline | Config export, certificate thumbprints, credential-add records |
| 1.7 | Inventory OAuth grants tenant-wide, ConsentType = AllPrincipals first; pull risky users alongside. | Ops Lead | Permissions.csv triaged | The CSV, Consent to application records, risky-user output |
| 1.8 | Answer in writing: are normal administrative paths trustworthy? If no, everything downstream runs from break-glass on a hardened workstation. | IC | Decision recorded with reasoning | Written determination, time, concurrence |
# Needs Security Administrator + IdentityRiskEvent.Read.All + IdentityRiskyUser.ReadWrite.All.
# Confirming compromise is not cosmetic — it raises the user to high risk, itself a CAE critical event.
Connect-MgGraph -Scopes "IdentityRiskEvent.Read.All","IdentityRiskyUser.ReadWrite.All"
Get-MgRiskyUser -Filter "RiskLevel eq 'high'" | Format-Table UserDisplayName, RiskDetail, RiskLevel
Confirm-MgRiskyUserCompromised -UserIds "<id1>","<id2>"
# Tenant-wide OAuth grant inventory — Microsoft's documented method.
.\Get-AzureADPSPermissions.ps1 | Export-Csv -Path "Permissions.csv" -NoTypeInformationContainment here is one burst, not a series of tidy-ups. Contain piecemeal and, in Mandiant's words, "the responders 'tip their hand' to the attacker," who abandons the burned infrastructure and persists on footholds you never found (Aldridge, Remediating Targeted-threat Intrusions). Plan every step, then execute them together.
| # | Action | Who | Done when | Evidence to capture |
|---|---|---|---|---|
| 2.1 | Validate break-glass before anything else: excluded from every CA policy including Microsoft-managed ones, credentials retrievable without SSO, test sign-in succeeds. | Identity Ops Lead | Test sign-in succeeds from a hardened workstation | Sign-in log entry, exclusion list, custody record |
| 2.2 | **Freeze the service desk. TIP-OFF Suspend self-service reset and all desk-initiated MFA re-enrolment tenant-wide; exceptions need out-of-band manager verification. | Service Desk Lead | Freeze announced by phone and enforced in tooling | Freeze notice and time, exceptions granted |
| 2.3 | Write the burst as one ordered script and dry-run it. Nothing executes until 2.1 passes and the IC approves. | Ops Lead | Script approved | The script, reviewer, approval time |
| 2.4 | Execute — revoke sessions and reset credentials in the same action, every in-scope identity. Hybrid: on-prem AD first, reset twice, then Entra. | Identity Ops Lead | All identities processed; no partial state | Per-identity output, exact times, operator |
| 2.5 | Revoke malicious OAuth grants and app-role assignments; disable attacker-registered devices and MFA methods. A password reset reaches none of these. | Ops Lead | All re-enumerate as absent | Before/after inventories, removal records, device IDs |
| 2.6 | AWS: attach the quarantine SCP from the management account, then revoke role sessions and change permissions. Revocation alone is not containment. An SCP does not reach a principal in the management account or a service-linked role — contain those with an in-account deny. | Ops Lead | Sessions revoked, permissions denied, and CloudTrail shows an AccessDenied for the named principal. "Policy attached" is not done. | SCP and attach output, the denying CloudTrail event (principal, action, time), AWSRevokeOlderSessions policy with its timestamp |
| 2.7 | AWS: set compromised keys Inactive, not deleted. For federation, drop the offending client ID from the OIDC provider, or delete the provider if the trust is suspect. EVIDENCE export its config first. | Ops Lead | Keys inactive; OIDC trust scoped or removed | Key IDs, last-used data, provider ARN and config export |
| 2.8 | GCP: disable or delete the service account itself, not just its key — "Disabling a service account key does not revoke short-lived credentials that were issued based on the key" (Google). Workspace: signOut and revoke third-party tokens; signOut alone leaves grants working. | Ops Lead | Workloads stop authenticating; both Workspace calls succeed | Command output, SA email, client IDs revoked |
| 2.9 | Verify by observation: 60 minutes watching for new token issuance, sign-ins or API calls from every contained principal. | Ops Lead | 60 minutes clean, or re-scope to Phase 1 | Query results, window, analyst name |
# On-prem AD first. The password is reset twice to mitigate pass-the-hash under replication delay.
Disable-ADAccount -Identity johndoe
Set-ADAccountPassword -Identity johndoe -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "<random1>" -Force)
Set-ADAccountPassword -Identity johndoe -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "<random2>" -Force)
# Then Entra. Privileged Authentication Administrator is required for admin accounts.
Connect-MgGraph -Scopes "User.ReadWrite.All","Directory.AccessAsUser.All"
$User = Get-MgUser -Search UserPrincipalName:'johndoe@contoso.com' -ConsistencyLevel eventual
Revoke-MgUserSignInSession -UserId $User.Id # kills refresh tokens and browser session cookies
Update-MgUser -UserId $User.Id -AccountEnabled:$false
Get-MgUserRegisteredDevice -UserId $User.Id -All | ForEach-Object {
Update-MgDevice -DeviceId $_.Id -AccountEnabled:$false
}# Quarantine from OUTSIDE the compromised account: an SCP lives in the management account,
# so an attacker holding admin in the member account cannot detach it. The target may be
# a root (r-*), an OU (ou-*), or a 12-digit account ID — but attaching at the root does not
# widen the blast radius to the management account. An SCP at any level, root included, has
# no effect on users or roles in the management account and no effect on service-linked
# roles. If the compromised principal is a management-account principal, this command
# attaches cleanly and contains nothing: use an in-account deny on that principal instead.
aws organizations attach-policy --policy-id p-examplepolicyid111 --target-id <account-or-ou-id>Then set each compromised key to Inactive with aws iam update-access-key — AWS's documented rotation sequence deactivates before deleting, and for a compromised key you want the usage history preserved. The revoke-sessions action attaches an inline policy named AWSRevokeOlderSessions to the role; the equivalent you can write yourself is a Deny * on * conditioned on aws:TokenIssueTime being earlier than the moment you chose.
| # | Action | Who | Done when | Evidence to capture |
|---|---|---|---|---|
| 3.1 | Remove attacker-created app registrations, service principals, federated credentials and secrets; rotate credentials on every legitimate registration holding privileged API permissions. | Identity Ops Lead | Inventory matches approved baseline | Before/after inventory, deletion records, rotation log |
| 3.2 | Restore federation config and token-signing material to verified known-good, or move affected domains to managed authentication. EVIDENCE export the attacker's config first. | Identity Ops Lead | Config matches signed baseline | Pre- and post-change exports, hashed |
| 3.3 | Reset krbtgt twice, at least 10 hours apart so the first fully replicates — the account holds a two-password history, so one reset leaves the original in place (CISA CM0050). | Identity Ops Lead | Both resets replicated | Reset times, repadmin confirmation |
| 3.4 | Reset every Tier-0 credential — Enterprise, Domain and Schema Admins, Server and Account Operators — plus AD trust and gMSA passwords (golden gMSA). | Identity Ops Lead | All rotated | Account and gMSA lists, times, custody records |
| 3.5 | Review AD CS certificate templates and issued certificates; revoke anything you cannot account for. | Identity Ops Lead | Templates match baseline | Template diff, CRL entries, issuance log |
| 3.6 | Remove attacker-created CA exclusions and named locations; restore policy from version control, report-only before enforcing. | Ops Lead | Policy set matches signed baseline | Policy diff, report-only results, enforcement time |
| 3.7 | Rebuild compromised cloud roles to least privilege rather than re-enabling them, using CloudTrail-driven policy generation as input. Keep hunting throughout. | Ops Lead | New policies deployed; 72 hours with no new indicators | Generated policies, hunt results, sign-off |
| # | Action | Who | Done when | Evidence to capture |
|---|---|---|---|---|
| 4.1 | Rotate every break-glass credential used during the incident; return to sealed custody. | Identity Ops Lead | New credentials sealed and logged | Custody form, rotation time, witness |
| 4.2 | Re-enrol privileged users onto phishing-resistant MFA (FIDO2/WebAuthn or PKI) from a verified device, in person or on video. Number matching is a push-fatigue mitigation, not the destination. | Identity Ops Lead | All privileged role holders re-enrolled | Enrolment records, verification method, verifier |
| 4.3 | Re-enable accounts in dependency order. Budget for Microsoft's documented lag: 15 minutes for SharePoint and Teams, 35–40 minutes for Exchange Online. | Ops Lead | Users confirm access by phone | Re-enable times, first sign-in per user |
| 4.4 | Restore in dependency order: clean network and out-of-band comms → identity → DNS/DHCP/PKI/NTP → secrets → core data services → applications → endpoints. | Ops Lead | Each tier validated before the next starts | Per-tier checklist, times, validator |
| 4.5 | Confirm backup systems authenticate out-of-band, not against the recovered IdP; test a restore using only those credentials. | Ops Lead | Restore succeeds on out-of-band credentials alone | Restore log, credential path, integrity check |
| 4.6 | Lift the freeze in stages under the new verification standard; monitor privileged sign-ins, consent grants, role assignments and federation changes. | Service Desk Lead | Freeze lifted; watch period ends clean | Lift time, updated runbook, detection list, sign-off |
| # | Action | Who | Done when | Evidence to capture |
|---|---|---|---|---|
| 5.1 | Blameless hotwash within 10 business days, with the timeline as the primary artefact. | IC | Findings recorded with owners and dates | Attendance, findings register |
| 5.2 | Establish root cause and enabling conditions — not just the initial vector, but the control that should have caught it. | Ops Lead | Root cause agreed and written | Root-cause statement, evidence references |
| 5.3 | Close the log gaps the investigation exposed: diagnostic settings to SIEM or storage, expanded audit actions, retention beyond default. | Ops Lead | Changes deployed and verified | Config before/after, verification query |
| 5.4 | Set a dated, owned plan to kill push and SMS MFA for privileged roles and enforce phishing-resistant MFA with no exception group. | Executive Sponsor | Plan approved with a date and named owner | Approved plan, date, owner, board minute |
| 5.5 | Convert the containment burst into a tested runbook; put the break-glass path on an exercise schedule. | Identity Ops Lead | Runbook merged; first exercise complete | Runbook version, exercise report, gaps |
| 5.6 | Move evidence to long-term retention under legal hold, chain of custody intact; close out regulatory filings. | Legal Liaison | Evidence archived; filings complete | Custody transfer records, retention period, filing confirmations |
Internal comms run by phone, not email — CISA is explicit that users of potentially compromised systems should be notified by phone, precisely to avoid tipping off an adversary reading the mailbox. The clocks here are triggered by what the identity plane gave access to, not by the identity compromise itself: personal data reached through a compromised admin account starts the GDPR Article 33 72-hour clock from awareness; a regulated service starts the NIS2 24-hour early warning and, for financial entities, DORA's 4-hour-from-classification clock; a public company opens the SEC materiality track immediately. If you federate to customers, or you are somebody's identity provider, downstream notification duties begin the moment federation integrity is in doubt. Chapter 15 holds every clock, recipient and template.
Automate freely — these gather and enrich, they do not act: log export and hashing, privileged-role diffing against baseline, OAuth grant inventory and AllPrincipals triage, risky-user enumeration, evidence snapshots, timeline assembly, paging the roster to the out-of-band bridge.
Automate behind a scoped, rate-limited gate: session revocation and credential reset for a single non-Tier-0 identity flagged by a confirmed high-risk detection, capped per hour, logged and reversible.
Require a named human approver, every time: tenant-wide revocation; any federation or token-signing change; deleting an OIDC provider (there is no disable operation, and "Deleting an OIDC provider does not update roles that reference it. Any attempt to assume such roles will fail"); attaching a quarantine SCP; disabling any account holding a privileged role; the krbtgt reset. The governing rule: automation may gather, enrich, correlate and recommend without approval; it may act only where the action is reversible, scoped and rate-limited. The documented failure mode of AI-assisted triage is worth quoting to your team — "the agent acts on a confident hallucination before a human sees it" (Panther). Here, the hallucination is "contained."