Skip to content

Field manual · BAC · Chapter 3

The Session & Token Foundry

Stealing better badges

1 min readBroken Access Control

Chapter 3: the session and token foundry: stealing better badges

Section titled “Chapter 3: the session and token foundry: stealing better badges”

Why care: a check on the right endpoint is still broken if the token that proves identity can be forged. Vertical escalation often lives in how identity is transported, not in endpoints.

Cookie: session=eyJ1c2VySWQiOjg4NDIsInJvbGUiOiJ1c2VyIn0= ← base64!
base64 -d → {"userId":8842,"role":"user"}

If you find an unsigned, base64-encoded session cookie, decode it, change the role field, and re-encode it to test privilege escalation. Even signed JWTs frequently carry exploitable role bugs (below).

A JWT (JSON Web Token) is a rich source of BAC bugs. Each of these lets you forge or change the role a token claims: alg:none, weak HMAC secrets, RS256-to-HS256 key confusion, claim injection at login, and audience/issuer confusion across microservices. jwt_tool runs the full attack set against a live target (jwt_tool <token> -T -M at). The main guide’s JWT and token flaws section has the complete attack catalog, the testing workflow, and the live CVEs. Read it for the full list, then come back here to see where the forged token gets used.

3.3 OAuth and OIDC: wearing someone else’s badge

Section titled “3.3 OAuth and OIDC: wearing someone else’s badge”

OAuth bugs are BAC bugs. Code substitution at the callback, email-trust registration, scope escalation, and state fixation or a missing nonce all end with the wrong identity attached to a session. The full OAuth account-takeover playbook, including redirect-URI bypasses and account-linking twin-switches, lives in ATO Part IV: OAuth.

3.4 Session fixation and pre-hijacking (going full ghost)

Section titled “3.4 Session fixation and pre-hijacking (going full ghost)”
1. Log in, get your session
2. Before logging OUT fully, find a flow where a victim's login REUSES your session id:
(older apps: session id survives pre-auth → post-auth — you OWN their session after they log in)
3. Or login-CSRF: force victim to authenticate into YOUR session
→ they type their password. They buy things. They enter their credit card.
→ you see it all.

This family (login CSRF / session fixation) has low theoretical ceiling but where it hits (fintech checkout, crypto, e-com login-tied carts) it’s top-tier impact.

Next step: Chapter 4 moves from identity transport to the action list, every state-changing verb an endpoint exposes, and whether it checks who is calling.

Connections3 backlinks · 2 outgoing · 2 cross-guideFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Broken Access ControlFor authorized security research only: bug bounty programs, your own systems, or scoped engagements with written permission.