# Auth Sso Integration Review

> Use when reviewing a single sign-on integration on an authorized engagement. Covers OIDC and OAuth authorization code flows, redirect URI validation, state and nonce and PKCE handling, token validation and storage, session binding across IdP and SP, and logout completeness mapped to OWASP guidance and testable with Burp Suite. Use when an app offers login with a third party identity provider or when SSO changes ship.

- Skill: `mizazhaider-ceh/auth-sso-integration-review` (Agent Skill)
- Install (CLI): `npx get-skill add mizazhaider-ceh/auth-sso-integration-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mizazhaider-ceh/auth-sso-integration-review/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: mizazhaider-ceh (https://skillmd.com/u/mizazhaider-ceh)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/mizazhaider-ceh/auth-sso-integration-review

---


A single sign-on integration has three parties that must agree: the
user, the identity provider (IdP), and the relying party or service
provider (SP). Most SSO flaws are agreement failures: the SP accepts
a redirect it should not, a code it should not, a token it should
not, or a session that belongs to someone else. This skill is a
review method for OIDC and OAuth based SSO on authorized engagements,
worked through with test accounts. SAML specific XML and signature
work lives in auth-saml-testing; passkey, MFA fatigue, and session
fixation deep dives live in the sub-skills under this skill.

## Quick Workflow

1. Map the integration: which IdP, which flow, which client type
   (confidential or public), which redirect URIs are registered,
   and which scopes are requested.
2. Capture a full login in Burp Suite: authorization request,
   callback, code exchange, token response, and the SP session
   that results.
3. Test redirect validation: exact match, path tricks, subdomain
   tricks, and open redirect chains off the callback.
4. Test request integrity: state, nonce, and PKCE, each removed,
   reused, and predicted in turn.
5. Test the code exchange: reuse, leakage, client authentication,
   and what happens when the code goes to the wrong client.
6. Test token validation: ID token signature, issuer, audience,
   expiry, nonce, and access token handling at the SP and APIs.
7. Test session binding: IdP session versus SP session, account
   linking, just in time provisioning, and privilege changes.
8. Test logout: front channel, back channel, and RP initiated
   logout, and whether each session actually dies.
9. Report each gap with the exact request sequence and the
   acceptance condition the SP failed to enforce.

## 1. Map the flow and capture a baseline

Do not start mutating until a clean login is recorded.

```bash
# Capture the authorization request as the browser sends it. Note
# every parameter before touching anything: client_id, redirect_uri,
# response_type, scope, state, nonce, code_challenge, and the IdP host.
# A clean baseline looks like this (values are placeholders):
# https://idp.example/authorize?client_id=sp-client
#   &redirect_uri=https%3A%2F%2Ftarget.example%2Fcallback
#   &response_type=code&scope=openid%20profile%20email
#   &state=STATE&nonce=NONCE
#   &code_challenge=CHALLENGE&code_challenge_method=S256
echo "Record: IdP host, client_id, redirect_uri, response_type, scope"
echo "Record: state, nonce, PKCE method, and the callback path"
```

```bash
# Inspect the callback request in Burp Suite: it should carry a
# code and the same state value. Exchange it only through the SP
# back channel on a confidential client, never from the browser.
curl -s -X POST 'https://target.example/callback' \
  -H 'Cookie: sp-session=BASELINE' | head -c 500
echo
echo "Baseline: one code, one state, one SP session cookie"
```

## 2. Redirect URI validation

Redirect validation is the highest value SSO test after token
validation, because a loose redirect leaks codes and tokens to an
attacker controlled host.

```bash
# Redirect probes, one authorization request each, all with a test
# account. Change only redirect_uri and watch where the IdP sends
# the code. Any code delivered to a host you control is a finding.
# 1. Exact registered URI (control, must work)
# 2. Registered URI with an added path segment
# 3. Registered URI with a trailing open redirect parameter
# 4. Subdomain of the registered host, if subdomains are not listed
# 5. Registered host with userinfo tricks, such as
#    https://target.example@attacker.example/callback
# 6. Scheme change, such as http instead of https on the same host
# 7. Wildcard abuse, when the IdP allows a wildcard pattern
curl -s -i 'https://idp.example/authorize?client_id=sp-client&redirect_uri=https%3A%2F%2Fattacker.example%2Fcallback&response_type=code&scope=openid&state=teststate' | head -20
```

Also test the SP side of the callback: after login, does the SP
redirect to a `next` or `returnTo` parameter without validation?
A valid SSO login chained to an open redirect is still an open
redirect, and it inherits the trust users place in the login flow.

```bash
# SP side redirect probe after a test login: try a callback with a
# next parameter pointing at an external host, and try the login
# page with a return URL parameter pointing at an external host.
curl -s -i 'https://target.example/login?next=https://attacker.example/' | grep -i '^location:' | head -3
curl -s -i 'https://target.example/callback?code=TEST&state=TEST&next=https://attacker.example/' | grep -i '^location:' | head -3
```

## 3. State, nonce, and PKCE

These three parameters each stop a different attack. Test each
one independently, because an app often implements two and misses
the third.

```bash
# State probes (CSRF protection for the login flow):
# 1. Remove state from the callback request entirely.
# 2. Reuse a state value from an earlier login.
# 3. Send a callback with a state value from another test account
#    session, to test login CSRF across accounts.
# 4. Check state entropy and binding: is it tied to the browser
#    session, or is any well formed value accepted?
curl -s -i 'https://target.example/callback?code=REALCODE&state=' | head -20
curl -s -i 'https://target.example/callback?code=REALCODE&state=REUSEDSTATE' | head -20
```

```bash
# Nonce probes (ID token replay protection):
# 1. Replay an old ID token at the SP and see whether nonce and
#    expiry are checked, using a token captured for a test account.
# 2. Request a login without a nonce and see whether the SP still
#    accepts the resulting ID token.
# 3. Swap the nonce between two test account logins.
python3 - <<'PY'
import base64, json
# Decode an ID token header and payload without verifying, only to
# inspect which claims are present before testing verification.
token = open('/tmp/id_token.txt').read().strip()
parts = token.split('.')
def b64d(s):
    return base64.urlsafe_b64decode(s + '=' * (-len(s) % 4))
print('Header:', json.loads(b64d(parts[0])))
print('Payload:', json.loads(b64d(parts[1])))
print('Check for: iss, aud, exp, iat, nonce, at_hash, sub')
PY
```

```bash
# PKCE probes (code interception protection, required for public
# clients and recommended for all):
# 1. Exchange a code without a code_verifier.
# 2. Exchange a code with a wrong code_verifier.
# 3. Exchange a code with a verifier from a different login attempt.
# 4. Check the challenge method: plain instead of S256 is weaker
#    and worth reporting when S256 was available.
curl -s -X POST 'https://idp.example/token' \
  -d 'grant_type=authorization_code&code=CODE&redirect_uri=https://target.example/callback' | head -c 500
echo
echo "A token issued without any verifier means PKCE is not enforced"
```

## 4. Code exchange and token handling

The authorization code is a short lived credential. Test how the
SP treats it, and how it treats the tokens that follow.

```bash
# Code handling probes:
# 1. Replay the same code twice: the second exchange must fail.
# 2. Exchange a code issued for one client_id at a different client.
# 3. Exchange a code after its expiry window, and after logout.
# 4. Look for the code in logs, Referer headers, browser history
#    URLs, and analytics requests: codes in URLs leak easily.
# 5. Check client authentication: a confidential client that
#    exchanges codes with no secret, or with a public secret, is
#    misconfigured.
curl -s -X POST 'https://idp.example/token' \
  -d 'grant_type=authorization_code&code=REUSEDCODE&redirect_uri=https://target.example/callback&client_id=sp-client&client_secret=SECRET' | head -c 500
echo
```

```bash
# ID token validation checklist, verified against a test token:
# - Signature verifies with the IdP JWKS, and only that JWKS.
# - iss matches the expected IdP issuer exactly, not a prefix.
# - aud matches this SP client_id, and azp is checked when present.
# - exp is enforced, and iat is not in the future beyond skew.
# - nonce matches the login request, when a nonce was sent.
# - sub is stable and is the account key, not the email alone.
# Test by tampering one claim at a time in a copy of the token and
# presenting it to the SP through its normal login path. Acceptance
# of a tampered claim is the finding, not the tampering itself.
python3 - <<'PY'
import base64, json
# Build a tampered copy for one claim at a time: change aud to a
# different client_id, re-encode the payload, and keep the original
# signature. A correct SP rejects it on signature alone.
token = open('/tmp/id_token.txt').read().strip()
h, p, s = token.split('.')
def b64d(x):
    return base64.urlsafe_b64decode(x + '=' * (-len(x) % 4))
def b64e(b):
    return base64.urlsafe_b64encode(b).decode().rstrip('=')
payload = json.loads(b64d(p))
print('Original aud:', payload.get('aud'))
payload['aud'] = 'other-client'
tampered = h + '.' + b64e(json.dumps(payload).encode()) + '.' + s
open('/tmp/id_token-tampered.txt', 'w').write(tampered)
print('Wrote tampered token with original signature')
PY
```

Access token handling deserves its own pass: does the SP send the
access token to the browser, store it in local storage, or pass it
to APIs that do not need it? Does each API validate audience and
scope, or accept any token from the IdP? Does token refresh rotate
the refresh token, and does refresh token reuse get detected and
revoke the whole family? Test refresh reuse with a test account:
refresh once, then replay the old refresh token. A second success
means reuse detection is missing.

## 5. Session binding and account linking

SSO creates two sessions: the IdP session and the SP session.
Bugs live in the gap between them.

```bash
# Session binding probes on test accounts:
# 1. Log in at the SP, log out at the IdP only, then use the SP
#    session: record whether it still works and for how long.
# 2. Log in at the SP, log out at the SP only, then start a new
#    SSO login: does the IdP session silently log the user back
#    in with no interaction, and is that the documented behaviour?
# 3. Change the email or identifier at the IdP and check whether
#    the SP account follows it, or keeps the old binding.
# 4. Link a second IdP account to an SP account and check whether
#    linking requires re-authentication and proof of both accounts.
curl -s 'https://target.example/api/me' -H 'Cookie: session=SPSESSION' | head -c 300
echo
```

Account linking and just in time provisioning need care: when the
SP creates an account from an IdP assertion on first login, what
prevents an attacker from pre-registering a victim identifier at
the IdP, or from claiming an existing SP account by matching on
email alone? Test with two test accounts where one shares an email
attribute with the other, and record whether the SP merges them,
creates a duplicate, or blocks the collision safely.

## 6. Logout completeness

```bash
# Logout probes:
# 1. RP initiated logout: after SP logout, is the IdP session also
#    ended when post_logout_redirect_uri is used, and is that URI
#    validated like a redirect URI?
# 2. Front channel logout: does the SP clear its session when the
#    IdP sends the logout signal through the browser?
# 3. Back channel logout: does the SP honour the back channel
#    logout token, validate it, and kill the right session?
# 4. After each logout type, replay the SP session cookie, the
#    access token, and the refresh token, and record which still work.
curl -s 'https://target.example/api/me' -H 'Cookie: session=OLDSESSION' | head -c 300
echo
curl -s 'https://target.example/api/me' -H 'Authorization: Bearer OLDACCESSTOKEN' | head -c 300
echo
```

## Edge cases

- Multiple IdPs: when an SP trusts several IdPs, test cross IdP
  confusion: a token or assertion from IdP-A presented through the
  IdP-B callback path, and account linking that merges identities
  across IdPs without proof.
- Native and mobile clients: custom scheme redirect URIs and
  claimed HTTPS links behave differently. A custom scheme that any
  app can claim leaks codes on a shared device.
- Silent authentication with prompt=none: useful for session
  checks, but an SP that treats a silent success as fresh
  authentication weakens step up flows.
- Scope creep: an SP that requests offline_access or broad scopes
  it never uses expands the blast radius of a token leak.
- Token storage in the browser: tokens in local storage are
  reachable from any script injection, while httpOnly cookies are
  not. Report storage choice alongside any script injection risk.
- IdP session lifetime versus SP session lifetime: a long IdP
  session silently re-authenticates a user at an SP long after the
  SP session was meant to die, which matters on shared machines.
- Error responses: IdP error codes such as access_denied and
  server_error should not leak internal detail, and the SP should
  not treat an error callback as a login.

## Key references

- OWASP Authentication Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html
- OWASP OAuth and OpenID Connect guidance: https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_for_Java_Cheat_Sheet.html
- OpenID Connect Core 1.0 specification: https://openid.net/specs/openid-connect-core-1_0.html
- OAuth 2.0 Security Best Current Practice: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics
- OAuth 2.0 Authorization Code flow, RFC 6749: https://datatracker.ietf.org/doc/html/rfc6749
- OpenID Connect RP Initiated Logout: https://openid.net/specs/openid-connect-rpinitiated-1_0.html

