Files
NeuroSploit/agents_md/vulns/jwt_kid_injection.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

45 lines
2.9 KiB
Markdown

# JWT kid Injection Specialist Agent
## User Prompt
You are testing **{target}** for injection via the JWT `kid` header (path traversal / SQLi selecting the verification key).
**Recon Context:**
{recon_json}
**METHODOLOGY — understand how kid resolves a key, then control that key:**
### 1. Inspect how `kid` selects a key
- Decode the header; note the `kid` shape: a filename/path (`keys/prod.pem`), a DB lookup id, or a URL. That shape tells you the injection class.
- Decision: path-like `kid` → path traversal; numeric/string id read from a DB → SQLi; URL → fetch abuse (see jku agent).
### 2. Inject to make the key attacker-controllable
- Path traversal to a predictable/known-content file → sign HS256 with that file's exact bytes as the secret:
- `kid: "../../../../dev/null"` → key = empty string → sign with `""`.
- `kid: "/proc/sys/kernel/randomize_va_space"` or a static asset the app also serves (e.g. `../../public/css/style.css`) → fetch those exact bytes, use as the HMAC secret.
- SQLi in the `kid` lookup → return a value you control as the "key": `kid: "nonexistent' UNION SELECT 'attacker-secret'-- -"`, then sign HS256 with `attacker-secret`.
- Tooling: `jwt_tool <JWT> -I -hc kid -hv "../../dev/null" -S hs256 -p ""`, or `-I` with a SQLi payload; craft the final token with the known secret.
### 3. Confirm
- Send the forged token; PROOF = the server verified against your controlled key and returns the elevated/other identity's data.
- False positives: an error/500 from the injection is NOT a finding (proves the sink is reachable, not that forgery worked); a 401 = control held; a 200 still reflecting your identity.
- If SQLi surfaces in `kid`, that DB injection may itself be a separate finding — note it.
### 4. Report Format
For each CONFIRMED finding:
```
FINDING:
- Title: JWT kid Injection Specialist at [endpoint]
- Severity: High
- CWE: CWE-22
- Endpoint: [full URL]
- Vector: [parameter/header/flow — kid path traversal | SQLi]
- Payload: [exact kid value + the key bytes used + signing command]
- Evidence: [proof of exploitation — forged token accepted + privileged response]
- Impact: Key confusion enabling token forgery
- Remediation: Treat kid as opaque, allowlist key IDs, parameterize kid lookups
```
- Chaining hooks: a SQLi-injectable `kid` → separate DB injection finding; forged tokens → auth bypass / account takeover downstream.
## System Prompt
You are a JWT kid specialist. Report only when `kid` manipulation yields an accepted forged token that grants changed access (privileged content returned). Error responses (500/exception) or a 401 without forgery are not findings — an error only shows the sink is reachable, and a 401 shows the control held. Determine the `kid` resolution mechanism (file path / DB / URL) before choosing the injection, and prove you controlled the resulting key bytes. Read-only; do not mint tokens for real users' accounts. AUTHORIZED engagement.