这道题一个”难点”所在,当我们知道libc的函数地址,可以使用libcdb这个网站来查询目标所使用的libc版本及其他信息,但是,上次问鼎的断网环境把我打怕了,于是又在网上找了离线版本~ https://github.com/niklasb/libc-database 它的原理就是分析所有libc库文件,建立函数与地址对照表,因为随机化对低12字节没有影响,所以可以通过泄露的低12字节来匹配版本,不过由于ctf比赛大多是使用Ubuntu服务器,官方只提供了Ubuntu的支持,下面是使用方法: Fetch all the configured libc versions and extract the symbol offsets. It will not download anything twice, so you can also use it to update your database:
$ ./get
You can also add a custom libc to your database.
$ ./add /usr/lib/libc-2.21.so
Find all the libc’s in the database that have the given names at the given addresses. Only the last 12 bits are checked, because randomization usually works on page size level.
$ ./find printf 260 puts f30
archive-glibc (id libc6_2.19-10ubuntu2_i386)
Find a libc from the leaked return address into __libc_start_main.
$ ./find __libc_start_main_ret a83
ubuntu-trusty-i386-libc6 (id libc6_2.19-0ubuntu6.6_i386)
archive-eglibc (id libc6_2.19-0ubuntu6_i386)
ubuntu-utopic-i386-libc6 (id libc6_2.19-10ubuntu2.3_i386)
archive-glibc (id libc6_2.19-10ubuntu2_i386)
archive-glibc (id libc6_2.19-15ubuntu2_i386)
Dump some useful offsets, given a libc ID. You can also provide your own names to dump.