InBrott
target://chained-ssrf-jwt-vault
extremeOPEN

Federated Key Broker

extremechained-bugsssrfjwtpath-traversal

// Scenario (Chained Vulnerabilities)

FederatedBroker.verify_and_read(token, fetch_jwks, key_vfs, now_ts) verifies a federated token and reads a protected secret if valid.

// The Chained Bugs

  1. SSRF via `jku` header: If header.jku is present, it fetches JWKS from *any* URL without pinning to https://auth.trusted.example (allowing internal metadata SSRF or attacker-hosted JWKS).
  2. Path Traversal via `kid` header: If jku is absent, it reads /etc/keys/{kid} from key_vfs without canonicalizing .. — an attacker sets kid: "../../public/notice.txt" to load a known public file as the signing key!
  3. Algorithm Confusion: It accepts alg values other than "HS256" (such as "none" or "RS256" treated as HMAC secret) and ignores exp.

// Your Task

Close all three bugs in the chain:

  1. Enforce header.alg == "HS256" and valid numeric unexpired payload.exp > now_ts.
  2. If jku is provided, allow only https://auth.trusted.example/jwks.json (reject all other origins/IPs/schemes before calling fetch_jwks).
  3. If using kid, validate it matches ^[a-zA-Z0-9_-]+\.key$ (or strict path canonicalization inside /etc/keys/) with no traversal.
  4. Verify HMAC-SHA256 in constant time.

Sample Sanity Checks (1)

  • Valid local key token passes
    HS256 token signed with /etc/keys/primary.key verifies cleanly
Hints (0/3)
initializing editor...

[idle] Press RUN to execute visible sample checks, or SUBMIT to run hidden exploit & functionality suites.