$ cat writeup.md…
$ cat writeup.md…
hackthebox
Task: Exploit a 64-bit binary with buffer overflow but no output functions (only read() in PLT). Solution: Use ret2dlresolve technique via pwntools Ret2dlresolvePayload to craft fake ELF dynamic linker structures that trick _dl_runtime_resolve into resolving system("/bin/sh"), bypassing the need for a libc leak.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
64-bit ELF binary with a simple buffer overflow vulnerability. The challenge is that there are no output functions (puts/printf/write) in the binary - only read(). This makes traditional libc leaking impossible.
Binary properties:
The vulnerable function is trivial:
void vuln() { char data[64]; read(0, data, 200); // reads 200 bytes into 64-byte buffer }
Offset calculation:
The problem: Without output functions, we cannot leak libc addresses for a traditional ret2libc attack.
ret2csu + partial GOT overwrite to system() - Tried overwriting read@got with system using 3-byte partial overwrite. Theoretically should work but failed after 300+ attempts due to ASLR randomization.
ret2csu + one-gadget (0xc9611) - One-gadget constraints weren't satisfied in the execution context.
SROP - Too complex for this challenge, requires specific register setup.
ret2dlresolve is the perfect technique when:
read() to write arbitrary data to memoryThe dynamic linker resolves function addresses lazily. When a function is called for the first time, it goes through PLT -> GOT -> _dl_runtime_resolve(). We can craft fake structures (Elf64_Sym, Elf64_Rela) that tell the linker to resolve system instead of a legitimate function.
read(0, bss_area) to write our crafted dlresolve structuressystem("/bin/sh")...
$ grep --similar