记glibc-all-in-one使用

参考

glibc-all-in-one

glibc-all-in-one下载

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

glibc-all-in-one安装

1
2
3
sudo python3 update_list
[+] Common list has been save to "list"
[+] Old-release list has been save to "old_list"

下载glibc

list

image-20211012172502704

1
sudo ./download 2.31-0ubuntu9_amd64

old_list

和上面差不多

image-20211012172551035

1
sudo ./download_old 2.23-0ubuntu11.3_amd64

patchelf

patchelf下载

1
2
git clone https://github.com/NixOS/patchelf.git
cd patchelf

patchelf安装

这里我的ubuntu16没有报错,挺顺利

1
2
3
4
5
6
./bootstrap.sh //如果报错 ./bootstrap.sh: 2: autoreconf: not found                 
//执行这个 sudo apt-get install autoconf automake libtool
./configure
make
make check
sudo make install

实际应用

1
~/glibc-all-in-one$ sudo ./download 2.27-3ubuntu1_amd64

打开隐藏文件

Ctrl + h

可以先在这个目录下 pwd一下

image-20211012180509161

image-20211012180244757

解压下载的deb包到.debug

1
2
~/glibc-all-in-one/debs$ sudo dpkg -X [libc6_2.27-3ubuntu1_amd64.deb] /home/trick/glibc-all-in-one/libs/[2.27-3ubuntu1_amd64]/.debug
# 修改[ ]中的内容

然后利用patchelf工具修改elf程序所需的动态链接库

1
2
3
4
5
patchelf --set-interpreter /home/trick/glibc-all-in-one/libs/[2.27-3ubuntu1_amd64]/[ld-2.27.so] ./ciscn_final_3
patchelf --replace-needed libc.so.6 /home/trick/glibc-all-in-one/libs/[2.27-3ubuntu1_amd64]/[libc-2.27.so] ./ciscn_final_3
# 修改[ ]中的内容
patchelf --set-interpreter /home/trick/tools/glibc-all-in-one/libs/[2.27-3ubuntu1_amd64]/[ld-2.27.so] ./ciscn_final_3
patchelf --replace-needed libc.so.6 /home/trick/tools/glibc-all-in-one/libs/[2.27-3ubuntu1_amd64]/[libc-2.27.so] ./ciscn_final_3

glibc2.34

1
2
3
4
5
patchelf --set-interpreter /home/trick/tools/glibc-2.34/glibc-2.34/64/lib/ld-linux-x86-64.so.2 ./pwn
patchelf --replace-needed libc.so.6 /home/trick/tools/glibc-2.34/glibc-2.34/64/lib/libc.so.6 ./pwn

patchelf --set-interpreter ./ld.so ./pwn
patchelf --replace-needed libc.so.6 ./libc.so.6 ./pwn