Where Do the Offsets Come From?
- You need the same libc the target runs. Offsets differ between versions and even builds.
- From a local copy of the libc file, read symbol offsets with the pwntools
ELFclass, or withreadelf/nm. - If you only have a leaked value and do not know the libc, use a libc-database (e.g. libc.rip / the local
libc-databasetool): the low 12 bits of a symbol address are not randomized, so a couple of leaks identify the exact build.
Fixed vs. randomized
ASLR shifts everything by a page-aligned base, so the low 12 bits of any
address are constant. That is why partial leaks are enough to fingerprint
a libc.