Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.59 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.59 KB

AFL: ファズがターゲットに渡るまで

前提:forkserverなし

This repository describes how the fuzzing tool AFL sends fuzz to the target binary.

発表スライド

ファジングツールAFLが ターゲットに入力を送る方法 公開版

構成

  • afl-fuzz.c: 疑似afl-fuzz.c
  • target.c: ファジング対象

動作順序

  1. afl-fuzz: .cur_inputに対してファズを書き込む
  2. afl-fuzz: lseekにより、ファイルの読み書き位置を先頭に戻す
    1. 注:ファズの末尾を指している状態であるため、先頭に戻す必要がある
  3. afl-fuzz: 子プロセスのファイルディスクリプタ0(標準入力)を、.cur_inputのファイルディスクリプタで上書きする(dup2(out_fd, 0))
  4. afl-fuzz: 子プロセスは、execによってターゲットを起動する
    1. 注:exec後もファイルディスクリプタは継承される
  5. target: 標準入力から文字を取得する
    1. このとき、ファイルディスクリプタ0は.cur_inputのファイルディスクリプタで上書きされているため、.cur_inputの中身を読み込む
  6. target: 読み込んだ文字列をout.txtに書き込む

Usage

$ ./make
$ ./afl-fuzz
parent process
child process
Hello,World!
child process exit
$ cat ./out.txt
Hello,World!

ref