Fpicker:一款支持多種模式的模糊測試工具套件
關于Fpicker
Fpicker是一款基于Frida的模糊測試套件,可以幫助廣大研究人員以多種模式來進行滲透測試,例如AFL++模式或被動追蹤模式等。值得一提的是,該工具可以在所有支持Firda的系統平臺上運行。
工具要求
Fpicker運行要求
frida_compile
frida-core-devkit
AFL++模式要求
macOS:
使用“CFLAGS=”-DUSEMMAP=1””編譯。
iOS:
應用aflpp-ios.patch,Fpicker需要在iOS上以root用戶身份運行,如果目標不是以root用戶身份運行,它將無法讀取和寫入共享內存。接下來,使用“CFLAGS=”-DUSEMMAP=1””編譯。
工具安裝
廣大研究人員可以使用下列命令將該項目源碼克隆至本地:
git clone https://github.com/ttdennis/fpicker.git
項目構建和運行
Fpicker可以在macOS、iOS或Linux平臺上運行。Makefile當前僅支持針對iOS和macOS平臺進行構建,但我們也可以使用iOS工具鏈來針對Linux平臺進行項目構建。
make fpicker-macos make fpicker-ios make fpicker-linux
項目構建完成之后,我們就可以繼續構建模糊測試組件了。
首先,我們需要針對目標創建一個自定義模糊測試組件(例如examples/test/test.js)。
接下來,使用frida-compile編譯自定義組件:
frida-compile test.js -o harness.js
現在,Fpicker就可以開始對目標進行模糊測試了。具體要執行的命令取決于我們的配置。接下來,我們會給出一些簡單的使用樣例,大部分樣例都在項目中的“examples”目錄中給出了。
以AFL++代理運行Fpicker,并跟目標進程綁定,然后測試指定功能函數:
afl-fuzz -i examples/test-network/in -o ./examples/test-network/out -- \\./fpicker --fuzzer-mode afl -e attach -p test-network -f ./examples/test-network/harness.js
以單獨模式運行Fpicker,跟服務器綁定,運行一個客戶端程序來發送模糊測試輸出:
./fpicker --fuzzer-mode standalone -e attach -p server-process -f harness.js --input-mode cmd \\--command "./client-send @@" -i indir -o outdir
以單獨模式運行Fpicker,跟服務器綁定,使用自定義變異cmd進行模糊測試:
./fpicker --fuzzer-mode active --communication-mode shm -e attach -p server-process -f harness.js \\-i indir -o outdir --standalone-mutator cmd --mutator-command "radamsa"
以單被動模式運行Fpicker,跟服務器綁定,收集覆蓋率和Payload:
./fpicker --fuzzer-mode passive --communication-mode send -e attach -p server-process -o outdir -f harness.js
以單獨模式運行Fpicker,跟遠程設備上一個正在運行綁定,使用自定義變異cmd進行模糊測試:
./fpicker --fuzzer-mode active -e attach -p test -D remote -o examples/test/out/ -i examples/test/in/ \\-f fuzzer-agent.js --standalone-mutator cmd --mutator-command "radamsa"
創建自定義模糊測試組件
我們需要針對不同的目標創建自定義模糊測試組件。下面給出的是一個組件實現樣例:
// Import the fuzzer base class
const Fuzzer = require("harness/fuzzer.js");// The custom fuzzer needs to subclass the Fuzzer class to work properly
class TestFuzzer extends Fuzzer.Fuzzer {
constructor() {
// The constructor needs to specify the address of the targeted function and a NativeFunction
// object that can later be called by the fuzzer. const FUZZ_FUNCTION_ADDR = Module.getExportByName(null, "FUZZ_FUNCTION");
const FUZZ_FUNCTION = new NativeFunction(
FUZZ_FUNCTION_ADDR,
"void", ["pointer", "int64"], {
});
super("test", FUZZ_FUNCTION_ADDR, FUZZ_FUNCTION); }
}
const f = new TestFuzzer();
exports.fuzzer = f;
參考資料
https://insinuator.net/2021/03/fpicker-fuzzing-with-frida/
https://frida.re/docs/javascript-api/#stalker
https://github.com/AFLplusplus/AFLplusplus/
https://github.com/frida/frida-compile
https://github.com/frida/frida/releases