Identity Investigation Playbook
Technical

Identity Investigation Playbook

by David Simpson · 2026-08-23
40 chapters 22,472 words ~90 min read English 51 reads

Practical investigation and response to identity-based cyber attacks

Table of Contents

Preview: OAuth 2.0 Authorization Code Flow

A short excerpt from “OAuth 2.0 Authorization Code Flow”. The full book contains 40 chapters and 22,472 words.

Overview


Could a valid authorization code be enough to take over an account? In OAuth 2.0, it can be when an attacker captures the code and defeats redirect URI validation. This reference covers the Token Trail Map: trace the authorization request, redirect, code exchange, and resulting tokens to determine whether redirect URI abuse caused account compromise.


Quick Reference


StageMethodEndpoint or artifactInvestigation value
Authorization`GET``/authorize`Identify client, redirect URI, scope, and user session
Code deliveryBrowser redirect`redirect_uri?code=...`Determine whether the code was exposed or altered
Token exchange`POST``/oauth/token`Confirm code redemption and client authentication
Refresh`POST``/oauth/token`Identify persistence after initial takeover
Revocation`POST``/oauth/revoke`Invalidate refresh and access tokens

Parameters


ParameterTypeRequiredDescription
`response_type`stringYesMust be `code`; reject implicit token delivery
`client_id`stringYesRegistered OAuth client identifier
`redirect_uri`URIYesMust exactly match the registered URI, including scheme, host, path, and port
`scope`stringYesRequested permissions; investigate unexpected privileged scopes
`state`stringYesUnpredictable request correlation value; prevents login-CSRF and response mix-up
`code_challenge`stringYesPKCE challenge derived from the verifier
`code_challenge_method`stringYesUse `S256`; reject `plain`
`code`stringYes at token exchangeShort-lived, single-use authorization code
`code_verifier`stringYes with PKCESecret value proving possession of the original client session

Code Example


bash
# Authorization request: exact redirect URI and PKCE are mandatory.
AUTH_URL="https://idp.example.com/authorize"
curl -G "$AUTH_URL" \
  --data-urlencode "response_type=code" \
  --data-urlencode "client_id=investigation-console" \
  --data-urlencode "redirect_uri=https://console.example.com/oauth/callback" \
  --data-urlencode "scope=openid profile email" \
  --data-urlencode "state=$(openssl rand -hex 32)" \
  --data-urlencode "code_challenge=BASE64URL_SHA256_VERIFIER" \
  --data-urlencode "code_challenge_method=S256"

# Exchange the captured code only at the registered token endpoint.
curl -sS -X POST https://idp.example.com/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=authorization_code' \
  --data-urlencode 'client_id=investigation-console' \
  --data-urlencode 'redirect_uri=https://console.example.com/oauth/callback' \
  --data-urlencode 'code=AUTHORIZATION_CODE' \
  --data-urlencode 'code_verifier=ORIGINAL_VERIFIER'

For an incident, compare authorization and token-exchange timestamps, source IPs, user agents, client IDs, and redirect URIs. A code redeemed from a different network or device within its validity window is a high-value correlation.


Response Format


json
{
  "access_token": "redacted",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "redacted",
  "scope": "openid profile email"
}

`access_token` authorizes API calls. `refresh_token` may preserve access after the original code expires. `expires_in` is the lifetime in seconds. Do not place tokens in URLs, browser history, referrer headers, or incident tickets.


Notes & Best Practices


About this book

"Identity Investigation Playbook" is a technical book by David Simpson with 40 chapters and approximately 22,472 words. Practical investigation and response to identity-based cyber attacks.

This book was created using Inkfluence AI, an AI-powered book generation platform that helps authors write, design, and publish complete books. It was made with the AI Documentation Generator.

Frequently Asked Questions

What is "Identity Investigation Playbook" about?

Practical investigation and response to identity-based cyber attacks

How many chapters are in "Identity Investigation Playbook"?

The book contains 40 chapters and approximately 22,472 words. Topics covered include OAuth 2.0 Authorization Code Flow, OIDC ID Token Validation, SAML Assertions and Audience, Kerberos Ticket Lifecycle Checks, and more.

Who wrote "Identity Investigation Playbook"?

This book was written by David Simpson and created using Inkfluence AI, an AI book generation platform that helps authors write, design, and publish books.

How can I create a similar technical book?

You can create your own technical book using Inkfluence AI. Describe your idea, choose your style, and the AI writes the full book for you. It's free to start.

Write your own technical book with AI

Describe your idea and Inkfluence writes the whole thing. Free to start.

Start writing

Created with Inkfluence AI