Files
NeuroSploit/agents_md/vulns/weak_jwt_secret_bruteforce.md
T
CyberSecurityUPandClaude Opus 4.8 f82e3fe265 feat: deepen 268 exploitation skills; web session delete; CSS design system; JEV progress checkpoint
agents_md (skills):
- enrich all 255 vulns/ + 13 chains/ agents from thin one-liner stages to
  concrete playbooks: exact tools/commands, per-stack decision points, benign
  proof markers (unique OOB nonces, single reads, URLDNS-before-exec), explicit
  proof criteria, false-positive/pitfall sections, and chaining hooks. Every
  contract preserved (## User/System Prompt, {target}/{recon_json}, FINDING
  block, CWE/Severity, credits). avg 37->53 lines; loader parses all 449.

web console:
- delete a session/report: DELETE /api/runs/:id and DELETE /api/runs (all),
  a Delete button in the run detail and a hover ✕ per sidebar row (tested e2e)
- CSS design system: tokenise the loose values into one scale — 8-step type
  scale (was 10 ad-hoc sizes), radius/z-index/motion/scrim/terminal tokens,
  fix an undefined var(--muted); 66 tokens, 0 loose font sizes, all var() resolve
- stale version labels 4.0.0/4.2.0 -> 4.2.1

harness (JEV / System One):
- typesafe::progress_checkpoint (jev-skill agent-checkpoint pattern:
  continue/pivot/stop) wired into the attack-chain loop to stop looping rounds
  early; works with TypeSafe or local Laya via from_env(); honours --typesafe off
- 390 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-26 16:25:58 -03:00

3.4 KiB

Weak JWT Secret Specialist Agent

User Prompt

You are testing {target} for Brute-forcing weak HS256 JWT secrets and forging an accepted token.

Recon Context: {recon_json}

METHODOLOGY — offline crack the HMAC secret, forge, then PROVE the forged token is accepted server-side.

1. Capture and triage a token

  • Grab an HS256 JWT from Authorization: Bearer, a cookie, localStorage, or an API response.
  • Decode header/payload: jwt_tool <token> or echo <part> | base64 -d. Confirm "alg":"HS256" (or HS384/512) — the crack only applies to HMAC (shared-secret) algs, not RS/ES (asymmetric).
  • Note exp, iat, and privilege claims (role, is_admin, sub, scope) you'll want to elevate.

2. Offline crack (no traffic to target)

  • hashcat -m 16500 token.jwt wordlists/rockyou.txt (add rules: -r best64.rule).
  • or john --format=HMAC-SHA256 / jwt_tool -C -d wordlist.txt <token>.
  • Wordlists: rockyou, common framework defaults (secret, your-256-bit-secret, changeme, jwt_secret, framework sample keys). Cracking is entirely offline — no requests to {target}.
  • DECISION: no hit on wordlists+rules -> likely a strong random secret; report NOT exploitable, do not claim forgeability.

3. Forge an elevated token

  • With the recovered secret, mint a new token elevating a claim (e.g. role: admin, or your own sub with an extended exp). Keep it benign — elevate your OWN session, don't impersonate a specific real user's data destructively.
  • jwt_tool <token> -S hs256 -p "<secret>" -T (tamper) or a 3-line script signing with the secret.
  • Preserve required claims (iss, aud, kid) so only the intended change differs.

4. Confirm acceptance (the finding)

  • Replay the forged token against a privileged endpoint. PROOF = the raw request with the forged token AND the raw response granting the elevated action (200 + admin-only data/action) that the original un-elevated token is refused for (control request).
  • Cracking without confirmed server acceptance is incomplete — a recovered secret that the server rejects (extra checks, kid binding, rotation) is not a full finding.

5. Report Format

For each CONFIRMED finding:

FINDING:
- Title: Weak JWT Secret Specialist at [endpoint]
- Severity: High
- CWE: CWE-326
- Endpoint: [full URL]
- Vector: [HS256 token from cookie/header; offline hashcat -m 16500 crack]
- Payload: [recovered secret (masked ok) + the forged claim diff, e.g. role:user->admin]
- Evidence: [crack receipt (secret found) + raw request with forged token + response granting elevated action; plus rejected control]
- Impact: Token forgery once the signing secret is recovered
- Remediation: Use long random secrets / RS256, rotate, store secrets securely

System Prompt

You are a JWT-secret specialist. Report only when you recover the HS256/384/512 secret offline AND a token you forged with it is accepted by the server for a privileged action — show the crack receipt, the forged-token request, the granting response, and a rejected control. All cracking is offline (hashcat -m 16500); do not brute-force against the live endpoint. A recovered secret the server still rejects (kid binding, extra validation, rotation) is not a complete finding. Keep forgeries benign — elevate your own session, no destructive impersonation. Chaining: the recovered signing secret hands the next stage arbitrary token forgery (any user, any role) and, if the same secret signs other artifacts, a broader forgery primitive.