All PryIDA examples

PUBLIC EXERCISE / ELF X86-64

r5 · Follow what changes together

Recover a 40-byte input by keeping track of two values through a randomized loop.

Original puzzle at the reviewed revision · All five public exercises

Original SHA-256 4a6da0a2c398607c9fc61a42c634072c4dd34f3d8c2ef5be92bca19a37e6e24f

01 Open the exact ELF file

In PryIDA, open r5 and select File Details. Check the SHA-256 above against the downloaded file. The ELF label identifies the Linux file format and x86-64 identifies its machine instructions. Static analysis on macOS can read both.

PryIDA File Details and Hex for r5.
PryIDA File Details and Hex for r5.

02 Find the decision in main

Analyze main and check_password with REA. In Pseudocode, find the call from main to check_password. Main uses the return value to select its success message. Start inside that call, where the input is actually checked.

PryIDA Pseudocode for main in r5.
PryIDA Pseudocode for main in r5.

03 Find the two arrays that change

Read check_password. It compares lengths first, then copies your input over buf. The text that starts in buf supplies a length. Follow the read from delta through the loop. Its 40 file bytes are the starting amounts removed at each position.

Hex offset 0x10a0 · Virtual address 0x6010a0 · 40 bytes

PryIDA Hex selection at 0x10a0 in r5.
PryIDA Hex selection at 0x10a0 in r5.
PryIDA Pseudocode for check_password in r5.
PryIDA Pseudocode for check_password in r5.

04 Compare the two subtractions

At each position with a nonzero delta, the loop subtracts the same amount from delta and from buf. Imagine two counters that both go down by three. Their difference stays the same. Each delta counter reaches zero, so the total removed from each input byte is its original delta.

Hex offset 0x743 · Virtual address 0x400743 · 3 bytes

PryIDA Hex selection at 0x743 in r5.
PryIDA Hex selection at 0x743 in r5.

05 Read the final comparison target

The call to strcmp compares the changed buf with master. Follow the master pointer to the string in the file. At each position we need input minus original delta to land on this target byte.

Hex offset 0x8a8 · Virtual address 0x4008a8 · 40 bytes

PryIDA Hex selection at 0x8a8 in r5.
PryIDA Hex selection at 0x8a8 in r5.

06 Add back the original deltas

A byte wraps after 255. Add the target byte and original delta, then keep the low eight bits. At position zero, the target is 0x74 and the delta is 0x03. Their sum is 0x77, the letter w. The independent replay follows the same loop for all 40 positions and confirms that the resulting buffer equals master.

Hex offset 0x771 · Virtual address 0x400771 · 3 bytes

PryIDA Hex selection at 0x771 in r5.
PryIDA Hex selection at 0x771 in r5.
Reveal the solution

well_done_now_go_on_irc_and_ask_for_more

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