Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Web Jwt Oauth?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-web-jwt-oauth)
---
name: web-jwt-oauth
description: Token and federated-identity attacks — JWT flaws (alg=none, key confusion, weak HMAC secrets, jwk/jku/kid injection), OAuth 2.0 / OIDC abuse (redirect_uri manipulation, state/CSRF, code theft and injection, implicit flow, PKCE downgrade, token leakage), and SAML (signature stripping/wrapping). Use whenever JWTs, OAuth, OIDC or SAML are present.
---
# JWT / OAuth / OIDC / SAML
Token systems fail at the crypto and at the flow. Check both: is the token itself forgeable, and is the issuance/redemption flow abusable?
## Trigger phrases
`jwt, json web token, alg none, jwk, jku, kid injection, oauth, oidc, openid, redirect_uri, saml, token forgery, signature bypass`
## JWT attacks
Decode the token (header.payload.signature). Inspect `alg`, `kid`, `jku`, `jwk`, claims (`sub`, `role`, `exp`, `aud`, `iss`).
1. **`alg: none`** — set header alg to `none`/`None`/`NONE`, strip the signature, keep the trailing dot. If accepted, forge any claims (e.g., `role:admin`, different `sub`).
2. **Algorithm confusion (RS256→HS256)** — if the server verifies RS256 but can be tricked into HS256, sign with the *public key* as the HMAC secret. Obtain the public key from `/jwks.json`, `/.well-known/`, a cert, or derive from two tokens.
3. **Weak HMAC secret** — brute/dictionary the HS256 secret (`hashcat -m 16500`, `jwt_tool`, wordlists like jwt-secrets). Crack ⇒ forge arbitrary tokens.
4. **`kid` injection** — path traversal (`kid: ../../dev/null` → empty/known key), SQLi in `kid`, or point `kid` to a predictable file to control the verification key.
5. **`jku` / `x5u` header injection** — point to an attacker-hosted JWKS/cert (test SSRF/allowlist bypass on the fetch) so the server verifies with your key.
6. **`jwk` header injection** — embed your own public key in the token header; if the server trusts it, you sign your own tokens.
7. **Claim abuse** — no `exp`/expired accepted, `aud`/`iss` not validated (token from another app accepted), missing signature verification entirely, `sub` swap for IDOR.
8. **kid/key reuse & nested JWE/JWS** confusion.
Use `jwt_tool`/`jwt-cracker`/custom scripts; verify each forged token actually authenticates.
## OAuth 2.0 / OIDC attacks
Map the flow (authorization code, implicit, client credentials, PKCE). Key targets:
1. **`redirect_uri` manipulation** — register/supply an attacker redirect: open-redirect on allowlisted host, weak matching (prefix/substring/`.` tricks, `//attacker`, path append, `redirect_uri=https://legit.com.attacker.com`), extra params, fragment vs query. Goal: leak `code`/`token` to attacker.
2. **`state` missing/static** — CSRF on the callback → login-CSRF / account linking takeover.
3. **Authorization-code theft/reuse** — code in Referer/logs, code not single-use, code not bound to client/PKCE, code injection (inject victim's code into attacker session or vice versa).
4. **PKCE downgrade** — server accepts auth without `code_verifier`, or `plain` method accepted.
5. **Implicit-flow token leakage** — access token in URL fragment captured via redirect/Referer/`postMessage`.
6. **Scope/consent abuse** — scope upgrade, silent re-consent, prompt=none token grab.
7. **`id_token` validation** — signature/`alg`/`aud`/`iss`/`nonce` not checked (overlaps JWT attacks); accept tokens from attacker-controlled IdP.
8. **Account takeover via linking** — bind attacker's social login to victim account (email-based linking without verification), or pre-account-takeover.
## SAML attacks
1. **Signature exclusion** — remove the `<Signature>`; if still accepted, forge assertions.
2. **XML signature wrapping (XSW)** — add a forged assertion while keeping the valid signature over the original, exploiting which element the verifier reads vs validates.
3. **Comment injection** — `<` / comments in `NameID` to confuse parsing (`admin<!---->@x` → `admin`).
4. **XXE in SAML** (→ `web-xxe`), unsigned assertions, `audience`/`recipient`/replay (no `NotOnOrAfter`/`InResponseTo` checks), IdP confusion.
Use SAML Raider / custom tooling.
## Depth & chaining
- Any token forgery or flow leak ⇒ **account/privilege takeover** — demonstrate it.
- Chain SSRF (`web-ssrf`) with `jku`/`x5u` fetch; chain open redirect with OAuth code theft.
## Evidence
Show the forged/stolen token authenticating as a higher-priv or victim identity, with the exact manipulation and the server's acceptance.