"Something was buried here on a night without a moon." A 34 KB statically linked, stripped musl x86-64 ELF.
$./grave_digger _____ |R.I.P| The reaper buried something here. | | Dig it up and say it out loud. offering: [-] Wrong. Something scratches inside the coffin.
strings surfaces /proc/self/status and TracerPid: right away - the textbook
self-debugger check, and the first real signal that more than one code path decides "correct."
Walking main
- Print the banner and
offering:. fopen("/proc/self/status"), scan forTracerPid:; nonzero setsbpl = 0x5c, elsebpl = 0.fgetsone line, strip the newline,strlenit.- hash 16 bytes at
.data:0x409020, compare to0xede6c641. - Call
0x401330or0x4013b0depending on the hash; nonzero return means success.
Pitfall
Step 4 is the trap. Hashing the shipped blob by hand gives 0x38c31d7b, not 0xede6c641 - the
well-behaved-looking branch at 0x401330 is dead code. The comparison that actually runs is
0x4013b0, and that's the one that receives bpl. The hash is a decoy, the tidy checker is a
decoy, and a debugger flips bpl to make you derive a different, wrong string.
The real check
Cleaned up, 0x4013b0:
acc = data[0x409030] ^ len(input) # data[0x409030] == 0x1e == 30
for i in 0..29:
t = (r10 >> (8*(i&7))) & 0xff
acc |= ( (input[i] ^ bpl ^ tbl1[i&7] ^ t)
+ ( (0 - 0x17*i) - tbl2[i] ) ) & 0xff
return acc == 0
tbl1 is 8 bytes at 0x409028, tbl2 is 30 bytes at 0x409031, r10 = 0xb65e547a3f81a001.
The accumulator is a running OR and every term depends on one byte, so it's fully separable:
input[i] = (0x17*i + tbl2[i]) & 0xff
^ bpl ^ tbl1[i&7] ^ ((0xb65e547a3f81a001 >> (8*(i&7))) & 0xff)
Solving with bpl = 0 (untraced):
RxR{h4unt_f4ng_l4nt3rn_0414ae}
$echo 'RxR{h4unt_f4ng_l4nt3rn_0414ae}' | ./grave_digger offering: [+] The grave is quiet. That's your flag.
Note
The dead checker's own tables (0x407140, 0x407160) are perfectly plausible-looking, and
inverting it for curiosity just gives non-printable garbage - it isn't a second hidden flag,
it's the prize for walking the clean branch. And under a debugger, bpl = 0x5c and the same XOR
chain yields a different 30-byte string that only a traced/patched build would accept - a clean
way to hand an automated solver a confident wrong answer.
Solved with objdump -d and hand-reading both candidate checkers; static only, since dynamic
tracing is exactly what the binary is booby-trapped against.
Flag
RxR{h4unt_f4ng_l4nt3rn_0414ae}