Challenge
- Category: Binary Reverse Engineering (Day 01). Game Master ID
binary-reverse-engineering-day-01-c-elf-orientation - Prompt: "Before you can reverse anything, you have to learn to read. These plain C binaries are your primer: headers, section tables, symbol tables. Start with readelf -h -S and work your way down."
- Modes: Single Solve (2 pts), Time Trial (1 task, under 5 s, 3 pts), Mastery (2 tasks, under 5 s, 5 pts)
Artifacts
| File | SHA-256 |
|---|---|
elf_aware.zip (challenge artifact, not published) (CourseStack download) | db9c0652f4267287ffec5c20cf1a908109663b75c6519c86866535a2bb4a3d1b |
extracted/slot-0.elf (challenge artifact, not published) | ELF64 LSB x86-64 EXEC, dynamically linked, not stripped |
Triage
Static ELF orientation: header fields, a custom section, the symbol table and a constant returned by a function. The binaries were never executed.
Investigation
readelf -h slot-0.elf # ELF64, little endian, X86-64, EXEC, entry 0x401030
readelf -S -W slot-0.elf # custom section .huntress @0x402010 size 0x18; .symtab present
readelf -x .huntress slot-0.elf # "BR01-SYMBOL-ORIENTATION\0"
readelf -s -W slot-0.elf # recover_code (GLOBAL FUNC @0x401120), huntress_marker (LOCAL OBJECT)
objdump -d -M intel slot-0.elf # recover_code: mov eax,0x539 ; ret -> 1337
The Game Master asks nine questions (answer_ids): elf_class, endianness, machine, elf_type, marker, has_symtab, exported_symbol, recover_code, entry_point.
Failed path: eight full submissions using readelf, file or elf.h spellings were all wrong. The judge accepts partial submissions and reports a remaining count. Submitting one field at a time showed which spellings it accepts:
| answer_id | Accepted value | Rejected spellings |
|---|---|---|
| elf_class | ELF64 | ELFCLASS64 |
| endianness | little | little endian, 2's complement, little endian, LSB, little-endian |
| machine | x86-64 | Advanced Micro Devices X86-64, x86_64, EM_X86_64 |
| elf_type | ET_EXEC | EXEC, EXEC (Executable file) |
| marker | BR01-SYMBOL-ORIENTATION | |
| has_symtab | true | |
| exported_symbol | recover_code | main, huntress_marker |
| recover_code | 1337 | |
| entry_point | 0x401030 |
(This is the spelling style of pyelftools / elf.h constants rather than readelf's output.)
Flag Recovery
Single Solve returned CORRECT with flag Tokene88fd18e9985765b4ecafb71754664b4. The answers were cross-checked against my own static analysis of slot-0.elf (challenge artifact, not published), which matched the agent's assigned file on every field.
Flag
- Tokene88fd18e9985765b4ecafb71754664b4
Time Trial and Mastery
All three modes are marked Correct on CourseStack, which you confirmed. The Homebase agent's scripts are elf_aware_timed.py and elf_aware_probe.py, and its saved artifacts are in /tmp/elf-aware-probe/ (start JSON, ZIPs, mastery-results.md). All of these are in the Homebase VM and were not copied here.
- Time Trial (under 5 s): the bundle holds 4 ELF slots x 9 questions = 36 answer_ids. Runs completed in 0.88 to 1.41 s. Failures along the way:
- The first run crashed on a
recover_codeconstant encoding the parser did not handle, and the 30 s server deadline passed before it submitted. - Two runs returned incorrect. Exact_text constants were being rendered in hex, but the challenge uses decimal; the agent changed this to decimal.
- The agent did not report the run that finally passed. I saw the Correct result on CourseStack.
- The first run crashed on a
- Mastery (2 tasks, under 5 s): two sets x 4 slots x 9 questions = 72 answer_ids, nested as
setN.slotM_<field>(for exampleset1.slot0_elf_class).- The first probe script expected
set1.elf_class, so it saved the ZIPs and stopped without submitting. - After the ID mapping was fixed, each of the 8 slot subsets was submitted as a partial. Each was accepted, and the
remainingcounter dropped by 9 per slot: 63, 54 ... 9, then CORRECT. - Every field was accepted with the same spellings learned in Single Solve. Nothing needed a new spelling.
- The first probe script expected
- Answer-ID shapes differ by mode: Single Solve uses a bare
<field>, Time Trial uses per-slot IDs, and Mastery usessetN.slotM_<field>. Map IDs from the start response and do not hard-code them.
Minimal Reproduction
Run readelf -h -S -s and objdump -d on the assigned ELF, then submit the nine values in the spellings above.
Lessons Learned
- The Game Master supports partial submissions with a
remainingcounter. Use it to settle exact_text spellings field by field instead of resubmitting the full set. - Expect the spellings pyelftools produces (
little,x86-64,ET_EXEC), not readelf's long-form text. - For timed modes, first save the start JSON and artifacts and dry-run the parser against them offline. Most failed timed runs here were ID-mapping or formatting bugs, not analysis errors.
- If a full submission fails, submit per-slot partials while the server deadline is still open. That pins down the wrong field without spending a fresh attempt.
- Huntress challenge flags this year are bare 32-character hex values returned by the Game Master (
flagfield), notflag{}-wrapped.