Debug Free Bug란?
free함수로 청크를 해제하면, ptmalloc2는 이를 tcache나 bins에 추가하여 관리합니다. 이후 malloc으로 비슷한 크기의 동적 할당이 발생하면, 이 연결 리스트들을 탐색하여 청크를 재할당합니다.
해당 메커니즘을 이용하여 free로 해제한 청크를 free로 다시 해제했을 때 발생하는 현상을 바탕으로 duplicated free list를 이용하여 임의 주소에 청크를 할당할 수 있습니다.
FROM ubuntu:18.04
ENV PATH="${PATH}:/usr/local/lib/python3.6/dist-packages/bin"
ENV LC_CTYPE=C.UTF-8
RUN apt update
RUN apt install -y \
gcc \
git \
python3 \
python3-pip \
ruby \
sudo \
tmux \
vim \
wget
# install pwndbg
WORKDIR /root
RUN git clone https://github.com/pwndbg/pwndbg
WORKDIR /root/pwndbg
RUN git checkout 2023.03.19
RUN ./setup.sh
# install pwntools
RUN pip3 install --upgrade pip
RUN pip3 install pwntools
# install one_gadget command
RUN gem install one_gadget
WORKDIR /rootdocker build -t abc .
docker exec -it /bin/bashDouble Free Bug
같은 청크를 두 번 해제할 수 있는 버그를 Double Free Bug라고 말합니다.