Skip to content

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, TokenIssuerType changes. 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-InboxRule for forwarding/deletion rules the user didn't create, plus Set-Mailbox forwarding SMTP addresses in the UAL.
  • New devices and auth methods — registeredDevices on 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) requesting Get-Changes-All from a non-DC account is a near-unique signature.

The response checklist that actually works

  1. Revoke sessions: revokeSignInSessions in Graph (or Revoke-AzureADUserAllRefreshToken) — kills refresh tokens so issued access tokens can't renew.
  2. Reset the password — now it matters, because new sessions can't be minted.
  3. Re-enroll MFA — treat registered methods as burned; attackers who owned a session often add their own authenticator.
  4. Audit and remove OAuth grants — the consent is a separate revocation from every session control above.
  5. Kill persistence artifacts — mailbox rules, forwarding, added devices (Get-MgUserRegisteredDevice), new auth methods on the account.
  6. For AD compromise — krbtgt reset 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?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.