libc指定版本配置
本文最后更新于 2022年1月22日 下午
libc 版本的指定
需要用到 patchelf 和 glibc-all-in-one
patchelf 的安装:
git clone https://github.com/NixOS/patchelf/
cd patchelf
ls
./bootstrap.sh
如果报错则sudo apt-get install autoconf automake libtool
继续执行:
./bootstrap.sh
./configure
make
make check
sudo make install
glibc-all-in-one 的安装:
git clone https://github.com/matrix1001/glibc-all-in-one.git
cd glibc-all-in-one
有可能需要配置软连接到 python:
cd /usr/bin
ln -s /usr/bin/python3.8 python
再运行./update_list
更新到列表 ; cat list
即可看到 libc 列表
下载所需:
download list
download_old old_list
使用场景:
- 根据题目所给的 libc ,找对应版本的连接器(e.g. 2.27-3ubuntu1.6_amd64)
./download 2.27-3ubuntu1.6_amd64
- 然后把 ld 文件和 libc 复制到 pwn 题目录下
cd ./libs/2.27-3ubuntu1.6_amd64/
cp ./ld-2.27.so /tmp
cp ./libc-2.27.so /tmp
- 修改解释器和 libc:
ldd pwn
patchelf --set-interpreter ./ld-2.27.so ./pwn
patchelf --replace-needed libc.so.6 ./libc-2.27.so ./pwn
libc指定版本配置
https://k3ppf0r.github.io/2022/01/22/杂/libc指定版本配置/