The Challenge
The sequel to Doge Ransom. Now the binary has actual authentication: hardcoded credentials for the employee account, and a separate ADMIN account whose password is generated at runtime and stored in memory. The IBAN overflow is still there, but the binary is full-Canary-free — the only protection is that ADMIN’s password is not printed anywhere.
Approach
The IBAN buffer still overflows, but this time the goal is not a direct flag. The plan:
- Log in with the known employee credentials (
Dr. Bez Casamiei/Team-fortezza-10). - Overflow the IBAN field with a ROP chain that calls
puts(got['puts'])to leak theputsaddress from the GOT, then returns tologin. - Read the leaked 6-byte puts pointer, pad to 8 bytes — that is ADMIN’s password stored in the binary’s data section at
0x406240 + 32. - Re-login as
ADMINusing that password bytes. - Log out and back in again as the employee, repeat the IBAN overflow a second time — this time the ADMIN-unlocked path is open — to get the flag.
The ROP gadget at 0x40224b is pop rdi; ret. The payload is b'\x00' + b'\x00' * padding + pop_rdi + got_puts + plt_puts + pop_rdi + 0x406260 + login.
Solution
|
|
The first overflow leaks ADMIN’s password byte-for-byte via puts. The received line is raw bytes — passed directly to the second login prompt. The second login with ADMIN credentials unlocks the logout path (option 6 → Y). The third overflow is identical to the first but now, with the admin session already consumed, execution falls through to the flag-printing code.
What I Learned
Multi-phase exploitation is the norm once programs have real authentication. Leaking runtime secrets through ROP is the same primitive as ret2puts for libc — here the target is data in the binary’s own BSS rather than a shared library. Each phase hands the next one the knowledge it needs.