All PryIDA examples

PUBLIC EXERCISE / ELF X86-64

r9 · Meet in the middle of a recurrence

Reconstruct an XOR mask and find a printable input that reaches an exact 32-bit state.

Original puzzle at the reviewed revision · All five public exercises

Original SHA-256 2ef3ca903040e9a41893c40adf8910dd27a1ac57b4762b13877273037b7ff9ad

01 Identify the program and the standard library call

Open r9 and verify its SHA-256 in File Details. Analyze main and check_password. Main has no observed random seeding call before the check. The puzzle imports random from the Linux C library, so the replay uses the standard glibc stream starting from its default seed.

PryIDA File Details and Hex for r9.
PryIDA File Details and Hex for r9.

02 Count the XOR rounds

Find the first call to random. The checker keeps its low eight bits for the round count. In the glibc model the first output is 1804289383, so the low byte is 103. That tells you how many passes over the input to model.

Hex offset 0x642 · Virtual address 0x400642 · 5 bytes

PryIDA Hex selection at 0x642 in r9.
PryIDA Hex selection at 0x642 in r9.

03 Reduce all passes to one mask per position

Each pass XORs a new byte into the same input position. Combine all those mask bytes with XOR, then apply the result to the original input once. The order of random draws still matters. For the chosen length of six, the modeled mask is E6 74 EA 22 BA 1C.

PryIDA Pseudocode for check_password in r9.
PryIDA Pseudocode for check_password in r9.

04 Read the accumulator in the direction the code uses

The checker starts at 0x1337. It reads the transformed input from right to left, treats each byte as signed, multiplies the current accumulator by it, and adds 0x31337. The calculation keeps just 32 bits. Treating a byte such as 0xE6 as 230 would give the wrong product because its signed value is minus 26.

Hex offset 0x6c3 · Virtual address 0x4006c3 · 15 bytes

PryIDA Hex selection at 0x6c3 in r9.
PryIDA Hex selection at 0x6c3 in r9.

05 Find a shared middle state

Make a table of the states reached by the rightmost three printable bytes. Work backward from the target for the leftmost three bytes. For this search use odd multipliers on the backward half, because each has an inverse in 32-bit wraparound arithmetic. Match a backward state to the forward table. This replaces one huge search with two much smaller ones.

Hex offset 0x6df · Virtual address 0x4006df · 9 bytes

PryIDA Hex selection at 0x6df in r9.
PryIDA Hex selection at 0x6df in r9.

06 Replay the exact candidate

Run the equations forward for the selected six input bytes. Track the accumulator after every multiplication to catch a reversed order or wrong signed byte. The independent replay reaches 0xFD0970E7 exactly, the constant in the final comparison.

PryIDA Pseudocode for main in r9.
PryIDA Pseudocode for main in r9.
Reveal the solution

!UQ=hn

The replay reads the original ELF bytes and applies the recovered check to this input. Open the receipt for the exact byte ranges and verification values.

Evidence receipt · Python checker replay