DL·SYS
Contact ↗

CSCTF 2026 · Pwn · 540 pts

sigil.

A static, non-PIE binary with exactly one syscall gadget and no pop rdi — the read length itself becomes the register you need.

SROPret2syscall
EventCSCTF 2026, Operation Dawn (online jeopardy)
CategoryPwn
Points540
StatusSolved during the event
TargetLive TCP service

TL;DR. sigil's only usable gadget is a bare syscall; ...; ret, with no way to directly control rax for the syscall number. Making a second call into listen() return exactly 15 bytes read sets rax=15 (the return value of read), which is exactly the syscall number for rt_sigreturn — turning one gadget into a full SROP primitive.

Challenge

A static, non-PIE, -nostdlib binary with no canary. listen() reads 0x400 bytes into a 0x40-byte buffer, overflowing the return address.

Solution

There is exactly one syscall gadget in the binary (0x401024: syscall; mov [rbp-8],rax; mov rax,[rbp-8]; pop rbp; ret) and no pop rdi, so the usual ret2syscall approach has no way to set the syscall number directly. The trick: overflow the return address to call listen() (0x401030) a second time, and this time make its internal read(0, buf, 0x400) return exactly 15 bytes — by sending only 15 bytes and sleeping briefly so the next read call doesn't get more data appended. read's return value ends up in rax, so rax is now 15: the syscall number for rt_sigreturn.

Frame 1 is the pending read(0, &.bss, 0x400) call with the controlled stack already in place. The gadget's tail chains into a second rt_sigreturn frame, loaded from a BSS address, which restores registers for a final execve("/bin/sh", NULL, NULL) and a shell pops. The exploit is deterministic (8/8 locally and 8/8 over a raw TCP socket).

Flag

FlagCSCTF{d8ToM45oF1YGYfvp56CNC6Ko}

What I took from it