https://wogh8732.tistory.com/272
AFL 설치
wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
tar -xvf afl-latest.tgz
cd afl-2.52b/
make
sudo make install
퍼징할 프로그램 dact 설치
https://fossies.org/linux/privat/old/dact-0.8.42.tar.gz/cloc.html
tar -xvf dact-0.8.42.tar.gz
make clean (맨처음 실행하면 이건 안해도 됨)
CC=[afl folder]/afl-2.52b/afl-gcc ./configure (컴파일을 afl-gcc로 하겠다)
make
input 데이터 만들어서 퍼징하기
echo hello > hello.txt
./dact hello.txt (hello.txt.dct 생성됨)
mkdir input
mv hello.txt.dct input/
sysctl -w kernel.core_pattern=core
[afl folder]/afl-fuzz -i input -o output -- ./dact -dcf (압축해제하는 기능 기준으로 퍼징)
퍼징 결과 파악하기
퍼징을 하면 /output/crashes에 여러 파일들이 저장된다.xxd로 확인해보면 퍼징할 때 input으로 넣었던 hello.txt.dct와 비슷한 꼴임을 알 수 있다.
압축된 형태인 것 같으니까 dact명령어로 그냥 압축해제 시도
그랬더니 퍼징할 때의 에러를 표시하는 것 같다...
AFL output 디렉터리
- crashes : 실제 seg fault 등이 나왔을 때의 unique input 파일
- queue : 각 path별 입력값들
- hangs : 지정된 시간을 지났을 때까지 멈췄었던 input 데이터 케이스를 확인할 수 있다.
llvm_mode 사용하기(ASAN과 관련있는 것 같은데 추후 추가할 것)
- llvm mode로 컴파일하는 목적
- 성능 향상
# vi /etc/apt/sources.list 에다가 아래 내용 추가
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt install clang
cd ./llvm_mode
sudo ln -s /usr/bin/llvm-config-4.0 /usr/local/bin/llvm-config
sudo ln -s /usr/bin/clang-4.0 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-4.0 /usr/local/bin/clang++
export AFL_USE_ASAN=1
export PATH=/usr/lib/llvm-10/bin:$PATH
make clean all
cd dact-0.8.42/
CC=../AFL/afl-2.52b/afl-clang-fast ./configure (configure가 있는/ test하려는 프로그램 소스 디렉터리로 가서 해야함)
make
sudo make install
https://wogh8732.tistory.com/272
읽어볼거리
https://medium.com/@ayushpriya10/fuzzing-applications-with-american-fuzzy-lop-afl-54facc65d102
https://cpuu.postype.com/post/3419500
'정보보안 > fuzzing' 카테고리의 다른 글
[실험] AFL/AFL++ 실험설계 및 수행 (0) | 2022.01.21 |
---|---|
[최종 정리] AFL의 특징과 AFL++의 개선방안 (0) | 2022.01.13 |
[논문 정리] Steelix: Program-State Based Binary Fuzzing (0) | 2022.01.11 |
[논문 정리] AFL++: Combining Incremental Steps of Fuzzing Research (0) | 2022.01.10 |
AFL 이해를 위한 기본 개념 (0) | 2022.01.07 |
댓글