Hash length extension
The API signs requests as sha256(secret || data) and hands you one valid signed example. Because SHA-256 is a Merkle-Damgard hash, a valid digest can be continued: append extra fields and compute the matching signature without the secret. This is a hand-rolled MAC, not a token library, which is exactly the design flaw.
How to reach it
Run the challenge locally with its docker-compose. The flagger sidecar writes your per-run flag to /flag/flag.txt, which the /admin endpoint reads. The service speaks HTTP on port 8080; the /sign endpoint hands out the example signature.
Run this challenge
Spin it up locally with Docker. The flagger sidecar fetches a per-run flag into a shared volume, then the challenge container boots and reads it.
services:
flagger:
image: matejbasic/rootcause-flagger:1.0
environment:
ROOTCAUSE_API_URL: https://root-cause-api.matejbasic.com
ROOTCAUSE_API_KEY: ${ROOTCAUSE_API_KEY}
ROOTCAUSE_CHALLENGE: hash-length-extension
FLAG_PATH: /flag/flag.txt
volumes:
- flag:/flag
challenge:
image: matejbasic/hash-length-extension:1.0
depends_on:
flagger:
condition: service_completed_successfully
environment:
FLAG_PATH: /flag/flag.txt
volumes:
- flag:/flag
ports:
- "8080:8080"
volumes:
flag:
rootcause start hash-length-extensionThe rootcause CLI does all of this in one command. Running a challenge needs your API key, which you generate in your profile.