$ cat writeup.md…
$ cat writeup.md…
fortid2026
Task: Rust ELF computes a one-byte 'checksum' via ~5030 generated functions, each XORing a constant byte. Solution: function names are sha1(VAR_page_offset); preorder index / page size 162 recovers the per-byte XOR shares despite LLVM leaf merging.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Surely you can't recover anything based on a one-byte checksum...
English summary: A Rust x86-64 ELF (checksum, rustc 1.90.0, not stripped) prints a
prompt and a list of variables (FLAG, AZURE_API_KEY, DB_PASSWORD,
MANS_BEST_FRIEND). It reads one variable name (not a flag candidate), computes an
8-bit checksum and prints it as two hex digits. The goal is to recover the hidden secret
behind one of those names — the flag is the value of FLAG. The binary models the check
as an apparently irreversible one-byte hash ("SFSN161"), but the checksum is simply the
XOR of all secret bytes, and the generated call tree leaks the whole secret through its
symbol names.
What the binary actually does. checksum::main dispatches on the exact input string
and calls one root function per variable:
| variable | root function |
|---|---|
FLAG | checksum_defa60ccef758e50fb2f70e838b3d36e5d1aeb71 |
AZURE_API_KEY | checksum_4f4800fbd67030125774d819d981e9a73dec6b37 |
DB_PASSWORD | checksum_d596da6220389f86c1d95ee0f64e443297c1159a |
MANS_BEST_FRIEND | checksum_9b9436e07bfc893af9111c09d308c4feb1684610 |
There are 5030 functions named checksum::checksum_<40hex>_. Every body is
trivial:
xor byte [rdi], imm ; retxor byte [rdi], imm ; call c1 ; [mov rdi,rbx ; call c2 ; ...] ; retnot byte [rdi] instead of xor.So each function XORs one constant byte into *(uint8_t*)rdi and optionally calls up to
five children (the children are invoked sequentially through rbx). Executing the root
with [rdi] = 0 yields
checksum = XOR of every `xor imm` operand and every `not` (0xff) along the tree,
weighted by execution multiplicity (XOR = parity).
This reproduces the four observed runtime values exactly. The value is a fixed XOR circuit; the secret is nowhere in plain memory.
...
$ grep --similar