Learn_malloc.c_before

一、环境部署:

1
2
3
4
5
#注释头

docker pull ubuntu:16.04
docker pull ubuntu:18.04
docker pull ubuntu:20.04

二、环境安装:

1.apt换源,docker换源,pip换源。

2.安装前置包:

1
2
3
4
5
6
7
8
9
10
#注释头

sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install libmysqlclient-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install python-dev
sudo apt-get install libffi-dev
sudo apt-get install libssl-dev

3.安装python好多步部曲:

1
2
3
4
5
6
7
8
9
10
#注释头

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
(wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz)
tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure --prefix=/usr/local/python27
make
make install
ln -s /usr/local/python27/bin/python /usr/bin/python2

4.安装setuptools四部曲:

1
2
3
4
5
6
#注释头

wget https://pypi.python.org/packages/45/29/8814bf414e7cd1031e1a3c8a4169218376e284ea2553cc0822a6ea1c2d78/setuptools-36.6.0.zip#md5=74663b15117d9a2cc5295d76011e6fd1
unzip setuptools-36.6.0.zip
cd setuptools-36.6.0
python2 setup.py install

5.安装pip四部曲:

1
2
3
4
5
6
7
#注释头

wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
tar -zxvf pip-9.0.1.tar.gz
cd pip-9.0.1
python2 setup.py install
ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip2

6.安装pwndbg三部曲:

1
2
3
4
5
#注释头

git clone https://github.com/pwndbg/pwndbg
cd pwndbg
./setup.sh

7.添加pwngdb:

1
2
3
4
5
6
7
#注释头

cd ~
git clone https://github.com/0xKira/pwngdb.git
vim ~/.gdbinit
#将peda注释,添加:(必须加在第一行)
source ~/pwndbg/gdbinit.py

8.安装pwntools一步曲:

1
2
3
4
#注释头

pip2 install pwntools
pip3 install pwntools

三、准备源码:

1
2
3
#注释头

http://ftp.gnu.org/gnu/glibc/

挂飞机下gz包老快了,找到里面的malloc.c准备开始阅读。

四、跟着CTFwiki一步步调试:

https://wiki.x10sec.org/pwn/linux/glibc-heap/chunk_extend_overlapping-zh/

五、视频调试:

https://www.bilibili.com/video/BV1q5411h7Wf