Rigged Slot Machine 2
Writeup for Rigged Slot Machine 2 (Pwn) - 1337UP LIVE CTF (2024) 💜
Video walkthrough
Challenge Description
The casino fixed their slot machine algorithm - good luck hitting that jackpot now!
I mentioned that part 1 of this challenge was an unintended solution I caught before the CTF, so here's what I actually intended to make 😅
Solution
We don't know what the winning condition is yet but since it's a pwn challenges, let's check the binary protections.
checksec --file rigged_slot2
[*] '/home/crystal/Desktop/challs/pwn/RiggedSlotMachine2/solution/rigged_slot2'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: PIE enabledNo canaries, so potentially a buffer overflow for us to exploit. We'll check the disassembled code in ghidra soon. First, let's run the binary and see if it looks different to part 1.
It looks similar, apart from the name entry at the beginning and the terrible odds (try your brute force script from part 1 if you like).
I've renamed some of the variables in ghidra.
Similar to last time, but we need to hit a balance of $1,337,420 within the 5 minute time limit (I might of reduced to 2-3 mins, can't remember). Checking the odds, they are terrible 😫
Soooo.. Back to this buffer overflow! The name buffer shows as 20 bytes in ghidra, but there is no limit to how much the user can provide (dangerous gets() function).
Let's test this! Enter a long string (over 20) as the name and play some games.
That's a lot of money!! We overwrite the balance on the stack 😌 We need exactly 1337420 though, let's automate it into a script.
solve.py
Give it a run ✅
Flag: INTIGRITI{1_w15h_17_w45_7h15_345y_1n_v3645}
Last updated
