Lesson 14 of 19 · 22m
Identity Incidents: Sessions, Tokens & OAuth Grants
Respond to AiTM phishing, MFA fatigue, and consent-grant abuse — revoking sessions and service principals, not just resetting passwords.
The user reset their password, MFA is on, and the attacker is still in their mailbox. That's the identity-incident signature: the credential was never the thing being stolen. What gets stolen is a session — a token, a cookie, an OAuth grant — and resetting a password doesn't revoke any of them. Modern IR is identity IR; treat "we changed the password" as step zero, not the fix.
The theft chain, concretely
AiTM phishing. Evilginx and friends are reverse proxies, not fake sites: the victim logs into the real login.microsoftonline.com through the proxy, completes real MFA, and the proxy keeps the session cookie the real IdP just issued. Password resets don't touch it — the cookie is still valid. The only MFA class that resists this is phishing-resistant by construction: FIDO2/passkeys bind the assertion to the origin, so a proxied challenge fails. OTP and push MFA don't.
MFA fatigue. Not a technical attack at all: the attacker holds a password and spams push approvals until a tired user accepts one. The 2022 Uber breach ran exactly this loop against a contractor — approved at 02:00-ish after repeated pushes, then lateral movement through found credentials.
OAuth consent. The attacker doesn't need a login at all — they need a user to click "Accept" on an app consent. The grant is a servicePrincipal in the tenant with Mail.Read rights, surviving password resets and session revocation alike because it's an authorized relationship, not a session. Microsoft has documented illicit consent campaigns for years; the audit trail is Consent to application events in the Entra audit log. Enumerate both grant mechanisms, because they record differently: oauth2PermissionGrant objects are delegated consent — a user clicked Accept — while appRoleAssignment objects are application permissions an admin granted. Both mint a servicePrincipal the attacker can ride; only the first shows up in consent audit events. The scope that matters most in either is offline_access: it's what exchanges the grant for a refresh token that outlives the session.
Infostealer cookies. RedLine/Vidar-class stealers vacuum browser cookie stores; a session cookie replayed from an attacker IP is indistinguishable from the user's own tab. This is why impossible-travel alerts have gone quiet while account takeover hasn't — stolen sessions replay cleanly.
Scoping an identity incident
Work the Entra sign-in and audit logs along these axes:
- Session anomalies — same user, new ASN/geography, different user-agent,
TokenIssuerTypechanges. AiTM sessions often come from datacenter ASNs no employee uses. - Non-interactive sign-ins — token replay shows up here; the user "signed in" without a prompt.
- App consent and service principals — enumerate enterprise apps and their
oauth2PermissionGrants; anything granted in-window is suspect by default. - Mailbox persistence —
Get-InboxRulefor forwarding/deletion rules the user didn't create, plusSet-Mailboxforwarding SMTP addresses in the UAL. - New devices and auth methods —
registeredDeviceson the user and any freshly added authenticators; an attacker who owned a session often enrolls their own persistence. - On-prem — a Golden SAML needs the AD FS token-signing cert; a golden ticket needs
krbtgt. DCSync is detectable: directory-replication events (4662) requestingGet-Changes-Allfrom a non-DC account is a near-unique signature.
The response checklist that actually works
- Revoke sessions:
revokeSignInSessionsin Graph (orRevoke-AzureADUserAllRefreshToken) — kills refresh tokens so issued access tokens can't renew. - Reset the password — now it matters, because new sessions can't be minted.
- Re-enroll MFA — treat registered methods as burned; attackers who owned a session often add their own authenticator.
- Audit and remove OAuth grants — the consent is a separate revocation from every session control above.
- Kill persistence artifacts — mailbox rules, forwarding, added devices (
Get-MgUserRegisteredDevice), new auth methods on the account. - For AD compromise —
krbtgtreset twice (the password history keeps the old hash valid otherwise), and every DC's machine account reviewed before you call it clean.
Identity response is a sequence, not an event. Each step closes a different door the attacker still holds open.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
CVE-2025-62718: Critical Axios SSRF Vulnerability Explained
A critical SSRF flaw in Axios was used in a North Korean supply chain attack. Here's what it does and how to patch it today.
Attacks of UPS Devices are on the Rise warns CISA
Hackers have now begun to attack internet-connected universal power supply devices. They are targeting their control interfaces via multiple remote code execution vulnerabilities. In some of the cases, they changed the default usernames and passwords, according to an important advisory from the…
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.