247CTF - The Encrypted Password
The encrypted password
Challenge prompt:
You won't find the admin's secret password in this binary. We even encrypted it with a secure one-time-pad. Can you still recover the password?
1. Quick dynamic check with
ltrace
The retained ltrace excerpt shows the input and
comparison calls. Its strcmp string is a tracer-truncated
display, not Python or a complete executable source listing.
1 | $ ltrace ./encrypted_password |
This already hints that the expected secret is a printable 32-byte string.
2. Or debug in debugger
(pwndbg)
The retained debugger excerpt uses a breakpoint at
strcmp (0x555555400930); this address depends
on the loaded executable and ASLR mapping.
1 | pwndbg> b *0x555555400930 |
At compare time, s2 contains the final password
candidate.
3. Or reverse logic in IDA
Relevant decompiled logic:
1 | strcpy(s, "875e9409f9811ba8560beee6fb0c77d2"); |
The excerpt records the XOR construction and comparison.
fgets(s1, 33, stdin) can read exactly 32 bytes before the
terminating NUL, leaving a typed newline unread; the 32-byte candidate
should be supplied without an extra newline in the compared buffer. The
original executable is unavailable, so the comparison path has not been
rerun.
Reconstruct the secret with Python
1 | import struct |