No Strings Attached

Recover the 56 bytes of `secret` (0x404040) XORed against a glibc-style LCG keystream

2026.09.30 NNS CTF 2026 95 pts Reversing
FLAG NNS{n0_str1ngs_1n_7h3_b1n4ry_bu7_ltr4c3_s4w_7h3_c0mp4r3}

This challenge is part of a set written up together in ctf/writeup.txt. Shared context for that set:

All 6 “beginner” tier Reverse Engineering challenges were solved via pure static analysis (radare2 / objdump / Python), no interactive debugging required. Each binary encodes/XOR-obfuscates the flag with a small pseudo-random-number-generator (LCG) keystream, seeded and iterated with constants recovered from the disassembly. Recovering the flag is simply a matter of re-implementing the same PRNG in Python and applying it to the encoded bytes pulled straight out of the binary. Binary: x86-64 static-looking ELF, dynamically linked, not stripped.

main() seeds an integer at 6, then for each of the 56 bytes of a global buffer secret (0x404040) runs a classic glibc-style LCG:

state = state * 0x41c64e6d + 0x3039   (mod 2^32)
keystream_byte = (state >> 16) & 0xFF
secret[i] ^= keystream_byte

After decoding, the program strcmp()s user input against secret. Since the decode happens in-place and unconditionally (independent of user input), we can just extract the raw encoded bytes at 0x404040 and replicate the LCG in Python.

Flag: NNS{n0_str1ngs_1n_7h3_b1n4ry_bu7_ltr4c3_s4w_7h3_c0mp4r3}