Lantern Signals socketpair-and-fork checker behind a decoy xorshift

rev
flag RxR{sp3ctr3_l4nt3rn_cur53_850315}

"A lantern swings on the far side of the river." A 30 KB statically linked, stripped musl x86-64 ELF. One line in, one of two messages out.

session
$./lantern_signals
A lantern swings on the far side of the river. Signal it.
signal: [-] Wrong. The lantern goes dark.

The checker that looks right and isn't

main (0x401030) hashes a 16-byte constant at 0x408020, compares to 0xede6c641, and jumps to a checker at 0x401410 on a match. That checker runs xorshift32 (seed 0xedbd2a0d) over 33 iterations, XORing each input byte against a 33-byte blob and against the evolving state - inverting it is a two-line script and produces a perfectly plausible flag:

output
RxR{c0ld_s3pulchr3_sc7th3_d2d59c}

Pitfall

Rejected. Hashing the blob by hand gives 0xf4e97924, not 0xede6c641 - the jump to 0x401410 is never taken at runtime. Same trick, same flavour as Grave Digger: dead checker, planted flag.

The real check: socketpair plus fork

The live branch opens a socketpair and forks. The parent XORs the input with a keystream (0x5a + 0xd*i) and writes it across the socket; the child reads it back (the keystream cancels, so the child sees the original input) and calls the real validator at 0x401470. Success is reported only if the child exits 42.

output
acc = 0x21 ^ len(input)                       # forces len == 33
for i in 0..32:
    k    = S[(i&7)+8] ^ key_byte[i&7]         # key = 0x909743b39ae9d141
    acc |= ( (input[i] ^ k) - 0x79*i - S[i+0x11] ) & 0xff
return acc == 0

S is the 64 bytes at .data:0x408020 (the same table the FNV check hashes). Every term depends on a single byte, so it inverts in one pass:

output
input[i] = k ^ ((S[i+0x11] + 0x79*i) & 0xff)

Pitfall

My first inversion produced unprintable garbage. The culprit was a -0x79*i term I'd read as len - 0x79*i, matching what the entry state showed - but missed the xor esi,esi right before the loop that zeroes the running counter, leaving just -0x79*i. Instead of guessing a second time, I ran the binary under gdb with 33 As and logged the per-iteration term directly, which also caught a second mistake: the 64-bit key is consumed byte-by-byte (first byte 0x41, not 0x90). Fixing both, every term comes out zero.

Check

session
$printf 'RxR{sp3ctr3_l4nt3rn_cur53_850315}\n' | ./lantern_signals
A lantern swings on the far side of the river. Signal it.
signal: [+] The lantern flashes back. That's your flag.

Under gdb the child exits 42, which is what the parent's waitpid is actually checking (status & 0xff7f == 0x2a00). The decoy flag doesn't get there.

Flag

output
RxR{sp3ctr3_l4nt3rn_cur53_850315}