In this specific challenge, many players ran into a common 64-bit exploitation issue: . The win() function likely calls system() , which requires the stack to be 16-byte aligned. If your exploit crashes at the movaps instruction inside system() , adding a dummy ret gadget (as shown in the script above) before the win_addr usually fixes the issue. Summary for a Blog Post Difficulty: Easy/Beginner. Key Concept: Stack Buffer Overflow & Stack Alignment. Tools Used: pwntools , gdb-pwndbg , checksec .
Below is a breakdown of the exploitation process, which would make for an excellent technical blog post:
The program will crash. Check the offset of the value in the $rsp register to determine the padding (usually around 40–72 bytes depending on the local variables).
: There is a hidden function in the code, typically named win() or secret_weapon() , that prints the flag. Your goal is to redirect execution to this address. 2. Finding the Offset
Using a tool like checksec , you’ll notice that is enabled, but there is no Stack Canary . This suggests a classic stack-based buffer overflow.
Once you have the offset and the address of the win() function (found via info functions in GDB or nm binary ), you can write a simple Python exploit using the library:
The file is a challenge from the pwn category of the DeadSec CTF 2024 . To solve it, you need to exploit a buffer overflow vulnerability to execute a "ret2win" attack, redirected by a specific game mechanic within the binary.