Web auth session handling

From NoorQureshi/security-skills · View interactive version

Web auth session handling is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Legitimately acquire and KEEP an authenticated session (through MFA/OTP) so you can test the post-auth attack surface, and hand that session to your tools without leaking secrets. Load when the high-value classes (IDOR/BOLA, mass assignment, injection on real data APIs) are blocked behind login/SMS-

How to use this skill

Skill file

Authenticated session handling

When it applies

The interesting bugs live after login — cross-tenant IDOR/BOLA, mass assignment, injection on

the real data APIs — but the run keeps collapsing to pre-auth findings because login is gated by

MFA/OTP, or the token expires and every automated request 401s halfway through. This skill is the

setup step that makes authenticated testing actually work. It does not attack the auth

mechanism (web-oauth, web-auth-jwt, api-auth-attacks do that) — it obtains one legitimate

session and keeps it usable.

Why it works

Post-auth coverage silently disappears when tooling can't hold a session: the scanner logs out,

the token lapses, or MFA can't be satisfied autonomously. Capturing the session as a *reusable

artifact* — the cookie/localStorage state for browser-driven testing and the raw bearer token for

direct API replay — decouples "log in once" from "test a thousand requests," so the whole

authenticated surface stays reachable for the life of the token.

Method

  1. Get a real test account, in writing. For a pentest, the client provides it; for bounty,

use an account you own (register two: attacker + victim, for IDOR diffing). Record it by

reference in scope.txt — never paste live credentials into notes or a prompt.

  1. Handle the MFA/OTP gate by the least-privileged means available:

and submit it. Fully repeatable.

operator complete the challenge, then resume and capture state.

  1. Capture the session as artifacts:
  1. Feed it to your tools:

(a redirect to /login, a 401, a specific body), so long scans don't drop the session.

  1. Refresh, don't re-login. Record expires_at; when a refresh token exists, refresh; only

re-run the full login when it doesn't. A wave of sudden 401s means the token lapsed — refresh

before you trust "not vulnerable."

  1. Diff two sessions for access control. Hold A's and B's artifacts side by side and replay

each other's object references (web-idor, api-bola) — the core authenticated test.

Gotchas

actually reaches a known post-auth endpoint (200 with your data) — otherwise you "test" a

logged-out surface and report false negatives.

and any committed file. The engagements/ tree is git-ignored — keep them there.

record the post-auth surface as deferred/untested, don't fake an N/A or silently skip it.

prefer least-privilege test roles, and treat destructive actions per RoE.

Verify success

A request built entirely from your captured artifact (no live browser) returns a known post-auth

response with your account's data — and a two-session IDOR probe runs cleanly against it.

References

Playwright authentication/storageState docs; Burp/Caido session-handling rules; RFC 6238 (TOTP).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.