How to calculate the address of a function in the LIBC, when ASLR is not active.
I only have the address where to load the LIBC (with ldd /bin/bash
).
Thank you for the explanations
EDIT:
When I use your method I do not get the good result, although it is good in general (I do not understand why)
libc base adress
ldd ch33
linux-gate.so.1 => (0xb7fff000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7e46000)
/lib/ld-linux.so.2 (0x80000000)
system offset:
gdb -q /lib/i386-linux-gnu/libc.so.6
gdb$ print system
$1 = {<text variable, no debug info>} 0x40310 <__libc_system>
I then calculate 0x40310 + 0xb7e46000 = 0xb7e86310
However, i should get 0xb7e64310
because:
~$ gdb ch33
gdb$ r
Starting program: /challenge/app-systeme/ch33/ch33
...
gdb$ p system
$1 = {<text variable, no debug info>} 0xb7e64310 <__libc_system>