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
- SSRF via `jku` header: If
header.jkuis present, it fetches JWKS from *any* URL without pinning tohttps://auth.trusted.example(allowing internal metadata SSRF or attacker-hosted JWKS). - Path Traversal via `kid` header: If
jkuis absent, it reads/etc/keys/{kid}fromkey_vfswithout canonicalizing..— an attacker setskid: "../../public/notice.txt"to load a known public file as the signing key! - Algorithm Confusion: It accepts
algvalues other than"HS256"(such as"none"or"RS256"treated as HMAC secret) and ignoresexp.
// Your Task
Close all three bugs in the chain:
- Enforce
header.alg == "HS256"and valid numeric unexpiredpayload.exp > now_ts. - If
jkuis provided, allow onlyhttps://auth.trusted.example/jwks.json(reject all other origins/IPs/schemes before callingfetch_jwks). - If using
kid, validate it matches^[a-zA-Z0-9_-]+\.key$(or strict path canonicalization inside/etc/keys/) with no traversal. - Verify HMAC-SHA256 in constant time.
Sample Sanity Checks (1)
- Valid local key token passesHS256 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.