libc指定版本配置

本文最后更新于 2022年1月22日 下午

libc 版本的指定

需要用到 patchelfglibc-all-in-one
patchelf 的安装:

1
2
3
4
git clone https://github.com/NixOS/patchelf/
cd patchelf
ls
./bootstrap.sh

如果报错则sudo apt-get install autoconf automake libtool
继续执行:

1
2
3
4
5
./bootstrap.sh
./configure
make
make check
sudo make install

glibc-all-in-one 的安装:

1
2
git clone https://github.com/matrix1001/glibc-all-in-one.git
cd glibc-all-in-one

有可能需要配置软连接到 python:

1
2
cd /usr/bin
ln -s /usr/bin/python3.8 python

再运行./update_list更新到列表 ; cat list 即可看到 libc 列表
下载所需:

1
2
download list
download_old old_list

使用场景:

  1. 根据题目所给的 libc ,找对应版本的连接器(e.g. 2.27-3ubuntu1.6_amd64)
1
./download 2.27-3ubuntu1.6_amd64
  1. 然后把 ld 文件和 libc 复制到 pwn 题目录下
1
2
3
cd ./libs/2.27-3ubuntu1.6_amd64/
cp ./ld-2.27.so /tmp
cp ./libc-2.27.so /tmp
  1. 修改解释器和 libc:
1
2
3
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指定版本配置/
作者
k3ppf0r
发布于
2022年1月22日
许可协议