Loading...
Loading...
Compare original and translation side by side
| Type | Coverage | Speed | Tools |
|---|---|---|---|
| BlackBox | Poor | Fast | Peach, Boofuzz |
| GreyBox | Good | Fast | AFL++, Honggfuzz, libFuzzer, WinAFL |
| Snapshot | Good | Fastest | Nyx, wtf, Snapchange |
| WhiteBox | Best | Slow | KLEE, QSYM, SymSan |
| Ensemble | Best | Fast | AFL++ + Honggfuzz + libFuzzer |
| 类型 | 覆盖率 | 速度 | 工具 |
|---|---|---|---|
| BlackBox | 较差 | 快 | Peach、Boofuzz |
| GreyBox | 良好 | 快 | AFL++、Honggfuzz、libFuzzer、WinAFL |
| Snapshot | 良好 | 最快 | Nyx、wtf、Snapchange |
| WhiteBox | 最佳 | 慢 | KLEE、QSYM、SymSan |
| Ensemble | 最佳 | 快 | AFL++ + Honggfuzz + libFuzzer |
Research target → Choose analyses → Build harness → Seed corpus → Instrument → Fuzz → Triage crashes → ReportResearch target → Choose analyses → Build harness → Seed corpus → Instrument → Fuzz → Triage crashes → Reportcopy_from_usercopy_from_userundefinedundefined
**Windows (MSVC):** `Project Properties → C/C++ → Address Sanitizer: Yes (/fsanitize=address)`
**Windows(MSVC):** `Project Properties → C/C++ → Address Sanitizer: Yes (/fsanitize=address)`#include <cstdint>
#include <cstddef>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
parse_or_process(data, size);
return 0;
}#include "honggfuzz.h"
int main(int argc, char** argv) {
initialize_target(); // runs once
for (;;) {
size_t len; uint8_t *buf;
HF_ITER(&buf, &len);
FILE* s = fmemopen(buf, len, "r");
target_function(s);
fclose(s);
reset_target_state();
}
}__AFL_LOOPwhile (__AFL_LOOP(10000)) {
// re-read input and process
}void *lib_handle = dlopen("libexample.dylib", RTLD_LAZY);
pFunction = dlsym(lib_handle, "DesiredFunction");#include <cstdint>
#include <cstddef>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
parse_or_process(data, size);
return 0;
}#include "honggfuzz.h"
int main(int argc, char** argv) {
initialize_target(); // runs once
for (;;) {
size_t len; uint8_t *buf;
HF_ITER(&buf, &len);
FILE* s = fmemopen(buf, len, "r");
target_function(s);
fclose(s);
reset_target_state();
}
}__AFL_LOOPwhile (__AFL_LOOP(10000)) {
// re-read input and process
}void *lib_handle = dlopen("libexample.dylib", RTLD_LAZY);
pFunction = dlsym(lib_handle, "DesiredFunction");afl-cmin -i raw_corpus -o seeds -- ./target @@afl-tmin -i crash -o crash.min -- ./target @@afl-cmin -i raw_corpus -o seeds -- ./target @@afl-tmin -i crash -o crash.min -- ./target @@afl-fuzz -M f1 -i seeds -o findings -x dict.txt -- ./target @@
afl-fuzz -S s1 -i seeds -o findings -c 0 -- ./target @@./target_libfuzzer corpus/ -max_total_time=3600 -workers=4afl-fuzz -Q -i seeds -o findings -- target.exe @@NYX_MODE=1 AFL_MAP_SIZE=1048576 afl-fuzz -i seeds -o findings -- ./target_nyx @@undefinedafl-fuzz -M f1 -i seeds -o findings -x dict.txt -- ./target @@
afl-fuzz -S s1 -i seeds -o findings -c 0 -- ./target @@./target_libfuzzer corpus/ -max_total_time=3600 -workers=4afl-fuzz -Q -i seeds -o findings -- target.exe @@NYX_MODE=1 AFL_MAP_SIZE=1048576 afl-fuzz -i seeds -o findings -- ./target_nyx @@undefinedundefinedundefined-c 0-x dict.txtAFL_TOKEN_FILEAFL_MAP_SIZE=1048576-L 0-c 0-x dict.txtAFL_TOKEN_FILEAFL_MAP_SIZE=1048576-L 0undefinedundefined
**Sanitizer env quick reference:**undefined
**Sanitizer 环境变量快速参考:**undefined| Bug Class | Oracle |
|---|---|
| Memory safety | ASan, HWASan (AArch64, lower overhead) |
| Uninitialized reads | MSan |
| Concurrency | TSan |
| Undefined behavior | UBSan |
| Type safety | TypeSan |
| Heap hardening | Scudo Hardened Allocator |
| Logic bugs | Differential / idempotency oracles |
| Kernel memory | KASAN, KMSAN, KCSAN |
| Kernel UB | KUBSan ( |
| CFI | KCFI ( |
| Binary-only | QASAN (QEMU+ASan), DynamoRIO |
f(x) == f(f(x))| 漏洞类别 | Oracle |
|---|---|
| 内存安全 | ASan、HWASan(AArch64,开销更低) |
| 未初始化读取 | MSan |
| 并发问题 | TSan |
| 未定义行为 | UBSan |
| 类型安全 | TypeSan |
| 堆加固 | Scudo Hardened Allocator |
| 逻辑漏洞 | 差分 / 幂等性 Oracle |
| 内核内存 | KASAN、KMSAN、KCSAN |
| 内核 UB | KUBSan( |
| CFI | KCFI( |
| Binary-only | QASAN(QEMU+ASan)、DynamoRIO |
f(x) == f(f(x)){
"target": "linux/arm64",
"http": ":56700",
"workdir": "/path/to/workdir",
"kernel_obj": "/path/to/kernel",
"image": "/path/to/rootfs.ext3",
"sshkey": "/path/to/id_rsa",
"procs": 8,
"enable_syscalls": ["openat$module_name", "ioctl$IOCTL_CMD", "mmap"],
"type": "qemu",
"vm": { "count": 4, "cpu": 2, "mem": 2048 }
}enable_syscallssyz-extractCONFIG_KASAN=yCONFIG_KCFI=yCONFIG_DEBUG_INFO_BTF=ykcovsyz_cover_filterTUN/TAPsyz_emit_ethernet./scripts/decode_stacktrace.sh vmlinux ... < dmesg.logsyz-execprog -repeat=0 -procs=1 -cover=0 -debug target.repro{
"target": "linux/arm64",
"http": ":56700",
"workdir": "/path/to/workdir",
"kernel_obj": "/path/to/kernel",
"image": "/path/to/rootfs.ext3",
"sshkey": "/path/to/id_rsa",
"procs": 8,
"enable_syscalls": ["openat$module_name", "ioctl$IOCTL_CMD", "mmap"],
"type": "qemu",
"vm": { "count": 4, "cpu": 2, "mem": 2048 }
}enable_syscallssyz-extractCONFIG_KASAN=yCONFIG_KCFI=yCONFIG_DEBUG_INFO_BTF=ykcovsyz_cover_filterTUN/TAPsyz_emit_ethernet./scripts/decode_stacktrace.sh vmlinux ... < dmesg.logsyz-execprog -repeat=0 -procs=1 -cover=0 -debug target.reprog_Backend->SetBreakpoint("nt!KeBugCheck2", [](Backend_t *Backend) {
const uint64_t BCode = Backend->GetArg(0);
Backend->Stop(Crash_t(fmt::format("crash-{:#x}", BCode)));
});HANDLE hPort;
FilterConnectCommunicationPort(L"\\PortName", 0, NULL, 0, NULL, &hPort);
FilterSendMessage(hPort, fuzzData, sizeof(fuzzData), NULL, 0, &bytesReturned);HANDLE hDev = CreateFile(L"\\\\.\\DeviceName", GENERIC_READ|GENERIC_WRITE, ...);
DeviceIoControl(hDev, ioctlCode, inputBuf, inputLen, outBuf, outLen, &ret, NULL);DRIVER_VERIFIER_DETECTED_VIOLATION (0xc4)IRQL_NOT_LESS_OR_EQUAL (0xa).symfix; !analyze -v; k; !heap -p -a @rax// Bypass Lua VM to avoid stability issues
insert_function_redirect((void*)luaV_execute_address, my_lua_exec, HOOK_REPLACE_FUNCTION);
for (;;) {
HF_ITER(&buf, &len);
ScanDescriptor.UserPtr = fmemopen(buf, len, "r");
__rsignal(&KernelHandle, RSIG_SCAN_STREAMBUFFER, &ScanParams, sizeof ScanParams);
}g_Backend->SetBreakpoint("nt!KeBugCheck2", [](Backend_t *Backend) {
const uint64_t BCode = Backend->GetArg(0);
Backend->Stop(Crash_t(fmt::format("crash-{:#x}", BCode)));
});HANDLE hPort;
FilterConnectCommunicationPort(L"\\PortName", 0, NULL, 0, NULL, &hPort);
FilterSendMessage(hPort, fuzzData, sizeof(fuzzData), NULL, 0, &bytesReturned);HANDLE hDev = CreateFile(L"\\\\.\\DeviceName", GENERIC_READ|GENERIC_WRITE, ...);
DeviceIoControl(hDev, ioctlCode, inputBuf, inputLen, outBuf, outLen, &ret, NULL);DRIVER_VERIFIER_DETECTED_VIOLATION (0xc4)IRQL_NOT_LESS_OR_EQUAL (0xa).symfix; !analyze -v; k; !heap -p -a @rax// Bypass Lua VM to avoid stability issues
insert_function_redirect((void*)luaV_execute_address, my_lua_exec, HOOK_REPLACE_FUNCTION);
for (;;) {
HF_ITER(&buf, &len);
ScanDescriptor.UserPtr = fmemopen(buf, len, "r");
__rsignal(&KernelHandle, RSIG_SCAN_STREAMBUFFER, &ScanParams, sizeof ScanParams);
}undefinedundefined
Focus unsafe blocks on: `Vec::from_raw_parts`, unchecked indexing, `transmute` size mismatches, pointer arithmetic, FFI integer truncation.
重点检查 unsafe 代码块中的以下问题:`Vec::from_raw_parts`、未经检查的索引、`transmute` 尺寸不匹配、指针运算和 FFI 整数截断。go test -fuzz=Fuzz -run=^$ ./...cargo-fuzzhonggfuzz-rs__builtin_return_address(0)wasmtime-fuzzwaflgo test -fuzz=Fuzz -run=^$ ./...cargo-fuzzhonggfuzz-rs__builtin_return_address(0)wasmtime-fuzzwafl- name: Build with afl-clang-fast
run: CC=afl-clang-fast make -j
- name: Fuzz (smoke, 15 min)
run: timeout 15m afl-fuzz -i seeds -o findings -- ./target @@ || true
- name: Upload crashes
if: always()
uses: actions/upload-artifact@v4
with:
path: findings/**/crashes/*- name: Build with afl-clang-fast
run: CC=afl-clang-fast make -j
- name: Fuzz (smoke, 15 min)
run: timeout 15m afl-fuzz -i seeds -o findings -- ./target @@ || true
- name: Upload crashes
if: always()
uses: actions/upload-artifact@v4
with:
path: findings/**/crashes/*ulimit -c unlimited && sysctl -w kernel.core_pattern=core.%e.%p
gdb -q ./target core.* -ex 'bt' -ex 'info reg' -ex q
addr2line -e ./target 0xDEADBEEFundefinedulimit -c unlimited && sysctl -w kernel.core_pattern=core.%e.%p
gdb -q ./target core.* -ex 'bt' -ex 'info reg' -ex q
addr2line -e ./target 0xDEADBEEFundefined
**Kernel KASAN/KMSAN:**
```bash
dmesg -T | egrep -i 'kasan|kmsan' -A 60
./scripts/decode_stacktrace.sh vmlinux /lib/modules/$(uname -r)/build < dmesg.log
**Kernel KASAN/KMSAN:**
```bash
dmesg -T | egrep -i 'kasan|kmsan' -A 60
./scripts/decode_stacktrace.sh vmlinux /lib/modules/$(uname -r)/build < dmesg.log| Tool | Use Case |
|---|---|
| AFL++ | General GreyBox, CmpLog, MOpt, Nyx |
| Honggfuzz | Intel PT, crash detection, HF_ITER |
| libFuzzer | In-process, source available |
| syzkaller | Linux/Windows kernel syscall fuzzing |
| wtf | Snapshot fuzzing, Windows targets |
| Nyx | AFL++ snapshot mode (Intel PT) |
| Snapchange | AWS snapshot fuzzing |
| LibAFL | Custom Rust fuzzing framework |
| AFLGo | Directed fuzzing to target BB/function |
| kAFL | Kernel + OS fuzzing |
| Jackalope | Binary coverage-guided (Windows/macOS) |
| cargo-fuzz | Rust libFuzzer integration |
| Atheris | Python fuzzing |
| Nautilus | Grammar-based fuzzing |
| AFLTriage | Automated crash triage |
| afl-cov | Coverage analysis for AFL++ |
| ClusterFuzz | Distributed fuzzing infrastructure |
| 工具 | 用途 |
|---|---|
| AFL++ | 通用 GreyBox、CmpLog、MOpt、Nyx |
| Honggfuzz | Intel PT、崩溃检测、HF_ITER |
| libFuzzer | 进程内、源码可用 |
| syzkaller | Linux/Windows 内核系统调用 fuzzing |
| wtf | 快照 fuzzing、Windows 目标 |
| Nyx | AFL++ 快照模式(Intel PT) |
| Snapchange | AWS 快照 fuzzing |
| LibAFL | 自定义 Rust fuzzing 框架 |
| AFLGo | 面向特定 BB/函数的定向 fuzzing |
| kAFL | 内核 + OS fuzzing |
| Jackalope | 二进制覆盖率引导(Windows/macOS) |
| cargo-fuzz | Rust libFuzzer 集成 |
| Atheris | Python fuzzing |
| Nautilus | 基于语法的 fuzzing |
| AFLTriage | 自动化崩溃分诊 |
| afl-cov | AFL++ 覆盖率分析 |
| ClusterFuzz | 分布式 fuzzing 基础设施 |