Retro2Win

Writeup for Retro2Win (Pwn) - 1337UP LIVE CTF (2024) 💜

Video Walkthrough

VIDEO

Challenge Description

So retro.. So winning..

Solution

I'm going to skip over some of the steps, because I cover in more detail in the video walkthrough and the approach is the same as Rigged Slot Machine (disassemble, find offset etc).

Anyway, the binary has no canaries and PIE is disabled.

checksec --file retro2win
[*] '/home/crystal/Desktop/challs/pwn/Retro2Win/solution/retro2win'
    Arch:     amd64-64-little
    RELRO:    Partial RELRO
    Stack:    No canary found
    NX:       NX enabled
    PIE:      No PIE (0x400000)

Here's what the functionality looks like.

Nothing! If we disassemble the code, we will find a hidden menu option 1337.

Nothing will work though, that's because the enter_cheatcode() function looks like this.

Spot the buffer overflow? Yes, but no flag. Check out this other cheat_mode function though.

There are no execution paths to this function, so we need to exploit the buffer overflow to redirect the program execution. However, we also need to ensure the correct key1 and key2 are provided. Essentially, we have a ret2win challenge with parameters. Here's a solve script I put together.

solve.py

For some reason, it only comes through in the debug. Not sure if this is down to my exploit, the config on the server env (maybe the socat command in the dockerfile) or the C code itself. I CBA to debug, you'll work it out! 😅

Flag: INTIGRITI{3v3ry_c7f_n33d5_50m3_50r7_0f_r372w1n}

If you want to learn more about binary exploitation, check out my beginner series!

Last updated