Skip to content
All tools
Binary exploitationRuns locallyNo account

Libc base address calculator

Turn a leaked libc pointer into the library’s base address, then resolve any other symbol - the arithmetic every ret2libc exploit runs on.

Open in ctfpal

ASLR randomises where libc is loaded, but only the base - the internal layout is fixed by the build. So one leaked pointer into libc reveals everything: subtract the symbol’s known offset to get the base, then add any other symbol’s offset to locate it.

libc_base   = leaked_puts - libc.symbols['puts']
system_addr = libc_base + libc.symbols['system']
binsh_addr  = libc_base + next(libc.search(b'/bin/sh'))

Identifying the libc version

The offsets differ between builds, so the arithmetic requires the exact libc the target uses. When a challenge does not provide the binary, the standard technique is to leak two or three symbol addresses and match their low twelve bits - which ASLR does not randomise, because pages are aligned - against a database of known builds. That fingerprint identifies the version uniquely in almost every case.

Part of a module

10. Binary exploitation

Read a binary’s protections, find an overflow offset in one crash, and build a ROP chain when the stack is not executable.

Practise on real challenges

Go deeper

Related tools