$ cat writeup.md…
$ cat writeup.md…
sunshinectf2026
Task: tiny static stripped no-libc x86-64 ELF with a stack leak and a 1024-byte overflow but no register-loading ROP gadgets and an enforced NX stack. Solution: SROP — use a read gadget whose return value sets rax to 15 (rt_sigreturn), then a sigreturn frame invokes execve('/bin/sh').
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Total Recall nc chal.sunshinectf.games 26003
English summary: A minimal statically-linked, stripped, no-libc x86-64 binary leaks a stack address and then grants a large stack overflow with full RIP control. There are no register-loading gadgets and the remote stack is non-executable, so the intended path is Sigreturn-Oriented Programming (SROP) to build execve("/bin/sh", NULL, NULL).
total_recall: 4416-byte ELF64, statically linked, stripped, only a .text section.0x400000, entry 0x401000, non-PIE.file reports nx=false (no GNU_STACK PT), but the remote kernel enforces a non-executable stack — plain shellcode fails.Program logic:
0x401000: call 0x401016 (leak + small read); call 0x40104f (big read/overflow); then exit(0).0x401016 (stage 1):
push rspmov rsi,rsp ; write(1, rsp, 8) → leaks 8 bytes of stack (the pushed rsp value)pop raxlea rsi,[rsp-0x40] ; read(0, rsp-0x40, 24)ret0x40104f (stage 2):
lea rsi,[rsp-0x80] ; read(0, rsp-0x80, 0x400=1024)ret ← stack buffer overflow, full RIP controlLeak semantics (critical off-by-8 pitfall). push rsp stores the pre-decrement value of RSP. So the leaked value equals S-8, where S is the entry RSP. Therefore S = leak + 8. Assuming S = leak + 16 breaks everything by 8 bytes — this was the initial failed attempt.
Overflow offset. The stage-2 read buffer starts at S - 0x88. The saved return address to overwrite sits at offset 0x80 from that buffer start (buf_start + 0x80). Confirmed by returning into 0x401000 and observing a second identical leak — proving both the offset math and full RIP control.
...