Identity & access
Identity & Access Management
Most breaches are not exploits — they are logins. Identity is the real perimeter: authenticate who someone is, authorize what they may do, and re-check both on every request. This lesson walks from AuthN-vs-AuthZ to OAuth/OIDC, SAML/SSO, sessions, MFA strength, authorization models, the ATT&CK identity-attack catalog, and the breaches that prove it.
The ten pillars of identity security
From the AuthN/AuthZ foundation to a defense-in-depth hardening checklist — each grounded in real standards, technique IDs, and incidents.
01
Authentication vs Authorization (AuthN vs AuthZ) — the foundation
Key points
- Authentication (AuthN) answers 'who are you?' — proving an identity by something you know (password), have (token/phone), or are (biometric). Authorization (AuthZ) answers 'what are you allowed to do?' — deciding whether an already-authenticated principal may perform an action on a resource. They are distinct controls and are commonly conflated; a system can authenticate correctly yet authorize incorrectly (and vice versa).
- The order matters: authenticate first to establish a trustworthy subject, then authorize each request against policy. Authorization must be re-checked on every request server-side — never trust client-supplied role/permission claims or hidden form fields.
- Failure modes split cleanly: broken authentication (weak/absent identity proof) maps to OWASP A07:2021 and API2:2023; broken authorization (missing/incorrect access decision) maps to OWASP A01:2021, API1:2023 (BOLA/IDOR) and API5:2023 (function-level).
- Identity terminology to anchor the lesson: identity provider (IdP) asserts identity; relying party / service provider (RP/SP) consumes it; a subject/principal is the authenticated entity; a claim is an assertion about the subject; a scope/permission grants access. Standardized in OIDC and SAML vocabularies.
- Bilingual teaching note (TR): Kimlik Doğrulama (AuthN) = 'kimsin?'; Yetkilendirme (AuthZ) = 'ne yapabilirsin?'. The two are separate layers and both must be enforced server-side on every request.
References
OWASP A07:2021 Identification and Authentication Failures
OWASP A01:2021 Broken Access Control
OWASP API2:2023 Broken Authentication
OWASP API1:2023 Broken Object Level Authorization (BOLA)
OWASP API5:2023 Broken Function Level Authorization
CWE-287 Improper Authentication
CWE-285 Improper Authorization
CWE-862 Missing Authorization
CWE-863 Incorrect Authorization
NIST SP 800-63-3 Digital Identity Guidelines
02
OAuth 2.0 & OIDC — delegated authorization plus an identity layer
Key points
- OAuth 2.0 (RFC 6749) is an authorization framework for delegated access: a resource owner grants a client limited access to a resource server without sharing credentials, via an access token issued by an authorization server. OAuth 2.0 is NOT an authentication protocol on its own — using a raw OAuth access token to 'log a user in' is a classic anti-pattern.
- OpenID Connect (OIDC Core 1.0) is the identity layer built on top of OAuth 2.0: it adds an ID Token (a signed JWT per RFC 7519) containing authenticated-user claims (sub, iss, aud, exp, iat, nonce) and a standard UserInfo endpoint. OIDC is what you use for 'Sign in with…'.
- Token types and transport: bearer tokens are sent in the Authorization header (RFC 6750) and anyone holding one can use it — so they must be short-lived, scoped, and TLS-protected. Sender-constrained tokens bind the token to the client via mutual-TLS (RFC 8705) or DPoP proof-of-possession (RFC 9449) to defeat token theft/replay.
- Supporting endpoints/specs to mention: authorization-server metadata discovery (RFC 8414), token introspection (RFC 7662), token revocation (RFC 7009), dynamic client registration (RFC 7591), Pushed Authorization Requests / PAR (RFC 9126), and token exchange (RFC 8693). JWT validation pitfalls are governed by JWT BCP (RFC 8725).
- Security guidance is consolidated in RFC 9700 (BCP 240, 'Best Current Practice for OAuth 2.0 Security', published January 2025): mandates PKCE for all clients, exact redirect-URI matching, dropping the implicit and ROPC grants, and sender-constrained tokens. Note OAuth 2.1 is still an IETF draft (draft-ietf-oauth-v2-1), not yet an RFC — present it as 'in progress', do not cite it as a standard.
References
RFC 6749 The OAuth 2.0 Authorization Framework
RFC 6750 OAuth 2.0 Bearer Token Usage
RFC 7519 JSON Web Token (JWT)
RFC 8725 JSON Web Token Best Current Practices
OpenID Connect Core 1.0 (OpenID Foundation)
RFC 8414 OAuth 2.0 Authorization Server Metadata
RFC 7662 OAuth 2.0 Token Introspection
RFC 7009 OAuth 2.0 Token Revocation
RFC 9126 OAuth 2.0 Pushed Authorization Requests (PAR)
RFC 8705 OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens
RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP)
RFC 9700 Best Current Practice for OAuth 2.0 Security (BCP 240)
03
OAuth 2.0 grant types / flows — when to use which
Key points
- Authorization Code + PKCE (the default for almost everything): browser/SPA/native client redirects the user to the AS, receives a one-time code on the redirect URI, then exchanges it server-to-server for tokens. PKCE (RFC 7636) sends a code_challenge up front and a code_verifier at exchange, defeating the authorization-code interception attack on public clients. RFC 9700 now requires PKCE even for confidential web clients.
- Client Credentials grant (RFC 6749 §4.4): machine-to-machine, no user present. The client authenticates with its own credentials (secret, or better mTLS / private_key_jwt) to obtain a token representing itself. Use for backend services and cron jobs; scope tightly and rotate secrets.
- Device Authorization Grant (RFC 8628): for input-constrained devices (TVs, CLIs, IoT). The device shows a user_code + verification_uri; the user authorizes on a separate browser/phone while the device polls the token endpoint. Watch for device-code phishing — attackers initiate a device flow and trick a victim into approving it.
- Deprecated/avoid: the Implicit grant (tokens returned directly in the URL fragment) is removed by RFC 9700 because tokens leak via history, referrer and logs; the Resource Owner Password Credentials (ROPC) grant is also dropped because the client handles the user's raw password, breaking the delegation model and blocking MFA/federation. Teach these as 'recognize and replace'.
- Redirect-URI handling is the security crux of every redirect-based flow: require exact string matching (no wildcards/substring matching), bind the state parameter to the user session to prevent CSRF, and validate nonce in OIDC to prevent ID-token replay. Open-redirect + loose URI matching is a standard token-exfiltration path (CWE-601).
References
RFC 6749 §4.4 Client Credentials Grant
RFC 7636 Proof Key for Code Exchange (PKCE)
RFC 8252 OAuth 2.0 for Native Apps (BCP 212)
RFC 8628 OAuth 2.0 Device Authorization Grant
RFC 9700 Best Current Practice for OAuth 2.0 Security (BCP 240)
CWE-601 URL Redirection to Untrusted Site (Open Redirect)
OWASP API2:2023 Broken Authentication
04
SAML, SSO & federation — enterprise identity
Key points
- SAML 2.0 (OASIS standard, 2005) is an XML-based framework for exchanging authentication and authorization assertions between an IdP and an SP. The dominant pattern is Web Browser SSO with the HTTP-POST binding: the IdP issues a digitally signed SAML Assertion that the browser relays to the SP. It predates OIDC and remains pervasive in enterprise/B2B SSO.
- Single Sign-On (SSO) lets one authentication event grant access to many applications; federation extends trust across organizational boundaries (e.g., a partner’s IdP authenticating users into your SP). Benefits: fewer passwords, centralized MFA and revocation. Risk: the IdP becomes a single high-value point of failure — compromise it and every federated app falls.
- SAML's critical security dependency is XML signature validation. Misconfigured or buggy validators are vulnerable to XML Signature Wrapping (XSW), where attackers add a forged assertion while keeping the original signed element, and to comment-injection canonicalization bugs (the 2018 'SAML vulnerabilities' class) that let an attacker change the asserted user. Always validate the signature over the exact asserted element, pin the IdP certificate, and check Conditions (audience, NotBefore/NotOnOrAfter).
- Golden SAML is the federation-trust attack: an adversary who steals the IdP's token-signing private key (e.g., from an AD FS server) can forge arbitrary, validly-signed assertions for any user with any privileges — bypassing password and MFA entirely. This is exactly the technique used in the SolarWinds/UNC2452 intrusions. Maps to ATT&CK T1606.002 Forge Web Credentials: SAML Tokens.
- Related enterprise protocols to name for completeness: Kerberos (RFC 4120) for intra-domain SSO (with its own attacks — Kerberoasting T1558.003, Golden/Silver Ticket T1558.001/.002), and LDAP (RFC 4511) as the directory backend. Provisioning/de-provisioning across federated apps uses SCIM (RFC 7644).
References
OASIS Security Assertion Markup Language (SAML) v2.0
RFC 4120 The Kerberos Network Authentication Service (V5)
RFC 4511 Lightweight Directory Access Protocol (LDAP): The Protocol
RFC 7644 System for Cross-domain Identity Management (SCIM): Protocol
ATT&CK T1606.002 Forge Web Credentials: SAML Tokens
ATT&CK T1558.003 Steal or Forge Kerberos Tickets: Kerberoasting
ATT&CK T1558.001 Steal or Forge Kerberos Tickets: Golden Ticket
CWE-347 Improper Verification of Cryptographic Signature
05
Session management — cookies vs JWT, fixation, rotation, revocation
Key points
- Stateful sessions (server-side): the server stores session state and hands the client an opaque session ID in a cookie. Easy to revoke (delete server record), but requires shared session storage. Cookie hardening is mandatory: Secure (HTTPS-only), HttpOnly (no JS access — blocks XSS token theft), and SameSite=Lax/Strict (CSRF defense), plus the __Host- prefix to lock scope. Defined in RFC 6265 (and SameSite/prefixes in the 6265bis draft).
- Stateless sessions (JWT): a signed token carries claims so the server needn’t store state — scalable, but hard to revoke before expiry. Mitigate with short-lived access tokens + a rotating refresh token, a server-side denylist/’jti’ revocation list, and a token-version/’kill switch’ claim. Never put secrets in a JWT payload (it is signed, not encrypted, unless using JWE).
- JWT validation pitfalls (teach as concrete failures): the alg:none downgrade and the RS256→HS256 algorithm-confusion attack, where a server that trusts the header’s alg lets an attacker sign a forged token using the public key as an HMAC secret. The canonical instance is CVE-2015-9235 in the Node jsonwebtoken library (<4.2.2). Fix: pin an allowlist of algorithms server-side and verify iss/aud/exp. Governed by RFC 8725.
- Session fixation (CWE-384): if the server reuses a pre-authentication session ID after login, an attacker who planted that ID hijacks the session. Defense: always regenerate the session identifier on privilege change (login, role elevation). Pair with insufficient-expiration hardening (CWE-613): absolute + idle timeouts, and rotate refresh tokens on every use with reuse-detection.
- Revocation strategy is the hard part: support immediate global logout (invalidate all sessions for a user on password reset / compromise), bind sessions to client signals where feasible, and prefer sender-constrained tokens (DPoP/mTLS) so a stolen cookie/token cannot be replayed from another machine. Citrix Bleed (CVE-2023-4966) is the cautionary tale — a memory over-read leaked valid session tokens, letting attackers resume authenticated sessions and bypass MFA entirely.
References
RFC 6265 HTTP State Management Mechanism (Cookies)
CWE-384 Session Fixation
CWE-613 Insufficient Session Expiration
CWE-614 Sensitive Cookie in HTTPS Session Without Secure Attribute
CWE-1004 Sensitive Cookie Without HttpOnly Flag
CWE-352 Cross-Site Request Forgery (CSRF)
CWE-347 Improper Verification of Cryptographic Signature
CVE-2015-9235 jsonwebtoken algorithm confusion (RS256/HS256)
CVE-2023-4966 Citrix Bleed session-token disclosure
RFC 8725 JSON Web Token Best Current Practices
OWASP A07:2021 Identification and Authentication Failures
06
MFA types and their strength — the phishing-resistance ladder
Key points
- SMS / PSTN OTP — weakest factor. Vulnerable to SIM-swapping, number porting, and SS7/voice-network interception, and the code is phishable in real time. NIST SP 800-63B-4 formally classifies SMS/PSTN OTP as a RESTRICTED authenticator: if used, the verifier must check the number is bound to a physical device and warn users / plan migration. Use only as a fallback, never for privileged accounts.
- TOTP (RFC 6238, built on HOTP RFC 4226) — authenticator-app codes derived from a shared secret + time. Much stronger than SMS (no carrier in the loop), but still phishable: a real-time adversary-in-the-middle proxy (e.g., Evilginx-style) relays the 6-digit code to the legitimate site before it expires. Good baseline, not phishing-resistant.
- Push notifications — approve/deny prompts. Convenient but exposed to MFA fatigue / push-bombing: the attacker, already holding the password, spams prompts until the user taps ’approve’. Mitigate with number-matching, context display, and rate-limiting. This is ATT&CK T1621 Multi-Factor Authentication Request Generation.
- WebAuthn / FIDO2 passkeys — the gold standard, PHISHING-RESISTANT. A hardware-backed key pair is created per relying party; the private key never leaves the authenticator and signatures are cryptographically bound to the origin (RP ID), so a proxy on a look-alike domain cannot relay the assertion. FIDO2 = W3C WebAuthn (browser/RP API) + CTAP2 (authenticator protocol). Passkeys add cross-device syncing. Required for high assurance.
- Strength ladder to teach: SMS < email OTP < TOTP < push-with-number-matching < hardware OTP < WebAuthn/passkeys. Map to NIST AAL: AAL2 needs two distinct factors; AAL3 requires a hardware-based, phishing-resistant (verifier-impersonation-resistant) authenticator — i.e., WebAuthn/FIDO2 or PIV/smart card. Also note authenticator interception (T1111) and MFA-method-tampering (T1556.006) as bypass techniques.
References
RFC 6238 TOTP: Time-Based One-Time Password Algorithm
RFC 4226 HOTP: An HMAC-Based One-Time Password Algorithm
W3C Web Authentication (WebAuthn) Level 2
NIST SP 800-63B-4 Digital Identity Guidelines: Authentication
ATT&CK T1621 Multi-Factor Authentication Request Generation
ATT&CK T1111 Multi-Factor Authentication Interception
ATT&CK T1556.006 Modify Authentication Process: Multi-Factor Authentication
CWE-308 Use of Single-factor Authentication
07
Authorization models — RBAC vs ABAC vs ReBAC, least privilege, PAM
Key points
- RBAC (Role-Based Access Control): permissions are grouped into roles and roles assigned to users. Simple, auditable, and the workhorse of enterprise IAM (standardized as ANSI/INCITS 359 and the NIST RBAC model). Weakness: role explosion and coarse granularity when access depends on context or per-object relationships.
- ABAC (Attribute-Based Access Control): decisions are computed from attributes of the subject, resource, action, and environment via policy (e.g., 'allow if user.department == resource.owner.department AND time is business hours'). Highly expressive and context-aware; guided by NIST SP 800-162. Cost: policy complexity and harder auditing/'who-can-access-what' reasoning.
- ReBAC (Relationship-Based Access Control): decisions follow the graph of relationships between subjects and objects ('user is editor of document, which is in folder owned by org'). Popularized by Google Zanzibar; ideal for fine-grained, hierarchical sharing (docs, repos, multi-tenant SaaS). Often combined with RBAC/ABAC in practice.
- Least privilege & separation of duties: grant the minimum permissions needed, for the minimum time. Use Just-In-Time (JIT) elevation and time-bound access instead of standing admin rights; enforce separation of duties so no single identity can both initiate and approve sensitive actions. Failures map to CWE-269 (improper privilege management) and OWASP A01:2021. This mirrors NIST 800-207 Zero Trust (’never trust, always verify; least privilege per request’).
- Privileged Access Management (PAM): protect the keys to the kingdom — vault and rotate privileged credentials, broker sessions, record privileged activity, and require step-up phishing-resistant MFA for admin actions. ISO/IEC 27001:2022 Annex A controls A.8.2 (privileged access rights), A.5.15/A.5.18 (access control & access rights), A.5.16/A.5.17 (identity & authentication info) provide the governance baseline.
References
NIST RBAC model / ANSI INCITS 359-2012 Role Based Access Control
NIST SP 800-162 Guide to Attribute Based Access Control (ABAC)
NIST SP 800-207 Zero Trust Architecture
ISO/IEC 27001:2022 Annex A.8.2 Privileged Access Rights
ISO/IEC 27001:2022 Annex A.5.15 Access Control
CWE-269 Improper Privilege Management
CWE-266 Incorrect Privilege Assignment
CWE-639 Authorization Bypass Through User-Controlled Key (IDOR)
OWASP A01:2021 Broken Access Control
08
Identity attacks and their defenses — ATT&CK-mapped catalog
Key points
- Credential stuffing (T1110.004): automated replay of username/password pairs leaked in prior breaches against login endpoints, exploiting password reuse. Defenses: phishing-resistant MFA, breached-password screening (block known-compromised passwords), rate-limiting + lockout/throttling (against CWE-307), bot management/CAPTCHA, and credential-stuffing-aware anomaly detection. Related sub-techniques: password spraying T1110.003, password guessing T1110.001.
- MFA fatigue / request generation (T1621): with a valid password in hand, the attacker floods the user with push prompts until one is approved. Defenses: number-matching and contextual push (location/app shown), rate-limit and auto-deny after N prompts, move to WebAuthn/passkeys (no approvable prompt to spam), and alert on burst-of-MFA-requests. This is precisely how Lapsus$ breached Uber in 2022.
- Steal Application Access Token (T1528) & OAuth consent phishing: attackers trick a user into granting a malicious OAuth app broad scopes (the 'illicit consent grant' attack), or steal existing access/refresh tokens, to access mail/files via the API — no password, often surviving password resets. Defenses: admin consent workflows + app allow-listing, restrict user consent to verified publishers and low-risk scopes, monitor for anomalous token grants, and short token lifetimes with revocation. Token theft/replay also maps to Use Alternate Authentication Material (T1550.001).
- Valid Accounts (T1078) & token forgery: using legitimate credentials or forged tokens (Golden SAML, T1606.002; forged web cookies, T1606.001) to blend in as a trusted user — the hardest activity to detect because nothing is ’exploited’. Defenses: conditional access (device + location + risk), impossible-travel and behavior analytics, protect IdP token-signing keys in HSMs, and continuously evaluate sessions (Zero Trust). Sub-techniques include cloud accounts T1078.004 and default accounts T1078.001.
- Modify Authentication Process (T1556) & Account Manipulation (T1098): post-compromise persistence — registering attacker MFA devices, adding alternate cloud credentials/roles, or tampering with conditional-access policies. Defenses: alert on new MFA enrollment and credential/role additions to privileged accounts, protect AD FS / federation config, and enforce SoD on identity-admin actions. Also cover steal web session cookie (T1539) and adversary-in-the-middle (T1557) for real-time phishing-proxy bypass of TOTP/push.
References
ATT&CK T1110.004 Brute Force: Credential Stuffing
ATT&CK T1110.003 Brute Force: Password Spraying
ATT&CK T1621 Multi-Factor Authentication Request Generation
ATT&CK T1528 Steal Application Access Token
ATT&CK T1550.001 Use Alternate Authentication Material: Application Access Token
ATT&CK T1078 Valid Accounts
ATT&CK T1606.002 Forge Web Credentials: SAML Tokens
ATT&CK T1556 Modify Authentication Process
ATT&CK T1098 Account Manipulation
ATT&CK T1539 Steal Web Session Cookie
ATT&CK T1557 Adversary-in-the-Middle
CWE-307 Improper Restriction of Excessive Authentication Attempts
09
Real-world breaches — IAM lessons written in incidents
Key points
- Golden SAML in SolarWinds / UNC2452 (2020): after compromising on-prem AD FS, attackers stole the token-signing key and forged SAML assertions to access Microsoft 365 and cloud apps as any user, bypassing MFA. Lesson: federation trust is only as strong as the IdP signing-key protection; map to T1606.002 and protect keys in HSMs with alerting on AD FS access.
- Microsoft Storm-0558 (2023): a threat actor acquired a Microsoft consumer (MSA) signing key and forged authentication tokens to access Exchange Online/OWA mailboxes of ~25 organizations. Lesson: stolen signing keys = silent, MFA-proof token forgery; rotate and isolate signing keys, validate token issuer/audience strictly, and monitor for tokens that bypass interactive sign-in.
- Uber via Lapsus$ (2022): a contractor's credentials (from infostealer/purchase) plus MFA-fatigue push-bombing (T1621) got initial access; the attacker then found hardcoded admin credentials (CWE-798) in an internal script to reach the PAM/secrets system. Lesson: number-matching MFA stops fatigue, and secrets must never be hardcoded.
- 0ktapus / Scattered Spider (2022): a large SMS-phishing campaign harvested Okta credentials and real-time OTPs via fake login pages across 130+ orgs. Lesson: TOTP/SMS are phishable by AiTM proxies (T1557) — only origin-bound WebAuthn/passkeys are phishing-resistant. Okta's own October 2023 support-system breach (stolen session tokens from uploaded HAR files) reinforces: sanitize/rotate session tokens and treat support tooling as in-scope.
- Capital One (2019) — the authorization angle: SSRF reached cloud metadata and stole an over-privileged IAM role, exfiltrating 100M+ records. Lesson: least privilege on machine identities and tight role scoping limit blast radius even after an app is breached — the same least-privilege principle this lesson teaches for humans applies to workloads.
References
ATT&CK T1606.002 Forge Web Credentials: SAML Tokens
ATT&CK T1621 Multi-Factor Authentication Request Generation
ATT&CK T1557 Adversary-in-the-Middle
ATT&CK T1539 Steal Web Session Cookie
CWE-798 Use of Hard-coded Credentials
CWE-918 Server-Side Request Forgery (SSRF)
OWASP A07:2021 Identification and Authentication Failures
10
Standards, assurance levels & a defense-in-depth hardening checklist
Key points
- Assurance levels (NIST SP 800-63-3 / 800-63B-4): IAL = identity-proofing strength, AAL = authentication strength, FAL = federation assertion strength. Pick AAL by risk: AAL2 (two factors) for normal users, AAL3 (hardware, phishing-resistant authenticator) for admins and high-value transactions. Use these to justify why privileged accounts get passkeys/PIV, not SMS.
- Authentication hardening: phishing-resistant MFA (WebAuthn/passkeys) by default, breached-password screening and length-based password policy (NIST 800-63B: favor length, drop forced periodic rotation and composition rules), throttle/lockout against brute force (CWE-307), and verify-then-regenerate session IDs on login (CWE-384).
- Authorization hardening: enforce access checks server-side on every request (defeat BOLA/IDOR — CWE-639), default-deny, least privilege with JIT elevation, separation of duties, and continuous/Zero-Trust evaluation per NIST 800-207. Audit 'who can access what' regularly and revoke on role change.
- Token & session hygiene: short-lived access tokens + rotating refresh tokens with reuse detection; sender-constrained tokens (DPoP RFC 9449 / mTLS RFC 8705) to neutralize stolen-token replay; pin JWT algorithms (RFC 8725); Secure + HttpOnly + SameSite + __Host- cookies; global revocation/kill-switch on compromise.
- Lifecycle & governance: automate joiner-mover-leaver provisioning/de-provisioning with SCIM (RFC 7644) so access is removed promptly; protect privileged paths with PAM (vaulting, session recording, step-up auth); align to ISO/IEC 27001:2022 access-control controls (A.5.15–A.5.18, A.8.2, A.8.5 secure authentication). Log all identity events for non-repudiation and detection (OWASP A09:2021).
References
NIST SP 800-63B-4 Digital Identity Guidelines: Authentication and Authenticator Management
NIST SP 800-63-3 Digital Identity Guidelines
NIST SP 800-207 Zero Trust Architecture
RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP)
RFC 8705 OAuth 2.0 Mutual-TLS and Certificate-Bound Access Tokens
RFC 7644 SCIM Protocol
ISO/IEC 27001:2022 Annex A.5.15–A.5.18 / A.8.2 / A.8.5
CWE-307 Improper Restriction of Excessive Authentication Attempts
OWASP A09:2021 Security Logging and Monitoring Failures
See identity attacks end-to-end
Identity is where the kill chain begins. Trace how a stolen credential or forged token turns into full compromise across the attack paths.