ASLR 是否启用了 libc 随机函数地址?
Does ASLR enabled libc randomize function address?
这是一个关于 ASLR 的基本问题
如果我有一个没有启用 ASLR 的二进制文件。但是,它使用的libc文件启用了ASLR,那么libc文件中system()的地址每次都会随机化吗?
或者地址每次都相同,因为主二进制文件本身没有启用 ASLR?
在 gdb 中,我正在获取 system() 函数的地址,如下所示:
(gdb) break main
(gdb) run
(gdb) print &system
那么,这个 return 来自 libc 的 system() 地址还是主二进制文件的 PLT?
另外,如果我有一个来自另一个系统的libc文件,那么我如何才能找到里面的system()地址呢?默认情况下,如果我在主二进制文件上使用 运行 gdb,它将在本地系统上找到 libc 的 system() 地址。我是否必须告诉 gdb 加载 libc 文件(我从远程系统获得的)?
However, the libc file it uses has ASLR enabled, then will the address of system() in libc file be randomized every time?
是(假设您没有通过其他方式禁用 ASLR)。请注意,GDB 默认禁用 ASLR。如果你想在 运行 你的程序在 GDB 下观察 ASLR 效果,你需要 set disable-randomization off
.
Also, if I have a libc file from another system, then how can I find the address of system() inside it?
这很简单:nm libc.so.6 | grep ' system'
。但是,这只会告诉您 libc.so.6
内的偏移量 ,您还需要知道 libc.so.6
在其他系统上的加载位置。
This answer可能对你有帮助。
这是一个关于 ASLR 的基本问题
如果我有一个没有启用 ASLR 的二进制文件。但是,它使用的libc文件启用了ASLR,那么libc文件中system()的地址每次都会随机化吗?
或者地址每次都相同,因为主二进制文件本身没有启用 ASLR?
在 gdb 中,我正在获取 system() 函数的地址,如下所示:
(gdb) break main
(gdb) run
(gdb) print &system
那么,这个 return 来自 libc 的 system() 地址还是主二进制文件的 PLT?
另外,如果我有一个来自另一个系统的libc文件,那么我如何才能找到里面的system()地址呢?默认情况下,如果我在主二进制文件上使用 运行 gdb,它将在本地系统上找到 libc 的 system() 地址。我是否必须告诉 gdb 加载 libc 文件(我从远程系统获得的)?
However, the libc file it uses has ASLR enabled, then will the address of system() in libc file be randomized every time?
是(假设您没有通过其他方式禁用 ASLR)。请注意,GDB 默认禁用 ASLR。如果你想在 运行 你的程序在 GDB 下观察 ASLR 效果,你需要 set disable-randomization off
.
Also, if I have a libc file from another system, then how can I find the address of system() inside it?
这很简单:nm libc.so.6 | grep ' system'
。但是,这只会告诉您 libc.so.6
内的偏移量 ,您还需要知道 libc.so.6
在其他系统上的加载位置。
This answer可能对你有帮助。