Skill v1.0.1
currentAutomated scan96/100+12 new
name: auth-mechanism-review description: 'Reasons about authentication weaknesses (JWT flaws, session security, OAuth and OIDC flaws, brute-force surfaces, password storage) from code and docs evidence. Use when docs or route inventories describe login, sessions, token handling, OAuth callbacks, password reset or MFA.' metadata: version: "1.0.1" model_tier: reasoning cacheable: 'false' output_format: markdown paqad-meta: skill.meta.yaml
What It Does
Reviews authentication implementation for weaknesses that let an attacker bypass identity verification (JWT algorithm confusion, session fixation, OAuth redirect manipulation, brute-force surfaces, and weak password storage) producing findings backed by code or test evidence.
Use This When
When module docs or route inventories describe login flows, session management, token issuance/validation, OAuth/OIDC callbacks, password reset flows, or MFA enforcement.
Inputs
- Read the module docs describing authentication and session flows.
- Read
references/auth-attack-checklist.mdbefore evaluating each area. - Read code files and tests that show JWT validation, session handling, and rate limiting.
Procedure
- JWT review: Find JWT validation code. Check:
- Algorithm is verified;
alg:noneis explicitly rejected - RS256 public key is not reused as HMAC secret (RS256 → HS256 confusion attack)
- Token expiry (
exp) is enforced; refresh token rotation is implemented kidheader is not used in a file path or SQL lookup without sanitization- JWT secret is not a weak/guessable string (
secret,password,key,123456) audandissclaims are validated
- Session review: Check:
- Session fixation protection: session ID is regenerated after successful authentication
Secure+HttpOnly+SameSite=Strictcookie flags- Session invalidation on both logout and password change
- Absolute session timeout (not just sliding window)
- Token storage: Find client-side token storage.
localStorageorsessionStorageare accessible to XSS;HttpOnlycookies are not. Verify refresh tokens are stored separately from access tokens. Check that a token revocation mechanism exists.
- Brute-force protection: Find login, password reset, and OTP verification endpoints. Check for:
- Per-IP or per-account rate limiting
- Account lockout after N failures
- Username enumeration via response timing or different error messages ("user not found" vs "wrong password")
- Password policy: Check:
- Hashing algorithm:
bcrypt/argon2/scryptvsMD5/SHA1/SHA256without cost factor - Salt uniqueness per password (not a global salt)
- bcrypt cost factor ≥ 10; argon2 memory ≥ 64MB; PBKDF2 ≥ 100k iterations
- Breached password detection (HIBP-style check or equivalent)
- OAuth / OIDC review: Check:
stateparameter is present and validated on the callback (CSRF protection)- Authorization code flow is used, not implicit flow
- Redirect URI is strictly validated: no wildcard, no open redirect via callback
- PKCE is enforced for public clients (mobile, SPA)
- Token scopes are properly minimized (principle of least privilege)
Output Contract
- Match
assets/output.template.md:## Findingsheading, one bullet per weakness with severity, WSTG id (fromassets/wstg-mapping.txt),Evidence: file:line, andRequired action:. - Output must pass
scripts/lint-findings.sh(exit 0). - Run
scripts/scan-auth-smells.shbefore drafting; treat each emitted hit as an investigation candidate, not an automatic finding.
Escalate / Stop Conditions
- Ask when the auth library in use is not identified: cannot verify JWT validation without knowing the library.
- Warn when
alg:noneis not explicitly blocked and the framework does not reject it by default. - Do not mark authentication as safe purely because a login endpoint exists: each of the 6 areas must be verified independently.
Resources
references/auth-attack-checklist.mdscripts/scan-auth-smells.sh: pre-investigation grep over the codebasescripts/lint-findings.sh: enforces WSTG id + Evidence citation per findingassets/output.template.mdassets/wstg-mapping.txt: area → WSTG test id lookup