fuzzing
Skill này làm gì
Skill mô tả phương pháp fuzz testing các chương trình và thư viện đã biên dịch để tìm lỗi bộ nhớ và bug. Dành cho lập trình viên và kỹ sư bảo mật kiểm thử mã của chính họ.
Khi nào nên dùng
- ✓Khi lập trình viên muốn tìm lỗi crash trong bộ phân tích file trước khi phát hành.
- ✓Khi kỹ sư bảo mật cần kiểm thử một thư viện đọc đầu vào không đáng tin cậy.
- ✓Khi một đội muốn thu gọn và phân loại các crash được tìm thấy trong một lần fuzzing.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/fuzzing/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Giúp tôi thiết lập fuzz testing cho bộ phân tích file trong thư viện của chúng tôi để tìm crash.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill hướng dẫn AI chọn công cụ fuzzing, viết một harness kiểm thử nhỏ, thu thập đầu vào, rồi thu gọn và phân loại các crash tìm được.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Coverage-Guided Fuzzing Playbook
Find memory-corruption and logic bugs by systematically mutating inputs while tracking code coverage. Works on parsers, network protocol handlers, file format readers, crypto implementations.
1. Target Scoping
Before writing a harness, answer:
- What is the attack surface? (file parser / network socket / library API)
- What input format does the target consume? (binary struct / text / TLV)
- Is source available? (instrumented build) or binary-only? (QEMU/Frida mode)
# Quick API surface for a library
nm -D /workspace/target.so | grep ' T ' | awk '{print $3}' | sort > /workspace/exports.txt
# or via radare2
r2 -q -e bin.demangle=true -c "aaa; afl~pub" /workspace/target.so 2>/dev/null | head -40
2. Fuzzer Selection
| Scenario | Fuzzer | Rationale |
|---|---|---|
| Source available, C/C++ | AFL++ | Best coverage feedback, mutator ecosystem |
| Source available, any lang | libFuzzer | In-process, lower overhead, LLVM native |
| Binary-only | AFL++ QEMU mode | AFL_USE_QEMU=1 |
| Binary-only (faster) | AFL++ Frida mode | Lighter than QEMU on some targets |
| Multi-CPU farm | AFL++ + honggfuzz | honggfuzz for socket fuzzing |
| Go / Rust | native go-fuzz / cargo fuzz |
Language-native instrumentation |
| Network protocol daemon | AFL++ persistent + preeny | Desock the accept() loop |
3. Instrumented Build (source-available)
# AFL++
CC=afl-clang-fast CXX=afl-clang-fast++ \
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -g -O1" \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -g -O1" \
-S /workspace/src -B /workspace/build-afl
cmake --build /workspace/build-afl -j$(nproc)
# libFuzzer (alternative)
CC=clang CXX=clang++ \
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="-fsanitize=fuzzer,address,undefined -g" \
-DCMAKE_CXX_FLAGS="-fsanitize=fuzzer,address,undefined -g" \
-S /workspace/src -B /workspace/build-lf
cmake --build /workspace/build-lf -j$(nproc)
Minimum sanitizer flags: -fsanitize=address,undefined. Add
-fsanitize=memory (MSan) on a separate build for uninit reads.
Do NOT combine MSan with ASan — they conflict.
4. Harness Skeleton
AFL++ persistent-mode harness (C)
/* harness.c — compile with afl-clang-fast */
#include <stdint.h>
#include <string.h>
/* Include target headers */
#include "target_api.h"
/* AFL++ persistent mode — loops inside the same process (~20x faster) */
__AFL_FUZZ_INIT();
int main(void) {
__AFL_INIT();
const uint8_t *buf = __AFL_FUZZ_TESTCASE_BUF;
while (__AFL_LOOP(10000)) {
size_t len = __AFL_FUZZ_TESTCASE_LEN;
/* Call the target function directly */
target_parse(buf, len); /* replace with actual API */
}
return 0;
}
libFuzzer target (C)
/* fuzz_target.cc */
#include <stdint.h>
#include <stddef.h>
#include "target_api.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
/* Wrap any setup in thread_local or static init if needed */
target_parse(data, size);
return 0; /* non-zero aborts fuzzer */
}
Key harness rules:
- Allocate nothing that leaks between iterations (use arena or reset)
- Do not call
exit()orabort()inside the harness — let ASan terminate - Minimize initialization overhead outside the fuzz loop
- If target needs a null-terminated string:
strndup((char*)data, size)
5. Seed Corpus Curation
# Create corpus dir
mkdir -p /workspace/corpus/initial
# If target is a file parser, seed with real samples
find /usr/share -name "*.png" 2>/dev/null | head -10 | \
xargs -I{} cp {} /workspace/corpus/initial/
# For binary protocols, create minimal valid inputs by hand
# For text protocols, minimal valid requests:
printf 'GET / HTTP/1.0\r\n\r\n' > /workspace/corpus/initial/http_get.bin
# AFL++ minimize corpus to remove redundant seeds
afl-cmin -i /workspace/corpus/initial \
-o /workspace/corpus/minimized \
-- /workspace/build-afl/harness @@
Good seed = valid, minimal, diverse. 5–50 seeds beats 5000 random bytes.
6. Run AFL++
mkdir -p /workspace/findings/afl
# Single-core
AFL_SKIP_CPUFREQ=1 \
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 \
afl-fuzz \
-i /workspace/corpus/minimized \
-o /workspace/findings/afl \
-t 1000 \ # timeout per testcase (ms)
-- /workspace/build-afl/harness @@
# Multi-core (1 main + N-1 secondary)
Câu hỏi thường gặp
Fuzzing là gì?
Fuzzing gửi nhiều đầu vào đã chỉnh sửa vào một chương trình và theo dõi các crash hoặc lỗi.
Nó nhắc đến công cụ nào?
Nó nhắc đến AFL++, libFuzzer và Honggfuzz, cùng các cách tiếp cận cho mục tiêu là mã nguồn hoặc file nhị phân.
Nó có sửa lỗi không?
Không. Nó giúp tìm và phân loại crash để lập trình viên sửa.
Chi tiết
Mô tả gốc của tác giả
Coverage-guided fuzzing methodology for compiled binaries and libraries: target scoping, fuzzer selection (AFL++/libFuzzer/Honggfuzz), harness skeleton, ASan+UBSan flags, corpus curation, crash triage and minimization (afl-tmin/minimize_corpus), exploitability rubric. Outputs corpora and crashes to /workspace/. Triggers on: 'fuzz', 'fuzzing', 'AFL', 'libFuzzer', 'harness', 'crash triage', 'coverage-guided', 'afl-tmin', 'sanitizer', 'corpus'.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14167
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.