agentleFS
raphaelbleierraphaelbleier/mythos-sec/skills/oauth-audit/SKILL.md

oauth-audit

Skill2 starsChanged 16 days agoMITView on GitHub

OAuth 2.0 / OpenID Connect flow audit for a Mythos engagement - redirect_uri mutations, state and login CSRF, code reuse, PKCE enforcement, missing iss, cross-client and identity binding, scope and response_mode checks, dynamic registration, device code and magic links, each proven by an authorization code or token arriving at an OAST host the agent controls, using the agent's own accounts. Use when recon or auth-session finds an authorization endpoint, a "log in with" button, /.well-known/openid-configuration, a /device or /register endpoint, or a magic-link login.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    iss and cross-client: check metadata for iss support.

    line 71
  2. Very specific:

    No brute force of codes, user_codes, state or magic-link tokens.

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OAuth audit: the code reached my host, or the check held

An authorization-server 302 to a mutated redirect_uri is a hint, not a finding. Proof is a code or token for the agent's own test account that arrives at an OAST host the agent controls, or a token endpoint that answers 200 when it must not. Method and mutation lists live in knowledge/web/oauth-oidc.md; token checks in knowledge/web/jwt.md. Read the first before step 2.

Triage selects this skill (skills/registry.yaml) when the surface shows /.well-known/openid-configuration, an authorize, token, introspect, userinfo or device endpoint, a client_id, redirect_uri, response_type or code_challenge parameter, or a redirect whose Location carries one of those. It drives authflows, and needs auth-session first. Reset, MFA, email change and session rotation are account-takeover, not this skill.

Prerequisites: scope.rules.allow_active; sessions from auth-session (userA, userB, S=engagements/<dir>/sessions), run session-check first; an OAST base as in stored-xss-oast (lab http://oast:8080, else interactsh-client); the browser tool for the redirect flows. Registering clients and other state changes also need allow_exploit, and a change you cannot make on an object of your own is skipped with that reason (see exploit). The authorization server is in scope only if scope.yaml lists it: against a third-party IdP (Google, Microsoft, GitHub) test the target's callback and token handling, never the IdP itself.

1. Map the flow

Record one login as userA with the browser tool. Write engagements/<dir>/scan/oauth-flow.md: authorization and token endpoints, client_id, response_type, redirect_uri, scope, where state/nonce live, PKCE method, response_mode, and the discovery document (/.well-known/openid-configuration: registration_endpoint, device_authorization_endpoint, code_challenge_methods_supported, authorization_response_iss_parameter_supported). Implicit or hybrid flow is a candidate on its own. Mint one token per check into scan/oauth-tokens.jsonl (token, check, request, ts), e.g. python3 -c 'import secrets;print("mx-oa-"+secrets.token_hex(5))', and use it as the redirect path: <oast>/<token>.

2. redirect_uri mutations

Send the authorization request as userA for each mutation in the knowledge table, without following redirects, and read Location:

H=$(sed 's/.*/-H "&"/' $S/userA.headers | tr '\n' ' ')     # session for the AS host
eval curl -s -o /dev/null -D- $H "'<authz>?response_type=code&client_id=<id>&scope=<s>&state=x&redirect_uri=<urlencoded mutation>'"

Location on the mutated URI = candidate. Open that URL with the browser tool as userA; abort the navigation to the callback and record the URL. The code arriving at <oast>/<token> (or in Referer for an open-redirect chain) with the unrelated-host control refused = reproduced. Stop at the first accepted mutation.

3. Flow binding

  • State / login CSRF: callback URL from userA's unused flow, opened in userB's context; control: altered state, and the callback in its own context.
  • Code reuse and binding: redeem one code twice, and with another redirect_uri; control: first redemption, mangled code.
  • PKCE: redeem with no and with a wrong code_verifier; authorize with no challenge and with plain.
  • iss and cross-client: check metadata for iss support; present a token minted for your second client to the app login and API. Mix-up needs an AS you run; without it, candidate with the evidence.
  • Identity binding: IdP account with userB's email unverified; a sub that differs from the email.

4. Scope, mode, optional endpoints

  • scope and audience: over-broad scope at authorize and refresh; read the issued scope from the token or introspection and call an API that needs it.
  • response_mode / type: token, id_token, response_mode=query; error branches (prompt=none, bad scope) validated like the success path.
  • Dynamic registration (allow_exploit): one client mythos-<token> with OAST URLs in logo_uri, jwks_uri, sector_identifier_uri; an OAST hit is SSRF evidence for the web-scan SSRF row. Delete the client after.
  • Device code: at most 10 of your own user_codes for entropy arithmetic; never guess a live code.
  • Magic links: open twice, open in another context, Host/ X-Forwarded-Host poisoning on your own address read from your own mailbox, Referrer-Policy, 5 to 10 own tokens for structure.

Rules

  • Own accounts only; the leaked code or token must be userA's or userB's.
  • No brute force of codes, user_codes, state or magic-link tokens. Respect rules.rate_limit_rps and max_requests.
  • A scanner or mail prefetch can burn a single-use code: attribute every OAST hit by source and User-Agent before counting it.
  • Clean up: delete registered clients, unlink test identities.

Closure states

Per exploit, every check ends in exactly one state in findings/<id>.md:

statemeaning here
candidateLocation to a mutated URI, missing iss/PKCE metadata, implicit flow, version match; no OAST hit
reproducedOAST hit or 200 from the abused request with the negative control done, once by hand
validated(proof)stored PoC (findings/<id>.poc.sh plus the browser script) re-run in a fresh context gives the same hit
rejected(reason)the control also passed, enforced, by design, or not reproducible

Record the exact request, the OAST log line or token response, the control and the account used. Add an oauth row per check to scan/coverage.md. Hand reproduced rows to exploit for the validator pass, then report.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.