SnapChange模糊測試工具
SnapChange 是 AWS 名為 Find & Fix 內(nèi)部團隊開發(fā)的一種模糊測試工具,網(wǎng)絡(luò)安全研究人員可以使用它通過在 KVM 虛擬機中重放物理內(nèi)存快照來發(fā)現(xiàn)漏洞。模糊測試通過監(jiān)視系統(tǒng)在處理隨機數(shù)據(jù)時的行為方式來發(fā)現(xiàn)軟件安全問題。
Snapchange 提供了將原始內(nèi)存轉(zhuǎn)儲和注冊狀態(tài)加載到 KVM 虛擬機 (VM) 中以供執(zhí)行的能力。在執(zhí)行過程中,可以通過重置 KVM 發(fā)現(xiàn)的臟頁或模糊器手動弄臟的頁面,將此 VM 重置為初始狀態(tài)。
旨在:
- 使用 KVM 重放物理內(nèi)存和注冊狀態(tài)快照
- 跨多核并行執(zhí)行
- 為 guest VM 提供一組內(nèi)省功能
- 通過斷點覆蓋實時覆蓋狀態(tài)
- 模糊器組件的實時性能指標(biāo)
- 提供模糊測試實用程序,例如單步調(diào)試跟蹤、測試用例最小化和測試用例覆蓋
- 輸入抽象以允許自定義變異和生成策略
示例
從模糊器模板創(chuàng)建目標(biāo)模糊器
$ cp -r -L fuzzer_template your_new_fuzzer
修改your_new_fuzzer/create_snapshot.sh以獲取目標(biāo)的快照
更新src/fuzzer.rs以將變異數(shù)據(jù)注入 guest VM
#[derive(Default)] pub struct TemplateFuzzer; impl Fuzzer for TemplateFuzzer { // The type of Input being fuzzed. Used to know how to generate and mutate useful inputs. type Input = Vec<u8>; // The starting address of the snapshot const START_ADDRESS: u64 = 0x402363; // The maximum length of mutated input to generate const MAX_INPUT_LENGTH: usize = 100; fn set_input(&mut self, input: &Self::Input, fuzzvm: &mut FuzzVm<Self>) -> Result<()> { // Write the mutated input into the data buffer in the guest VM fuzzvm.write_bytes_dirty(VirtAddr(0x402004), CR3, &input)?; Ok(()) } fn reset_breakpoints(&self) -> Option<&[BreakpointLookup]> { Some(&[ // Reset when the VM hits example1!main+0x123 BreakpointLookup::SymbolOffset("example1!main", 0x123) ]) } }
開始使用 16 個內(nèi)核進行模糊測試
$ cargo run -r -- fuzz -c 16
評論
圖片
表情
