$ cat writeup.md…
$ cat writeup.md…
hackthebox
Task: Exploit a 32-bit binary with gets() buffer overflow to call a flag-printing function with correct parameters. Solution: Overflow 188 bytes to overwrite EIP with the flag() function address, place magic values 0xdeadbeef and 0xc0ded00d on the stack as cdecl arguments after a fake return address.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
A classic binary exploitation challenge where you are given a 32-bit ELF binary called "vuln" and a remote target to exploit. The binary has a buffer overflow vulnerability that must be exploited to call a hidden flag-printing function with the correct magic parameters.
File: ELF 32-bit, dynamically linked, not stripped
Security:
Key functions (via objdump):
vuln() at 0x08049272 — contains gets() call (buffer overflow)flag() at 0x080491e2 — reads and prints flag.txt, but requires correct parametersvuln() allocates a buffer at ebp - 0xb8 (184 bytes)gets() on this buffer — unbounded read, classic stack buffer overflowflag(param1, param2) function logic:
fopen()fgets() (64 bytes)param1 == 0xdeadbeef AND param2 == 0xc0ded00dprintf() to print the flagBuffer overflow math:
ebp - 0xb8)vuln() to overwrite the saved return address (EIP)flag() function0xdeadbeef, 0xc0ded00d) at the correct stack positionsPayload layout (32-bit cdecl):
[188 bytes padding] [flag() addr] [fake return] [param1] [param2]
'A' * 188 0x080491e2 'BBBB' 0xdeadbeef 0xc0ded00d
...
$ grep --similar