[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EE35QMXTDR299FG8KYQFC5":3,"skill-same:01M6EE35QMXTDR299FG8KYQFC5":53},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M6EE35QMXTDR299FG8KYQFC5","offensive-fuzzing",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FSnailSploit\u002FClaude-Red\u002Foffensive-fuzzing\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25],"fuzzing","offensive","offensive fuzzing","2026-11-10 10:12:30",false,"# SKILL: Fuzzing\n\n## Metadata\n- **Skill Name**: fuzzing-methodology\n- **Folder**: offensive-fuzzing\n- **Source**: https:\u002F\u002Fgithub.com\u002FSnailSploit\u002Foffensive-checklist\u002Fblob\u002Fmain\u002Ffuzzing.md\n\n## Description\nPractical fuzzing methodology reference: target identification, fuzzer selection (AFL++, libFuzzer, Boofuzz, Peach), harness writing, corpus curation, mutation strategies, coverage measurement, and crash triage. Use when setting up or running fuzz campaigns against any target.\n\n## Trigger Phrases\nUse this skill when the conversation involves any of:\n`fuzzing, AFL++, libFuzzer, Boofuzz, Peach, fuzz harness, corpus, mutation, coverage, crash triage, network fuzzing, file format fuzzing`\n\n## Instructions for Claude\n\nWhen this skill is active:\n1. Load and apply the full methodology below as your operational checklist\n2. Follow steps in order unless the user specifies otherwise\n3. For each technique, consider applicability to the current target\u002Fcontext\n4. Track which checklist items have been completed\n5. Suggest next steps based on findings\n\n---\n\n## Full Methodology\n\n# Fuzzing\n\nautomated software testing technique that is used for program analysis\n\n## Types\n\n### BlackBox\n\n- Generates random or model‑based inputs and feeds them into the program under test\n- Fuzzer has no knowledge of the program internals during fuzzing\n- Pros\n  - Extremely fast\n  - Easy to use\n  - Scalable\n- Cons\n  - Random testing leads to poor coverage\n\n### GreyBox\n\n- Relies on lightweight instrumentation of the program under test\n- Fuzzer has some knowledge of the program internals during fuzzing\n- Pros\n  - Feedback\n  - Scalable\n  - Relatively fast\n- Cons\n  - Simplistic mutations\n- Examples\n  - General: [AFL++](https:\u002F\u002Fgithub.com\u002FAFLplusplus\u002FAFLplusplus), [Honggfuzz](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fhonggfuzz), [BooFuzz](https:\u002F\u002Fgithub.com\u002Fjtpereyda\u002Fboofuzz), [WinAFL](https:\u002F\u002Fgithub.com\u002Fgoogleprojectzero\u002Fwinafl)\n  - Directed: [UAFuzz](https:\u002F\u002Fgithub.com\u002Fstrongcourage\u002Fuafuzz), [AFLGo](https:\u002F\u002Fgithub.com\u002Faflgo\u002Faflgo)\n  - Grammar Based: [Tlspuffin](https:\u002F\u002Fgithub.com\u002Ftlspuffin\u002Ftlspuffin), [AFLSmart](https:\u002F\u002Fgithub.com\u002Faflsmart\u002Faflsmart)\n  - Taint Based: [Angora](https:\u002F\u002Fgithub.com\u002FAngoraFuzzer\u002FAngora),\n  - Concolic: [QSYM](https:\u002F\u002Fgithub.com\u002Fsslab-gatech\u002Fqsym), [AFL](https:\u002F\u002Faflplus.plus\u002Flibafl-book\u002Fadvanced_features\u002Fconcolic\u002Fconcolic.html), [SymSan](https:\u002F\u002Fgithub.com\u002FR-Fuzz\u002Fsymsan)\n  - Self‑learning: [SieveFuzz](https:\u002F\u002Fgithub.com\u002FSieveFuzz\u002FSieveFuzz), [RL‑Fuzz](https:\u002F\u002Fgithub.com\u002Ffuzzwareorg\u002Frl-fuzz)\n  - Binary Fuzzing: [Jackalope](https:\u002F\u002Fgithub.com\u002Fgoogleprojectzero\u002FJackalope)\n  - Special Fuzzers: [Papora](https:\u002F\u002Fgithub.com\u002Fambergroup-labs\u002Fpapora), [Medusa](https:\u002F\u002Fgithub.com\u002Ftrailofbits\u002Fmedusa)\n  - Kernel: [syzkaller](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsyzkaller), [kAFL](https:\u002F\u002Fgithub.com\u002FIntelLabs\u002FkAFL), [wtf](https:\u002F\u002Fgithub.com\u002F0vercl0k\u002Fwtf), [KF\u002Fx](https:\u002F\u002Fgithub.com\u002Fintel\u002Fkernel-fuzzer-for-xen-project)\n  - ETC: [LibAFL](https:\u002F\u002Fgithub.com\u002FAFLplusplus\u002FLibAFL) (snapshot & Unicorn support 0.15.x), [FuzzBench](https:\u002F\u002Fgoogle.github.io\u002Ffuzzbench\u002F), [ClusterFuzz](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fclusterfuzz), [DynamoRIO](https:\u002F\u002Fgithub.com\u002FDynamoRIO\u002Fdynamorio)\n\n### Snapshot\n\n- Takes and restores memory\u002Fregister snapshots of the target or VM to bypass expensive initialization.\n- Pros\n  - Order‑of‑magnitude faster execution on large or stateful binaries\n  - Deterministic and easily reproducible\n  - Works with closed‑source targets (no rebuild needed)\n- Cons\n  - Initial snapshot & harness creation can be complex\n  - Requires specialised snapshot engine support (e.g., Nyx, Snapchange, wtf)\n- Examples\n  - [Nyx](https:\u002F\u002Fgithub.com\u002Fnyx-fuzz\u002FNyx) (v2 with Intel‑PT support; note: Nyx integration requires the AFL++-Nyx fork, not mainline AFL++ 4.x)\n  - [Snapchange](https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fsnapchange)\n  - [wtf](https:\u002F\u002Fgithub.com\u002F0vercl0k\u002Fwtf)\n\n#### Snapshot Fuzzing Recipes\n\n- **AFL++ Nyx (user-mode)**\n\n```bash\nNYX_MODE=1 AFL_MAP_SIZE=1048576 afl-fuzz -i seeds -o findings -- .\u002Ftarget_nyx @@\n```\n\n### WhiteBox\n\n- Leverages heavyweight symbolic execution and static analysis, assuming full source availability\n- Pros\n  - Solves path constraints to get past difficult logic\n  - Capable of generating inputs for deep, hard‑to‑reach program states\n- Cons\n  - Complex\n  - Slow\n  - Not scalable\n\n### Ensemble Fuzzing\n\nEnsemble fuzzing coordinates multiple heterogeneous fuzzers sharing a unified corpus, achieving better coverage than any single fuzzer.\n\n#### Concept\n\n- **Cross-Pollination:** Different fuzzers discover different code paths; sharing corpus maximizes coverage\n- **Complementary Strengths:** AFL++ excels at control flow; Honggfuzz at crash detection; libFuzzer at in-process fuzzing\n- **Coordinated Scheduling:** Use reinforcement learning or heuristics to select optimal fuzzer per input\n\n#### Tools and Frameworks\n\n- **EnFuzz:** Uses reinforcement learning to dynamically select which fuzzer runs on each input based on historical effectiveness\n- **CollAFL:** Lightweight synchronization protocol for parallel fuzzer coordination without central coordinator\n- **CUPID:** Analyzes feedback from all fuzzers to guide mutation strategies across the ensemble\n\n#### Practical Setup\n\n```bash\n# Terminal 1: AFL++ primary with shared sync directory\nafl-fuzz -M fuzzer1 -i seeds -o sync_dir -- .\u002Ftarget @@\n\n# Terminal 2: Honggfuzz syncing to AFL corpus\n..\u002Fhonggfuzz\u002Fhonggfuzz -i sync_dir\u002Ffuzzer1\u002Fqueue -W sync_dir\u002Fhfuzz \\\n  --linux_perf_ipt_block -t 10 -- .\u002Ftarget ___FILE___\n\n# Terminal 3: libFuzzer reading from both corpora\n.\u002Ftarget_libfuzzer sync_dir\u002Ffuzzer1\u002Fqueue sync_dir\u002Fhfuzz\u002Fqueue \\\n  -max_total_time=3600 -runs=1000000\n\n# Terminal 4: Sync monitor (optional)\nwatch -n 60 'ls -lh sync_dir\u002F*\u002Fqueue | wc -l'\n```\n\n#### Best Practices\n\n- **Start Simple:** Begin with AFL++ + Honggfuzz; add libFuzzer if you have source\n- **Corpus Deduplication:** Run `afl-cmin` periodically to minimize combined corpus\n- **Resource Allocation:** Allocate 40% AFL++, 30% Honggfuzz, 30% libFuzzer based on empirical results\n- **Monitoring:** Track unique crashes per fuzzer to identify which contributes most\n\n#### Performance Gains\n\n- Research shows **15-40% more coverage** vs single fuzzer\n- **2-3× more unique crashes** in 24-hour runs\n- Particularly effective on complex parsers with multiple code paths\n\n## Components\n\n### Power Scheduler\n\n- Responsible for distributing the amount of fuzzing time among the seeds in the seed queue\n- Prioritize more interesting seeds\n  - Usually measure by its ability to produce new code coverage\n- Assigns a scope to each seed and picks the one with highest score\n- Self‑learning schedulers such as _SieveFuzz_ and _RL‑Fuzz_ use reinforcement learning to allocate energy dynamically based on past mutation success.\n- Explore\u002FExploit auto‑tuning: AFL++ 4.30+ folds MOpt into the core and dynamically balances energy between seeds.\n\n### Mutation\n\n- Responsible for making small changes to the fuzzing seed, with the goal of exercising new program behavior\n- Examples: bit-flips, addition\u002Fsubtraction, deletion, etc\n- Typically operate by making small, incremental changes\n- LLM‑assisted mutations & harness scaffolding: Large‑language models can infer grammars\u002Fdictionaries (`--dict2`) and draft starter harness code (e.g., LibAFL's `llm_mutator`).\n- Overflow‑aware arithmetic heuristics: Enable `--arith8\u002F16\u002F32-smart` in AFL++ (or equivalents) to target boundary‑condition overflows.\n- AFLPlusPlus\n  - Deterministic: includes single deterministic mutations on the content of the test cases\n  - Havoc: mutations are randomly stacked and also includes changes to the size of the test case\n  - Note: honggfuzz and libFuzzer implement weighted random mutation stacks instead of the deterministic\u002Fhavoc split\n- cmp_log guided mutations: Enable `-cmp_log` (AFL++) or `AFL_LLVM_CMPLOG=1` to perform Redqueen‑style input‑to‑state transforms.\n- Snapshot‑aware mutations: With Nyx mode (`NYX_MODE=1`) AFL++ randomises in‑memory state as well as file input for deep state machines.\n- LLM‑guided edits: _HyLLfuzz_ uses GPT\u002FLlama‑3 to generate branch‑targeted mutations, achieving ≈ 1.3× edge coverage.\n\n### Directed Fuzzing (reach a specific bug\u002Ffunction)\n\n- AFLGo basics:\n  - Build with distance metrics to target BBs\u002Ffunctions, then run with exploration\u002Fexploitation phases\n  - Example:\n    ```bash\n    export AFLGO=\u002Fpath\u002Fto\u002Faflgo\n    cmake -DAFLGO=ON -DDISTANCE_CFG=BBtargets.txt ..\n    make clean all\n    afl-fuzz -z exp -c 45m -i seeds -o out -- .\u002Ftarget @@\n    ```\n- libAFL targeted stages: use objective feedbacks to push towards addresses\u002Fsymbols of interest\n\n### Executor\n\n- Responsible for executing the program under test with mutated fuzzing seed in a performant manner\n- AFL++ uses a forkserver to skip the cost of expensive initialization and startup code\n- AFL++ also offers persistent fuzzing mode, where the essential code is run inside a loop without a need for fork\n- GPU‑accelerated execution loops are possible with _CUDA‑AFL_ and LibAFL's `VulkanExecutor`, ideal for shader or graphics targets.\n- Recent AFL++ versions ship a Nyx executor capable of high exec\u002Fs on user‑mode targets; activate with `NYX_MODE=1` (verify version and build flags).\n\n#### Persistent Mode Implementation\n\n**HF_ITER Style (Honggfuzz):**\n\nHonggfuzz offers HF_ITER-style persistent mode that's often easier to implement than ASAN-style for complex targets:\n\n```cpp\n#include \"honggfuzz.h\"\n\nint main(int argc, char** argv) {\n    \u002F\u002F Expensive initialization (run once)\n    initialize_target();\n\n    \u002F\u002F Persistent fuzzing loop\n    for (;;) {\n        size_t len;\n        uint8_t *buf;\n\n        \u002F\u002F Get input from honggfuzz\n        HF_ITER(&buf, &len);\n\n        \u002F\u002F Convert to target-appropriate format\n        FILE* input_stream = fmemopen(buf, len, \"r\");\n\n        \u002F\u002F Execute target with fuzzed input\n        int result = target_function(input_stream);\n\n        \u002F\u002F Cleanup for next iteration\n        fclose(input_stream);\n        reset_target_state();\n    }\n}\n```\n\n**Memory Management Considerations:**\n\n```cpp\n\u002F\u002F Prevent memory leaks in persistent mode\nvoid reset_target_state() {\n    \u002F\u002F Free any allocated memory\n    cleanup_buffers();\n\n    \u002F\u002F Reset global state\n    memset(&global_state, 0, sizeof(global_state));\n\n    \u002F\u002F Close any open file handles\n    close_handles();\n}\n```\n\n**ASAN-Style Alternative:**\n\n```cpp\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    \u002F\u002F Direct fuzzing interface - no manual loop needed\n    return target_function(data, size);\n}\n```\n\n### Feedback\n\n- Set of program state information from running with a particular input seed\n- Fuzzers use feedback to determine fitness of a given seed(basic block coverage, edge coverage, path coverage)\n- AFLPlusPlus uses edge coverage (keeps a shared bitmap between the target and the fuzzer)\n- AFL++ uses edge coverage (keeps a shared bitmap between the target and the fuzzer)\n- Hardware trace sources such as Intel® Processor Trace (IPT) and ARM ETM\u002FCoreSight provide near‑zero‑overhead edge coverage for large binaries.\n- LibAFL 0.15.2 can derive edge coverage from Last Branch Records, giving zero‑instrumentation tracing on recent Intel CPUs (`LBRFeedback`).\n\n#### Intel PT Coverage Setup\n\n**Honggfuzz with Intel PT:**\n\nIntel PT provides hardware-based coverage tracking ideal for binary-only targets where source instrumentation isn't possible:\n\n```bash\n# Basic Intel PT setup with honggfuzz\n..\u002Fhonggfuzz\u002Fhonggfuzz -i input_corpus\u002F -W workspace\u002F --linux_perf_ipt_block -t 10 -- .\u002Ftarget @@\n\n# Performance tuning\n..\u002Fhonggfuzz\u002Fhonggfuzz -i input_corpus\u002F -W workspace\u002F \\\n  --linux_perf_ipt_block \\\n  --linux_perf_ignore_unknown \\\n  --threads 4 \\\n  -t 30 -- .\u002Ftarget @@\n```\n\n**Intel PT Requirements:**\n\n- Modern Intel CPU with PT support (check with `cat \u002Fproc\u002Fcpuinfo | grep intel_pt`)\n- Linux kernel with PT enabled (`CONFIG_INTEL_PT=y`)\n- Sufficient privileges or `CAP_SYS_ADMIN` capability\n\n**Troubleshooting Intel PT:**\n\n```bash\n# Check PT availability\ndmesg | grep -i \"intel.*pt\"\ncat \u002Fsys\u002Fdevices\u002Fintel_pt\u002Ftype\n\n# Permission issues\necho 'kernel.perf_event_paranoid = -1' >> \u002Fetc\u002Fsysctl.conf\nsysctl -p\n\n# Alternative: use capsh for specific capability\ncapsh --caps=\"cap_sys_admin+eip\" -- -c \".\u002Fhonggfuzz_command\"\n```\n\n### Oracle\n\n- Detects if any interesting behavior occurred during execution of the program under test with a given input\n- Code Sanitizers are special compile-time instrumentation for the program under test that perform run-time checks\n- AFL++ offers `QASAN` to run binaries that are not instrumented with `ASan` under QEMU with the AFL++ instrumentation\n- Different Bugs Require Different Oracles\n  - **No Source**: Statically rewrite the binary or `YOLO` it\n  - **Decoupled Sanitization**: use [SAND](https:\u002F\u002Fgithub.com\u002FSANDTeam\u002Fsand) to off-load sanitizer checks and speed up fuzzing\n  - **Memory Safety**: use Address or Leak or Memory Sanitizer (try HWASAN for lower memory usage); or use ARM's MTE for hardware‑assisted tagging on AArch64\n  - **Concurrency Issues**: use Thread Sanitizer – LLVM 18 adds detection for C++20 std::atomic_wait\n  - **Type Safety**: use Type Sanitizer\n  - **Undefined Behavior**: use `UBSan`\n  - **Heap Hardening**: Scudo Hardened Allocator (part of LLVM's compiler-rt, available in recent Clang versions) detects overflows and double‑frees with minimal performance cost.\n  - **Kernel Undefined Behavior**: Kernel UBSan (KUBSan) — enable with `CONFIG_UBSAN_TRAP=y` (verify availability in your kernel).\n  - **Control‑Flow Integrity**: **KCFI** (Clang 18) adds low-overhead forward-edge CFI; enable with `-fsanitize=kcfi`.\n  - **Data‑Flow**: Data‑Flow Sanitizer v2 adds taint‑tracking (`-fsanitize=dataflow`) and now works with libFuzzer.\n  - **Security‑property oracles**: Idempotency or differential fuzzing for APIs (e.g., _DiffSink_ for compiler targets).\n  - **Kernel Stuff**: use `KASAN`, `KMSAN`, `KCSAN`\n  - **Logic Bugs**: Differential or Property(Correctness-Idempotency) Oracles\n\n#### Property\u002FDifferential Oracles (quick patterns)\n\n- Idempotency: `f(x) == f(f(x))` for normalizations\u002Fparsers\n- Differential: compare two implementations or two versions, bucket on output mismatch\n- Invariants: monotonic lengths, checksum equality, schema validation post‑parse\n\n## Seed Corpus\n\n### What is a Seed Corpus?\n\nSeed corpus is a collection of input files used as a starting point for fuzzing. In mutational fuzzing, the fuzzer takes existing files and makes random mutations (flipping, reordering, removing, inserting data) before having the target application parse the mutated file.\n\n### Why is a Seed Corpus Important?\n\n- Increases code coverage, which correlates strongly with finding crashes\n- Allows fuzzers to start close to \"interesting\" points in the target application\n- Helps overcome \"unsolvable cliffs\" in code coverage that fuzzers might struggle with\n- Research shows fuzzers perform significantly better when bootstrapped with a minimized corpus\n\n### Creating a Seed Corpus\n\n1. **Manual Creation**\n   - Create files with different command-line tools or GUI applications\n   - Use all possible tools for your file format to generate diverse outputs\n   - Automate where possible, but can be time-consuming\n\n2. **Existing Test Suites and Bug Reports**\n   - Leverage test suites from the target application\n   - Extract test cases from bug reports (high signal value)\n\n3. **Web Crawling**\n   - Use Common Crawl or similar datasets to extract relevant file types\n   - Filter based on MIME types\n   - Perform corpus distillation: keep only files that trigger new code paths\n\n### Corpus Distillation Process\n\n1. Iterate through each potential seed file\n2. Check file size (smaller files generally more efficient for fuzzing)\n3. Run the file with code coverage instrumentation\n4. Record if the file triggers any new code coverage not seen before\n5. Keep only files that increase code coverage\n6. Perform final minimum-set cover minimization for the smallest possible corpus\n\n### Tools for Corpus Creation\n\n- [common-corpus](https:\u002F\u002Fgithub.com\u002Fbenhawkes\u002Fcommon-corpus): Tool to build fuzzing corpus from Common Crawl data\n- [AFL's afl-cmin](https:\u002F\u002Fgithub.com\u002FAFLplusplus\u002FAFLplusplus\u002Fblob\u002Fstable\u002Fafl-cmin): Corpus minimization tool\n- [AFL's afl-tmin](https:\u002F\u002Fgithub.com\u002FAFLplusplus\u002FAFLplusplus\u002Fblob\u002Fstable\u002Fafl-tmin): Test case minimizer\n- [cf‑min](https:\u002F\u002Fgithub.com\u002FAFLplusplus\u002Fafl-cmin) – distributed\u002Fcluster‑friendly corpus minimizer\n- Crash‑Repro‑Recorder (CRR) bundles – store the exact sequence of inputs needed to reproduce a crash deterministically\n\n### Crash Triage Pipeline\n\n```bash\n# 1) Minimize\nafl-tmin -i crash -o crash.min -- .\u002Ftarget @@\n# 2) Symbolize\u002FLog\nASAN_OPTIONS=abort_on_error=1:symbolize=1 .\u002Ftarget crash.min 2>asan.log\n# 3) Coverage Hash\n.\u002Fcov-tool --bbids .\u002Ftarget crash.min > cov.hash\n# 4) Bucket\n.\u002Fbucket.py --key \"$(cat cov.hash)\" --log asan.log --out triage\u002F\n```\n\n#### Cross‑platform crash analysis quick cheatsheets (user‑mode)\n\n- Linux\n  - Enable coredumps and replay:\n    ```bash\n    ulimit -c unlimited\n    sysctl -w kernel.core_pattern=core.%e.%p\n    .\u002Ftarget crash.min   # produces core\n    gdb -q .\u002Ftarget core.* -ex 'set pagination off' -ex bt -ex 'info reg' -ex q\n    addr2line -e .\u002Ftarget 0xDEADBEAF\n    ```\n  - Stabilize runs: `taskset -c 0 chrt -f 99 .\u002Ftarget @@`; set `ASAN_OPTIONS=allocator_may_return_null=1:handle_abort=1`.\n\n- Windows\n  - Local dumps (WER):\n    ```powershell\n    New-Item 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps' -Force | Out-Null\n    New-ItemProperty -Path 'HKLM:\\...\\LocalDumps' -Name DumpType -Type DWord -Value 2 -Force | Out-Null\n    ```\n  - PageHeap (user mode):\n    ```cmd\n    gflags \u002Fp \u002Fenable target.exe \u002Ffull\n    ```\n  - WinDbg basics:\n    ```text\n    .symfix; .reload \u002Ff\n    !analyze -v\n    k; r; lm\n    ```\n  - Optional: record Time‑Travel Debugging (TTD) to replay non‑deterministic crashes.\n\n- macOS\n  - `lldb -o 'bt all' -- .\u002Ftarget crash.min`; set `DEVELOPER_DIR` to Xcode for symbols.\n\n#### Kernel crash triage quicksheet\n\n- Linux\n  - KASAN\u002FKMSAN logs: `dmesg -T | egrep -i 'kasan|kmsan' -A 60`\n  - Decode stacks:\n    ```bash\n    .\u002Fscripts\u002Fdecode_stacktrace.sh vmlinux \u002Flib\u002Fmodules\u002F$(uname -r)\u002Fbuild \u003C dmesg.log\n    ```\n  - Map addresses: `addr2line -e vmlinux 0xffffffff81234567`\n\n- Windows\n  - Driver Verifier:\n    ```cmd\n    verifier \u002Fstandard \u002Fdriver yourdrv.sys\n    ```\n  - KD\u002FWinDbg:\n    ```text\n    !analyze -v; kv; r; !verifier 3; !irpfind\n    ```\n\n#### Sanitizer options (quick reference)\n\n- ASAN_OPTIONS: `abort_on_error=1:symbolize=1:allocator_may_return_null=1:detect_stack_use_after_return=1`\n- UBSAN_OPTIONS: `print_stacktrace=1:halt_on_error=1`\n- TSAN_OPTIONS: `halt_on_error=1:history_size=7:second_deadlock_stack=1`\n- MSAN_OPTIONS: `poison_in_dtor=1:track_origins=2`\n- HWASAN (AArch64): `abort_on_error=1:stack_history_size=7`\n\n#### syzkaller crash repro and bisection (essentials)\n\n```bash\n# Reproduce from syz repro\nsyz-execprog -repeat=0 -procs=1 -wait=5m -cover=0 -debug target.repro\n\n# Run minimized C reproducer under KASAN\u002FKCFI build for clarity\nmake -j$(nproc) CONFIG_KASAN=y CONFIG_UBSAN=y CONFIG_KCFI=y\n\n# Git bisection (when you have a fix commit)\ngit bisect start \u003Cbad> \u003Cgood>\ngit bisect run .\u002Frepro.sh\n```\n\n## Workflow\n\n```mermaid\nflowchart TD\n    A[Research Program Under Test] --> B[Choose Analysis Techniques];\n    B --> C[Initial Fuzzer Setup];\n    subgraph \"Setup Details\"\n        C --> C1[Gather Initial Seed Corpus];\n        C --> C2[Instrument Target];\n        C --> C3[Configure Execution];\n        C --> C4[Select Fuzzing Parameters];\n    end\n    C --> D[Begin Fuzzing];\n    D --> E{Monitor Fuzzing Progress};\n    E -- Stalled? --> F[Troubleshoot\u002FAdjust];\n    F --> D;\n    E -- Crashes Found? --> G[Process Fuzzing Results];\n    subgraph \"Result Processing\"\n        G --> G1[Triage Crashes];\n        G --> G2[Deduplicate Test Cases];\n        G --> G3[Minimize Test Cases];\n    end\n    G --> H[Report Vulnerabilities \u002F Refine];\n    H --> I[End];\n    E -- No Crashes\u002FFinished --> I;\n\n    classDef setup fill:#99e,stroke:#111,stroke-width:2px,color:#333;\n    class C1,C2,C3,C4 setup;\n    classDef process fill:#e6e,stroke:#111,stroke-width:2px,color:#333;\n    class G1,G2,G3 process;\n```\n\n### Research the Program Under Test\n\n- Familiarize yourself with the program under test\n- Learn what the program under test does and how it operates\n- Interact with the program & learn how to use it\n- Identify inputs & outputs\n- Identify program areas to focus analysis efforts on Looking for\n  - Potentially Vulnerable program code\n  - Previously patched code\n  - Previous vulnerabilities\n  - Newly developed code\n  - Complex logic\n  - Input data ingestion sites\n- For kernel modules, look beyond traditional attack vectors:\n  - Beyond IOCTL handlers and `copy_from_user` calls\n  - Specialized subsystems like DMA-BUF may have attack surface through:\n    - Custom callbacks in operation structures\n    - Memory mapping handlers\n    - Page fault handlers\n    - VM operation structures\n    - Allocation\u002Ffree mechanisms\n  - Identify all user-controlled inputs, especially those passed to functions that don't use `copy_from_user`\n\n### Choose the Right Set of Program Analyses\n\n- Types of analyses that you select to conduct depends on a variety of factors\n  - Size\n  - Format\n  - Interface\n  - Complexity\n\n### Initial Fuzzer Setup\n\n- Construct a representative initial seed corpus by gathering a set of program inputs that resemble the input format program expects\n- Instrument the program under test with coverage and sanitization\n- Recommended build flags (Clang\u002FLLVM):\n\n  ```bash\n  # LibFuzzer + ASan\u002FUBSan (C\u002FC++)\n  CC=clang CXX=clang++ CFLAGS=\"-O1 -g -fno-omit-frame-pointer\" \\\n  CXXFLAGS=\"-O1 -g -fno-omit-frame-pointer\" \\\n  LDFLAGS=\"\" \\\n  cmake -DCMAKE_C_FLAGS=\"-fsanitize=address,undefined -fsanitize-recover=undefined\" \\\n        -DCMAKE_CXX_FLAGS=\"-fsanitize=fuzzer,address,undefined -fsanitize-recover=undefined\" ..\n\n  # MSVC (Windows) AddressSanitizer for x64\n  # In Visual Studio 2022+: Project Properties → C\u002FC++ → Address Sanitizer: Yes (\u002Ffsanitize=address)\n  # Runtime options\n  set ASAN_OPTIONS=detect_leaks=1:halt_on_error=1:strict_string_checks=1\n  ```\n\n- Execution method with Harness or command line arguments\n- Select fuzzing parameters like power schedule, dictionary, custom mutator, etc\n- Fuzzing setup to run in parallel, etc\n\n### Quick‑Start Recipes\n\n- LibFuzzer harness (C++):\n\n  ```cpp\n  #include \u003Ccstdint>\n  #include \u003Ccstddef>\n  extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n    \u002F* parse_or_process(data, size); *\u002F\n    return 0;\n  }\n  ```\n\n- AFL++ on a CLI target:\n\n  ```bash\n  # Instrument\n  CC=afl-clang-fast CXX=afl-clang-fast++ cmake -DCMAKE_BUILD_TYPE=Release .. && make -j\n  # Seed dir with a few minimal valid inputs\n  afl-fuzz -i seeds -o findings -- .\u002Ftarget @@\n  # Useful extras: dictionary and cmplog for hard compares\n  afl-fuzz -i seeds -x dict.txt -o findings -c 0 -- .\u002Ftarget @@\n  # Or enable cmplog build\u002Frunner pair\n  AFL_LLVM_CMPLOG=1 CC=afl-clang-fast CXX=afl-clang-fast++ make clean all\n  afl-fuzz -i seeds -o findings -M f1 -- .\u002Ftarget @@\n  afl-fuzz -i seeds -o findings -S s1 -c 0 -- .\u002Ftarget @@\n  ```\n\n- Windows binary‑only (QEMU mode):\n\n  ```bash\n  afl-fuzz -Q -i seeds -o findings -- target.exe @@\n  ```\n\n### Begin Fuzzing\n\n- Start the actual fuzzing process and wait for any crashes\n- Fuzzing might get stalled, become unstable or have poor performance\n\n### Process the Fuzzing Results\n\n- Once the fuzzer produces a set of interesting test cases, we need to refine them\n- Triage\n  - Group test cases by root cause and\u002For vulnerability type\n  - Prioritize patching the more sever vulnerabilities\n- Deduplication: Remove all non-unique test cases\n- Minimization: get rid of unnecessary bytes of input\n\n#### Crash dedup & triage tips\n\n- Prefer stack‑hash or coverage‑hash based bucketing (e.g., AFLTriage, Crash Triage scripts).\n- Minimize before debugging: `afl-tmin`, `llvm-reduce`, or `creduce` for textual formats.\n- Use stable environments: pin CPU governor, disable ASLR where safe, fix random seeds.\n- Export sanitizer logs to files for CI artifacts.\n\n#### Reproducibility quick checklist\n\n- Save and replay exact input sequences in persistent mode\n- Pin CPU governor; fix RNG seeds; disable ASLR only where safe and necessary\n- Minimize before debugging (`afl-tmin`, `llvm-reduce`, `creduce`)\n- Record binary hashes and sanitizer options with every crash\n\n## Obstacles\n\n### Binary Only vs Source Fuzzing\n\n- Sometimes only executables are available, without any source code\n- Solution\n  - **Binary Rewriting**: inserting coverage and sanitization into a binary without recompilation (e.g., `retrowrite`, binary‑only ASan\u002FQASan)\n  - **Dynamic Binary Instrumentation**: inserting coverage and sanitization at runtime (e.g., `QASAN`, DynamoRIO, Frida\u002FQBDI)\n\n### Fuzzing Harness\n\n- Some fuzzing targets are difficult to interact with\n- Solution\n  - Fuzzing harness acts as a middleware between the program under test and the fuzzer\n  - Can also use function hooking to replace network or file function calls\n\n#### Library Harness Best Practices\n\n- **Research Existing Work**: Search for existing harnesses or test suites\n- **Optimize Compilation**: Use `-O1` or `-O3` flags during compilation\n- **Balance Coverage vs Speed**: A good harness maximizes code coverage while maintaining execution speed\n- **Strategic Targeting**: Create multiple small harnesses for different library components\n- **Resource Management**: Ensure proper initialization and cleanup of library resources\n- **Input Manipulation**: Create functions that transform fuzzer input into valid library parameters\n- **Persistent Mode**: For maximum efficiency, implement persistent mode harnesses that reuse library instances\n\n#### Snapshot Harnessing Tips\n\n- Snapshot after expensive initialization, right before the parse\u002Fdispatch loop\n- Map fuzzer input into in‑memory buffers; avoid filesystem and network overhead\n- Seed RNG and log it; ensure deterministic time sources where possible\n- Export coverage early and often (breakpoints or tracepoints) for plateau detection\n\n#### Structure‑aware fuzzing\n\n- Extract tokens\u002Fkeywords to a dictionary (AFL++ `--dict2` or `AFL_TOKEN_FILE`).\n- Use libprotobuf‑mutator for protobuf\u002FgRPC targets; generate corpus from `.proto` examples.\n- For HTTP\u002FREST\u002FGraphQL, record real traffic and convert to templates with placeholders.\n\nWhen building harnesses for libraries:\n\n1. Start with a basic implementation that validates core functionality\n2. Gradually expand to cover more API functions\n3. Use the documentation to understand parameter boundaries and edge cases\n4. Test with a variety of input encodings and configurations\n5. Consider structural awareness when fuzzing format-specific libraries\n\nResources:\n\n- [Awesome LibFuzzer Harness Collection](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Ffuzzing\u002Ftree\u002Fmaster\u002Fexamples)\n- OSS-Fuzz project repositories\n\n### Fuzzer Stalls\n\n- Fuzzer progress has come to a halt\n- Solution\n  - Run a collection of different fuzzers\n  - Produce actionable coverage statistics with tools like VisFuzz or afl-cov that inform you of where the fuzzer is getting stuck\n  - Use a concolic fuzzer, which combines constraints solving with fuzzing to help traditional fuzzers get past difficult conditional statements\n  - If all else fails, move on to a different analysis technique\n  - For AFL++: enable `-c 0` (cmplog), try `AFL_MAP_SIZE=1048576`, use `-L 0` for MOpt, and add custom mutators.\n\n#### Plateau escape tactics\n\n- Switch to directed fuzzing (e.g., AFLGo\u002FUAFuzz) for a specific function\u002Fbasic block\n- Add grammar\u002Fdictionary; enable CMPLOG\u002FRedqueen to unlock hard compares\n- Use concolic assistance (QSYM, Driller, libAFL concolic) on stubborn branches\n- Reduce target surface via snapshotting or split harness to increase exec\u002Fs\n\n### Fuzzing Reproducibility\n\n- Inability to reproduce crashing test cases produced by fuzzer\n- Solution\n  - During persistent fuzzing, save all inputs starting from when a new process is created and replay those inputs in same order to reproduce behavior\n  - AFLPlusPlus offers special compile-time instrumentation that attempts to eliminate concurrency issues\n\n### Speed & Performance\n\n- Fuzzer is running slowly\n- Solution\n  - Use snapshot fuzzing to eliminate execution of redundant, unimportant code\n  - Avoid using complex fuzzing logic\n  - Parallel fuzzing can sometimes help\n  - Pin CPU governor to performance; disable throttling; set `AFL_SKIP_CPUFREQ=1` when needed.\n  - Prefer `llvm_mode` over `qemu_mode` where possible; enable LTO instrumentation for higher throughput.\n\n## Techniques\n\n### Syzkaller\n\n- Limit enabled syscalls to make fuzzing go deeper\n- Write new `syzlang` descriptions\n- Change the mutation of fuzzing inputs(integrate symbolic execution)\n- Start fuzzing from the crafted corpus\n- Customize `kcov` or use cover filter for directed fuzzing\n- Extend grammar for better coverage\n- **External Network Fuzzing**:\n  - **Packet Injection**: Utilize `TUN\u002FTAP` virtual network devices to inject network packets from within the VM, allowing the kernel to process them as if they were received externally. This approach is compatible with syzkaller's architecture, which runs the fuzzer process inside the VM.\n  - **Coverage Collection**: Employ `KCOV` to gather code coverage from the kernel's network packet parsing code. `KCOV` can be adapted to work with `TUN\u002FTAP` to trace the execution paths taken during packet processing.\n  - **Pseudo-syscalls**: Implement `syzkaller` pseudo-syscalls to manage network-related operations, such as packet injection and resource management (e.g., `syz_emit_ethernet` for sending packets, `syz_extract_tcp_res` for handling TCP sequence and acknowledgement numbers).\n  - **Syscall Descriptions**: Create detailed `syzlang` descriptions for network protocols and packet structures to guide the fuzzer. This includes defining packet fields, checksums, and relationships between different protocol layers.\n  - **Integration Challenges**:\n    - **Checksums**: Implement logic to correctly calculate and update checksums for various protocols (IP, TCP, UDP, ICMP) as the fuzzer mutates packet data.\n    - **TCP Connections**: Develop sequences of syscalls and pseudo-syscalls to establish and manage TCP connections, enabling fuzzing of stateful TCP communication.\n    - **ARP Traffic**: Minimize or filter out ARP traffic to isolate the fuzzing of specific protocols and avoid interference.\n    - **IPv6 Support**: Extend descriptions and logic to support IPv6, including handling extension headers and specific IPv6 features.\n  - **Reading Code**: For understanding external network fuzzing implementation, refer to the original pull request in syzkaller and the current sources, focusing on `initialize_netdevices()`, `syz_emit_ethernet()`, and network protocol descriptions in `syzlang`.\n  - **Upstream docs** – See `docs\u002Fexternal_fuzzing_network.md` in the syzkaller repo for checksum helpers and packet templates.\n\n#### Target Selection\n\n- Use syzbot coverage heatmap to identify subsystems with less-than-ideal coverage\n- Look for subsystems with coverage between 1-20% (completely uncovered might have good reasons)\n- Network subsystems are easier to fuzz than hardware-dependent ones\n- Check syzbot dashboard to identify promising targets and current fuzzing status\n\n#### Attack Surface Analysis\n\n- Analyze kernel code to understand the attack surface (e.g., examining netlink handlers)\n- Map out the available operations (e.g., socket operations, netlink commands)\n- Understand the code paths that process user inputs for targeted fuzzing\n\n#### Performance Optimization\n\n- Use hardware virtualization when possible for better performance\n  - KVM on Linux, HVF on macOS can provide 3-5x speedup over TCG emulation\n- Adapt QEMU parameters to work with available accelerators\n\n#### Syzkaller Configuration and Setup\n\n- **Cross-Architecture Setup**:\n  - When configuring on non-standard hosts (e.g., ARM64 Mac), compile the target elements (kernel, rootfs) natively on Linux VM\n  - Go 1.23 fixes the internal linker, but you **still need `CROSS_COMPILE=`** when the kernel uses a non‑GNU tool‑chain.\n  - Specify OS\u002Farch pairs when compiling: `make HOSTOS=darwin HOSTARCH=arm64 TARGETOS=linux TARGETARCH=arm64`\n  - Build `syz-executor` on a Linux machine and copy to your host if cross-compilation fails\n\n- **Kernel Module Fuzzing**:\n  - Extract constants with `syz-extract` targeting specific syscall descriptions: `bin\u002Fsyz-extract -os linux -sourcedir \u002Fpath\u002Fto\u002Flinux -arch arm64 -build module_name.txt`\n  - If extraction fails, manually compile programs to determine constant values\n  - Use the obtained values to create\u002Ffix `.const` files for your module\n\n- **Configuration File Example**:\n\n  ```json\n  {\n    \"name\": \"QEMU-aarch64\",\n    \"target\": \"linux\u002Farm64\",\n    \"http\": \":56700\",\n    \"workdir\": \"\u002Fpath\u002Fto\u002Fworkdir\",\n    \"kernel_obj\": \"\u002Fpath\u002Fto\u002Fkernel\",\n    \"syzkaller\": \"\u002Fpath\u002Fto\u002Fsyzkaller\",\n    \"image\": \"\u002Fpath\u002Fto\u002Frootfs.ext3\",\n    \"sshkey\": \"\u002Fpath\u002Fto\u002Fid_rsa\",\n    \"procs\": 8,\n    \"enable_syscalls\": [\"openat$module_name\", \"ioctl$IOCTL_CMD\", \"mmap\"],\n    \"type\": \"qemu\",\n    \"vm\": {\n      \"count\": 4,\n      \"qemu\": \"\u002Fpath\u002Fto\u002Fqemu-system-aarch64\",\n      \"cmdline\": \"console=ttyAMA0 root=\u002Fdev\u002Fvda\",\n      \"kernel\": \"\u002Fpath\u002Fto\u002FImage\",\n      \"cpu\": 2,\n      \"mem\": 2048\n    }\n  }\n  ```\n\n#### Kernel fuzzing practicalities\n\n- Use `KCFI` and `KASAN` builds for safer fuzzing; `CONFIG_DEBUG_INFO_BTF=y` helps symbolization.\n- Prefer TUN\u002FTAP packet injection over raw sockets for stable replay.\n- Stabilize coverage with `kcov` filters and `syz_cover_filter`.\n\n- **Performance Considerations**:\n  - For ARM64 Macs, thermal throttling can significantly reduce execution rates\n  - Monitor execution rates for performance degradation\n  - VM acceleration and hardware features can improve performance\n  - Consider using Hardware Tag-Based KASAN for better performance vs. coverage tradeoff\n  - **Linux 6.8+ configs**\n  - Enable: `CONFIG_KASAN=y` (or HWASAN on AArch64), `CONFIG_KCSAN=y`, `CONFIG_UBSAN=y`, `CONFIG_KCFI=y`, `CONFIG_DEBUG_INFO_BTF=y`.\n  - Prefer `CONFIG_KFENCE=n` during fuzzing; enable later to confirm bugs.\n\n### AFL\n\n- Crafting high quality harness\n  - identify existing harnesses [oss-fuzz](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Foss-fuzz)\n  - adapt and enhance for your fuzzing objectives\n- Corpus\n  - use `afl-tmin` and `afl-cmin` to tune corpus dynamically\n- Code Coverage\n  - use `afl-cov` to understand the code coverage\n  - then analyze and fine tune your harness\n  - and optimize your test corpus based on coverage feedback\n- Efficient Crash Triage\n  - use [AFLTriage](https:\u002F\u002Fgithub.com\u002Fquic\u002FAFLTriage) and [AddressSanitizer](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsanitizers\u002Fwiki\u002Faddresssanitizer)\n  - try `afl-collect` \u002F `afl-plot` and enable `ASAN_OPTIONS=abort_on_error=1:symbolize=1`\n\n#### Modern AFL++ tips\n\n- Use `-M`\u002F`-S` for parallel fuzzer instances; combine `-c 0` (cmplog) on some slaves.\n- Persistent mode (`__AFL_LOOP(N)`) for hot loops; in‑process fuzzing with `afl++-unicorn` for emulated targets.\n- Dictionaries (`-x`) and `laf-intel`\u002F`split-switches` to simplify hard conditions at compile time.\n\n### MacOS\n\n#### IPC Fuzzing\n\n- We can mutate and fuzz the message that `mach_msg` is sending\n  - Simple to do but slow\n  - Hard to determine which process caused the crash\n  - Hard to identify code coverage\n- We can directly send a message to Target message handler(skipping kernel)\n  - Very fast and easy to instrument\n  - Easy to understand what caused the crash\n  - but Different from end exploit, might need to invoke initialization routines\n- Write a Fuzzing harness\n\n```c\nvoid *lib_handle = dlopen(\"libexample.dylib\", RTLD_LAZY);\npFunction = dlsym(lib_handle, \"DesiredFunction\");\n```\n\n### EDR\n\n#### EDR Attack Surface Overview\n\nEDR solutions present a significant attack surface due to their complex architecture:\n\n**Potential vulnerability categories:**\n\n- Memory corruptions in file scanning & emulation (e.g., CVE-2021-1647)\n- Arbitrary file deletion via symlink vulnerabilities\n- User-Mode IPC authorization issues or memory corruptions\n- User-to-driver authorization bypass\n- Classic driver vulnerabilities (WDM, KMDF, Mini-Filter)\n- Server-to-agent authentication flaws\n- Parsing bugs in server responses\n- Classic Windows application vulnerabilities (DLL hijacking, file permissions)\n- Emulation\u002Fsandbox escapes\n- Logic bugs in security implementations\n\n#### Microsoft Defender's Scanning Engine (mpengine.dll)\n\nMicrosoft Defender includes a local analysis engine `mpengine.dll` that performs static checks and uses emulation environments for different file types. This engine presents a significant attack surface due to its complexity and the variety of file formats it processes.\n\n**Target Characteristics:**\n\n- Installed by default on Windows systems\n- Runs as SYSTEM with high privileges\n- Has 1-click remote attack surface through file scanning\n- Processes numerous file formats with complex parsing logic\n- Prone to memory corruption vulnerabilities\n\n**Fuzzing Methodology:**\n\n_Snapshot Fuzzing with WTF:_\n\n- Uses Windows Terminal Framework for coverage-guided fuzzing\n- Takes snapshots after Defender initiates file scanning\n- Maintains identical configuration to real environment\n- Avoids limitations of manual engine bootstrapping\n\n_Alternative Approaches:_\n\n- **kAFL\u002FNYX**: Additional fuzzing frameworks tested\n- **Jackalope**: Cross-platform coverage-guided fuzzer\n- **Manual harness**: Historic approach using `RSIG_BOOTENGINE` and `RSIG_SCAN_STREAMBUFFER`\n\n**Practical Attack Scenarios:**\n\n_Web-based DoS:_\n\n```html\n\u003C!-- Crash Defender via malicious file download -->\n\u003Ca href=\"crash.pdf\">Download PDF\u003C\u002Fa>\n\u003C!-- Crashes MsMpEng.exe when file is scanned -->\n```\n\n_Network Share DoS:_\n\n```powershell\n# Upload crash file to SMB share before credential dumping\ncopy crash.doc \\\\target\\share\\\n# Defender crashes when scanning uploaded file\nmimikatz.exe privilege::debug sekurlsa::logonpasswords\n```\n\n**Fuzzing Setup Requirements:**\n\n_Snapshot Creation:_\n\n```cpp\n\u002F\u002F Example WTF harness setup\nif (!g_Backend->SetBreakpoint(\"nt!KeBugCheck2\", [](Backend_t *Backend) {\n    const uint64_t BCode = Backend->GetArg(0);\n    const std::string Filename = fmt::format(\"crash-{:#x}\", BCode);\n    Backend->Stop(Crash_t(Filename));\n}))\n```\n\n_Coverage Analysis:_\n\n- Use IDA Lighthouse for visualization\n- Monitor for DRIVER_VERIFIER_DETECTED_VIOLATION (0xc4)\n- Track IRQL_NOT_LESS_OR_EQUAL (0xa) crashes\n\n**Defense Implications:**\n\n- Demonstrates need for robust input validation\n- Shows importance of crash recovery mechanisms\n- Highlights risks of complex file parsing engines\n- Suggests value of sandboxing scanning processes\n\n##### Cross-platform mpengine.dll Fuzzing\n\nRecent advances enable fuzzing the latest Windows Defender engine (v1.1.25020.1007) on Linux using **loadlibrary** with Intel PT coverage:\n\n```cpp\n\u002F\u002F Disable Lua VM to avoid stability issues\nvoid my_lua_exec(){\n  return;\n}\n\nint main(int argc, char** argv){\n  \u002F\u002F Hook luaV_execute to bypass Lua signature processing\n  insert_function_redirect((void*)luaV_execute_address, my_lua_exec, HOOK_REPLACE_FUNCTION);\n\n  \u002F\u002F Setup persistent fuzzing loop\n  for (;;) {\n    size_t len;\n    uint8_t *buf;\n    HF_ITER(&buf, &len);\n\n    ScanDescriptor.UserPtr = fmemopen(buf, len, \"r\");\n\n    if (__rsignal(&KernelHandle, RSIG_SCAN_STREAMBUFFER, &ScanParams, sizeof ScanParams) != 0) {\n      \u002F\u002F Handle scan results\n    }\n  }\n}\n```\n\n##### Performance Optimizations\n\n- **Persistent Mode**: Eliminates initialization overhead, achieving hundreds of exec\u002Fs\n- **Intel PT Coverage**: Hardware-based tracing for binary-only targets\n- **Lua VM Bypassing**: Reduces crashes and focuses on native code vulnerabilities\n\n##### honggfuzz with Intel PT Setup\n\n```bash\n# Non-persistent mode (slower, ~4s\u002Fexecution)\n..\u002Fhonggfuzz\u002Fhonggfuzz -i ~\u002Finput\u002F -W ~\u002Fworkspace\u002F --linux_perf_ipt_block -t 10 -- .\u002Fmpclient_x64 ___FILE___\n\n# Persistent mode (faster, hundreds\u002Fsec)\n..\u002Fhonggfuzz\u002Fhonggfuzz -i ~\u002Finput\u002F -W ~\u002Fworkspace\u002F --linux_perf_ipt_block -t 10 -- .\u002Fmpclient_x64_persistent\n```\n\n##### Common Issues and Solutions\n\n- **Cache Files**: Mock `mpcache-*` file access to return NULL handles for 2025+ engines\n- **Path Normalization**: Use absolute paths (e.g., `C:\\input` vs `input`) to avoid Lua failures\n- **Floating Point Exceptions**: Often originate from .NET emulator, require debugging\n\n##### Lua VM Analysis and Bypassing\n\n_Understanding Defender's Lua Implementation:_\n\nMicrosoft Defender uses Lua 5.1.5 for signature implementation, with native functions exposed through `MpCommon` and `mp` tables:\n\n```lua\n-- Example signature logic that can fail\nlocal l_0_0 = ((MpCommon.PathToWin32Path)((mp.getfilename)(mp.FILEPATH_QUERY_FULL))):lower()\n-- Calls native LsaMpCommonLib::PathToWin32Path() function\n```\n\n_Debugging Lua Execution:_\n\n```cpp\n\u002F\u002F Hook luaV_execute main execution loop\n75a16bbdc 4c 8b f1        MOV        R14,RCX ; R14 := lua_state\n75a16bbdf 49 8b 46 28     MOV        RAX,qword ptr [R14 + 0x28]\n75a16bbe3 4d 8b 66 30     MOV        R12,qword ptr [R14 + 0x30] ; R12 := state->savedpc\n75a16bc07 41 8b 1c 24     MOV        EBX,dword ptr [R12] ; EBX := Lua instruction (4 bytes)\n\n\u002F\u002F Common failure point in luaV_gettable()\nif ((lua_TValue *)callinfo[2] \u003C= key_scalar_val) {\n    luaG_runerror(state,\"attempt to %s a %s value\",\"index\",type_name);\n    \u002F\u002F \"attempt to index a nil value\" - throws C++ exception\n}\n```\n\n_Signature Extraction and Analysis:_\n\n- Use **commial's scripts** to decompress .VDM signature files\n- **luadec** for full decompilation with restored headers\n- **LuaPytecode** for low-level bytecode analysis\n\n```bash\n# Extract VDM contents and analyze bytecode\npython extract_vdm.py defender.vdm\nluadec extracted_bytecode.luac\n```\n\n_Bypassing Strategy:_\n\nReplace Lua execution entirely to focus on native code vulnerabilities while maintaining unpacker functionality:\n\n```cpp\n\u002F\u002F Complete Lua bypass - maintains unpacker execution\nvoid my_lua_exec(){\n    return; \u002F\u002F Skip all signature processing\n}\n\n\u002F\u002F Alternative: Selective bypassing for specific functions\nif (lua_function_name == \"problematic_signature\") {\n    return; \u002F\u002F Skip only problematic signatures\n}\n```\n\n#### Fuzzing Scanning Engines\n\n**Setting Up WTF (WhatsApp Trace Framework) for EDR Fuzzing:**\n\n```cpp\n\u002F\u002F Basic WTF harness for mpengine.dll fuzzing\n#include \"wtf.h\"\n\n\u002F\u002F Crash handler for detecting vulnerabilities\nif (!g_Backend->SetBreakpoint(\"nt!KeBugCheck2\", [](Backend_t *Backend) {\n    const uint64_t BugCode = Backend->GetArg(0);\n    const uint64_t Parameter1 = Backend->GetArg(1);\n\n    \u002F\u002F Log crash details\n    const std::string Filename = fmt::format(\"crash-{:#x}-{:#x}\", BugCode, Parameter1);\n    DebugPrint(\"Crash detected: {} (BugCode: {:#x})\\n\", Filename, BugCode);\n\n    Backend->Stop(Crash_t(Filename));\n})) {\n    DebugPrint(\"Failed to set crash breakpoint\\n\");\n    return false;\n}\n\n\u002F\u002F Monitor specific crash types\ng_Backend->SetBreakpoint(\"nt!KeBugCheckEx\", CrashHandler);\n```\n\n**Snapshot Positioning for Microsoft Defender:**\n\n```powershell\n# Trigger file scan via MpCmdRun.exe\nMpCmdRun.exe -Scan -ScanType 3 -File \"C:\\test\\target.exe\"\n\n# Alternative: Use Explorer context menu scan\n# Right-click -> \"Scan with Microsoft Defender\"\n\n# Monitor for scanning process start\nGet-Process | Where-Object {$_.ProcessName -eq \"MsMpEng\"}\n```\n\n**WTF Configuration Example:**\n\n```json\n{\n  \"snapshot_path\": \"defender_scan.dmp\",\n  \"backend\": \"bochscpu\",\n  \"target\": \"mpengine.dll\",\n  \"max_iterations\": 1000000,\n  \"timeout\": 30,\n  \"coverage_breakpoints\": [\n    \"mpengine!UfsScannerWrapper::ScanFile\",\n    \"mpengine!pefile_scan_mp\",\n    \"mpengine!macho_scanfile\"\n  ]\n}\n```\n\n**Alternative Fuzzing Frameworks:**\n\n_kAFL\u002FNYX Setup:_\n\n```bash\n# Install kAFL dependencies\ngit clone https:\u002F\u002Fgithub.com\u002FIntelLabs\u002FkAFL.git\ncd kAFL\n.\u002Finstall.sh\n\n# Create fuzzing target\npython kafl_fuzz.py \\\n    --memory 2048 \\\n    --input corpus\u002F \\\n    --work-dir workdir\u002F \\\n    --seed-dir seeds\u002F \\\n    --target targets\u002Fmpengine_target.py\n```\n\n_Jackalope Configuration:_\n\n```python\n# Jackalope harness for EDR fuzzing\nimport jackalope\n\n# Initialize fuzzer\nfuzzer = jackalope.TargetFuzzer(\n    target_binary=\"MpCmdRun.exe\",\n    target_args=[\"-Scan\", \"-ScanType\", \"3\", \"-File\", \"@@\"],\n    coverage_type=\"drcov\",\n    target_timeout=30000\n)\n\n# Add input corpus\nfuzzer.add_corpus_dir(\"corpus\u002F\")\n\n# Start fuzzing\nfuzzer.fuzz()\n```\n\n**Coverage Analysis Tools:**\n\n_IDA Lighthouse Integration:_\n\n```python\n# Load WTF traces in IDA with Lighthouse\nimport lighthouse\nlighthouse.load_coverage_file(\"wtf_coverage.log\")\nlighthouse.coverage.show_coverage()\n```\n\n_Dynamic Analysis with Tenet:_\n\n```python\n# Time-travel debugging with Tenet\nimport tenet\ntrace = tenet.load_trace(\"wtf_trace.log\")\ntrace.seek_to_address(0x7ffcdbb6e1e7)  # OOB read location\n```\n\n**File Format Corpus Building:**\n\n```powershell\n# Collect diverse file samples for fuzzing\n$formats = @(\"*.exe\", \"*.dll\", \"*.pdf\", \"*.docx\", \"*.xlsx\", \"*.js\", \"*.vbs\")\n$corpus_dir = \"C:\\fuzzing\\corpus\\\"\n\nforeach ($format in $formats) {\n    Get-ChildItem -Path \"C:\\Windows\\System32\" -Filter $format -Recurse |\n        ForEach-Object { Copy-Item $_.FullName \"$corpus_dir\\$($_.Name)\" }\n}\n\n# Add malware samples (use VirusTotal\u002FMWDB)\n# Add crafted samples with known vulnerabilities\n```\n\n**Debugging Crashes:**\n\n```windbg\n# WinDBG analysis of mpengine crashes\n.load wow64exts\n!analyze -v\n\n# Check for DRIVER_VERIFIER_DETECTED_VIOLATION (0xc4)\n!verifier\n\n# Examine call stack for OOB reads\nk\n!address @rax  # Check if address is valid\n\n# PageHeap analysis for heap corruption\n!heap -p -a @rax\n```\n\n#### Driver Interface Fuzzing\n\n**FilterConnectionPort Fuzzing:**\n\n```cpp\n\u002F\u002F Sophos Intercept X port fuzzing example\n#include \u003Cwindows.h>\n#include \u003Cfltuser.h>\n\nHANDLE hPort;\nHRESULT hr = FilterConnectCommunicationPort(\n    L\"\\\\SophosPortName\",\n    0,\n    NULL,\n    0,\n    NULL,\n    &hPort\n);\n\nif (SUCCEEDED(hr)) {\n    \u002F\u002F Send malformed messages\n    BYTE fuzzData[1024];\n    DWORD bytesReturned;\n\n    for (int i = 0; i \u003C 10000; i++) {\n        \u002F\u002F Generate mutated data\n        GenerateFuzzData(fuzzData, sizeof(fuzzData));\n\n        FilterSendMessage(\n            hPort,\n            fuzzData,\n            sizeof(fuzzData),\n            NULL,\n            0,\n            &bytesReturned\n        );\n    }\n}\n```\n\n**IOCTL Fuzzing:**\n\n```cpp\n\u002F\u002F EDR device driver IOCTL fuzzing\n#include \u003Cwinioctl.h>\n\nHANDLE hDevice = CreateFile(\n    L\"\\\\\\\\.\\\\PaloEdrControlDevice\",\n    GENERIC_READ | GENERIC_WRITE,\n    0,\n    NULL,\n    OPEN_EXISTING,\n    0,\n    NULL\n);\n\nif (hDevice != INVALID_HANDLE_VALUE) {\n    DWORD bytesReturned;\n    BYTE inputBuffer[4096];\n    BYTE outputBuffer[4096];\n\n    \u002F\u002F Fuzz different IOCTL codes\n    DWORD ioctlCodes[] = {\n        0x2260D0, 0x2260D4, 0x2260D8, 0x2260DC,\n        \u002F\u002F Add more discovered codes\n    };\n\n    for (DWORD ioctl : ioctlCodes) {\n        for (int i = 0; i \u003C 1000; i++) {\n            GenerateFuzzData(inputBuffer, sizeof(inputBuffer));\n\n            DeviceIoControl(\n                hDevice,\n                ioctl,\n                inputBuffer,\n                sizeof(inputBuffer),\n                outputBuffer,\n                sizeof(outputBuffer),\n                &bytesReturned,\n                NULL\n            );\n        }\n    }\n}\n```\n\n#### Mini-Filter Communication Port Fuzzing\n\n**Snapshot fuzzing approach:**\n\n- Target FilterConnectionPorts with malformed messages\n- Use tools like WTF (WhatsApp Trace Framework) for coverage-guided fuzzing\n- Focus on message parsing logic in mini-filter drivers\n\n**WTF Snapshot Fuzzing Implementation:**\n\n```cpp\n\u002F\u002F Example WTF harness for mini-filter fuzzing\nif (!g_Backend->SetBreakpoint(\"nt!KeBugCheck2\", [](Backend_t *Backend) {\n    const uint64_t BCode = Backend->GetArg(0);\n    const uint64_t B0 = Backend->GetArg(1);\n    \u002F\u002F Log crash details for analysis\n    const std::string Filename = fmt::format(\"crash-{:#x}-{:#x}\", BCode, B0);\n    DebugPrint(\"KeBugCheck2: {}\\n\\n\", Filename);\n    Backend->Stop(Crash_t(Filename));\n}))\n```\n\n**Fuzzing Setup Process:**\n\n1. **Snapshot Creation**: Create snapshot at FilterConnectionPort message handling entry point\n2. **Coverage Collection**: Use IDA Lighthouse to visualize code coverage from fuzzing\n3. **Crash Analysis**: Monitor for DRIVER_VERIFIER_DETECTED_VIOLATION (0xc4) and IRQL_NOT_LESS_OR_EQUAL (0xa) bug checks\n4. **False Positive Handling**: Address snapshot IRQL inconsistencies where CR8 register stores interrupted state rather than actual IRQL\n\n**Debugging Techniques:**\n\n- **Tenet Integration**: Load WTF traces in IDA for time-travel debugging capability\n- **ret-sync**: Synchronize WinDBG with IDA for live vs. snapshot execution comparison\n- **Memory Access Monitoring**: Use breakpoints on `nt!ProbeForRead`\u002F`nt!ProbeForWrite` to track pointer validation\n\n### ETC\n\n### Rust Fuzzing & UB Hunting\n\nRust's memory safety guarantees don't eliminate all bugs; `unsafe` blocks, FFI boundaries, and logic errors still need fuzzing.\n\n#### Complete Rust Fuzzing Stack\n\n**1. cargo-fuzz (libFuzzer integration)**\n\n```bash\ncargo install cargo-fuzz\ncargo fuzz init\nRUSTFLAGS=\"-Zsanitizer=address\" RUSTC_BOOTSTRAP=1 cargo fuzz run fuzz_target_1\n\n# With coverage tracking\nRUSTFLAGS=\"-Zsanitizer=address -C instrument-coverage\" cargo fuzz coverage fuzz_target_1\nllvm-cov show target\u002Fcoverage\u002Fdebug\u002Ffuzz_target_1 \\\n  -instr-profile=fuzz-coverage.profdata -format=html > coverage.html\n```\n\n**2. cargo-careful (Nightly Bounds Checking)**\n\nCatches UB that Miri misses, particularly in `std` and runtime edge cases:\n\n```bash\ncargo install cargo-careful\ncargo +nightly careful test\ncargo +nightly careful run --release\n\n# Example: catches out-of-bounds that compile-time checks miss\n# unsafe { slice.get_unchecked(idx) } with runtime bounds violations\n```\n\n**3. Miri (Interpreter-Based UB Detection)**\n\n```bash\ncargo +nightly miri setup\nMIRIFLAGS=\"-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check\" cargo +nightly miri test\n\n# Advanced: track specific allocations\nMIRIFLAGS=\"-Zmiri-track-alloc-id=1234\" cargo +nightly miri test\n```\n\n**4. loom (Concurrency Bug Detection)**\n\nFor testing lock-free data structures and concurrent code:\n\n```rust\n\u002F\u002F Example loom test for concurrent queue\n#[cfg(loom)]\n#[test]\nfn test_concurrent_queue() {\n    loom::model(|| {\n        let queue = Arc::new(Queue::new());\n        let q1 = queue.clone();\n        let q2 = queue.clone();\n\n        let t1 = loom::thread::spawn(move || {\n            q1.push(1);\n        });\n\n        let t2 = loom::thread::spawn(move || {\n            q2.pop()\n        });\n\n        t1.join().unwrap();\n        t2.join().unwrap();\n    });\n}\n```\n\n```bash\n# Run loom tests\nRUSTFLAGS=\"--cfg loom\" cargo test --release\n```\n\n**5. proptest (Property-Based Fuzzing)**\n\nGenerate arbitrary inputs for property testing:\n\n```rust\nuse proptest::prelude::*;\n\nproptest! {\n    #[test]\n    fn test_parser_doesnt_panic(s in \"\\\\PC*\") {\n        \u002F\u002F Property: parser should never panic on any input\n        let _ = std::panic::catch_unwind(|| {\n            parse_input(&s)\n        });\n    }\n\n    #[test]\n    fn test_serialization_roundtrip(data: Vec\u003Cu8>) {\n        \u002F\u002F Property: deserialize(serialize(x)) == x\n        let serialized = serialize(&data);\n        let deserialized = deserialize(&serialized).unwrap();\n        prop_assert_eq!(data, deserialized);\n    }\n}\n```\n\n#### Rust-Specific Vulnerability Classes\n\n**Unsafe Block Vulnerabilities:**\n\n```rust\n\u002F\u002F Common patterns to fuzz:\nunsafe {\n    \u002F\u002F 1. Vec::from_raw_parts with wrong capacity\n    Vec::from_raw_parts(ptr, len, wrong_capacity)\n\n    \u002F\u002F 2. Unchecked indexing\n    slice.get_unchecked(oob_idx)\n\n    \u002F\u002F 3. Transmute with size mismatch\n    std::mem::transmute::\u003CSmallType, LargeType>(val)\n\n    \u002F\u002F 4. Pointer arithmetic\n    ptr.offset(unchecked_offset)\n}\n```\n\n**FFI Boundary Bugs:**\n\n```rust\n\u002F\u002F Fuzz C library calls\n#[no_mangle]\npub extern \"C\" fn parse_external(data: *const u8, len: usize) {\n    unsafe {\n        \u002F\u002F Size mismatch between Rust and C types\n        let c_struct: CStruct = libc_parse(data, len as c_int); \u002F\u002F Truncation!\n    }\n}\n```\n\n#### Comprehensive Rust Fuzzing Workflow\n\n```bash\n# 1. Start with property tests (fast)\ncargo test\n\n# 2. Run Miri on test suite (catches UB)\ncargo +nightly miri test\n\n# 3. Add cargo-careful for runtime bounds checks\ncargo +nightly careful test\n\n# 4. Fuzz with cargo-fuzz (find crashes)\ncargo fuzz run fuzz_target_1 -- -max_total_time=3600\n\n# 5. Test concurrency with loom (if applicable)\nRUSTFLAGS=\"--cfg loom\" cargo test --release\n\n# 6. Coverage analysis\ncargo fuzz coverage fuzz_target_1\n```\n\n#### Integration with LibAFL (Advanced)\n\nFor Rust projects needing custom fuzzing logic:\n\n```rust\nuse libafl::prelude::*;\n\n\u002F\u002F Custom Rust fuzzer with LibAFL\nlet mut harness = |input: &BytesInput| {\n    let data = input.bytes();\n    ExitKind::Ok\n};\n\n\u002F\u002F Add custom mutators, feedback, etc.\n```\n\n#### Snapshot Fuzzing\n\n- Takes a snapshot of the target program\u002FOS memory state and registers\n- Executes from snapshot in emulated environment, mutating memory data\n- Resets to original snapshot when execution crashes or reaches specified point\n- Advantages:\n  - Fast execution (skips program startup)\n  - Highly deterministic testing\n  - No source code required\n  - Easy tracking of code coverage and crashes\n- Disadvantages:\n  - Time-consuming setup process\n  - Requires specialized knowledge\n- Tools:\n  - wtf (what the fuzz) – Windows\u002FLinux\u002FmacOS, supports > 4 GB snapshots\n  - Snapchange (AWS)\n  - Nyx v2 – integrates Intel® PT tracing and plugs into AFL++ (`NYX_MODE=1`), sustaining ~20 k exec\u002Fs on full VM targets.\n\n#### Embedded Systems Fuzzing\n\n- Targets firmware, IoT devices, and embedded software\n- Challenges:\n  - Architecture diversity (MIPS, ARM, etc.)\n  - Binary-only targets (no source access)\n  - Emulation requirements\n  - Limited or no sanitizer support\n- Tools:\n  - LibAFL (0.15.2) – Modular Rust framework; key features include Unicorn engine, snapshot module, StatsD monitoring, LBRFeedback, SAND (Decoupled Sanitization) support, and a Rust-based binary-only ASan for its updated QEMU (v9.2.2) backend.\n  - Qemu-based emulation\n  - Nautilus - Grammar-based fuzzing\n\n#### Language Ecosystem Fuzzing\n\n- Go (1.18+): built‑in fuzzing via `go test -fuzz=Fuzz -run=^$ .\u002F...` with `FuzzXxx(*testing.F, data []byte)` signatures.\n- Python: [Atheris](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris) for native CPython fuzzing; integrates with `pytest` and OSS‑Fuzz.\n- Rust: `cargo-fuzz` (libFuzzer), or LibAFL for custom pipelines; coverage via `cargo llvm-cov`.\n\n#### CI\u002FCD Fuzzing\n\n- Lightweight CI with ClusterFuzzLite or GitHub Actions matrix jobs; cache corpora between runs.\n- Example (GitHub Actions):\n\n  ```yaml\n  name: fuzz\n  on: [push, pull_request]\n  jobs:\n    afl:\n      runs-on: ubuntu-latest\n      steps:\n        - uses: actions\u002Fcheckout@v4\n        - name: Build with afl-clang-fast\n          run: |\n            sudo apt-get update && sudo apt-get install -y clang llvm\n            make clean && CC=afl-clang-fast CXX=afl-clang-fast++ make -j\n        - name: Run AFL++ (short smoke)\n          run: |\n            mkdir -p seeds findings\n            echo \"{}\" > seeds\u002Fmin.json\n            timeout 15m afl-fuzz -i seeds -o findings -- .\u002Ftarget @@ || true\n    libfuzzer:\n      runs-on: ubuntu-latest\n      steps:\n        - uses: actions\u002Fcheckout@v4\n        - name: Build fuzz target\n          run: |\n            cmake -S . -B build -DCMAKE_CXX_FLAGS=\"-fsanitize=fuzzer,address,undefined -O1 -g\"\n            cmake --build build -j\n        - name: Run fuzz target (sanitizers)\n          run: timeout 15m .\u002Fbuild\u002Fmy_fuzz_target -max_total_time=900 || true\n  ```\n\n- Upload artifacts (crashes, logs) in CI for manual triage:\n\n  ```yaml\n  - name: Upload crashes\n    if: always()\n    uses: actions\u002Fupload-artifact@v4\n    with:\n      name: crashes\n      path: |\n        findings\u002F**\u002Fcrashes\u002F*\n        findings\u002F**\u002Fhangs\u002F*\n        **\u002F*.log\n  ```\n\n#### OSS‑Fuzz onboarding (quick checklist)\n\n- Build system supports sanitizers and libFuzzer entrypoints\n- Minimal seed corpus in `seed_corpus\u002F`\n- Reproducers saved on crash; asserts map to sanitizer failures\n- `project.yaml` configured with timeouts, fuzzers, and language\n\n#### LLM‑Guided Fuzzing\n\n- Use LLMs to propose input dictionaries, seed structures, and targeted mutations when coverage stalls.\n- Tools: ChatAFL\u002FHyLLFuzz integrations; prompt with protocol docs or examples to generate grammar hints.\n\n#### Grammar-Based Fuzzing\n\n- Generates inputs according to a defined grammar\u002Fstructure\n- Useful for highly-structured inputs where random mutations would be rejected\n- Hybrid approaches combine grammar with coverage feedback\n- Examples:\n  - Nautilus - Grammar mutational fuzzer\n  - AFLSmart - Smart greybox fuzzer with input awareness\n  - Tlspuffin - Protocol fuzzer for TLS\n\n#### Triaging and Analysis\n\n- Process for analyzing fuzzer-generated crashes\n- Techniques:\n  - Crash reproducibility - Using minimized test cases\n  - Crash minimization - Removing unnecessary input bytes\n  - Root cause analysis - Identifying the vulnerable code\n  - Backtrace reconstruction - Finding where the crash occurs\n  - Partial overwrites - Leaking memory addresses\n  - Memory pattern analysis - Identifying corruption patterns\n\n#### Extended Instrumentation\n\n- Extends coverage-guided fuzzing instrumentation to collect additional data beyond basic edge coverage\n- Benefits:\n  - Identifies vulnerable execution paths more efficiently\n  - Provides better feedback to guide the fuzzer toward interesting targets\n  - Can focus fuzzing on historically vulnerable code areas\n- Implementation techniques:\n  - Access program counter (PC) information during execution\n  - Track real-time stack traces to identify vulnerable functions\n  - Utilize return address information to trace execution paths\n  - Compare PC to specific address spaces of interest\n- Example application:\n  - Modifying Fuzzilli's instrumentation for JerryScript to extract useful data\n  - Using `__builtin_return_address(0)` to get current PC address\n  - Tracking stack traces to narrow down root causes of vulnerabilities\n- Potential improvements:\n  - Feed historical vulnerability data to guide future fuzzing\n  - Correlate \"dangerous\" files to their address space\n  - Direct fuzzer to focus on specific paths by prioritizing certain inputs\n\n#### eBPF & Kernel‑in‑Kernel Fuzzing\n\n- syzkaller's `executor_bpf` and verifier‑stress templates exercise the in‑kernel eBPF verifier and JIT paths.\n\n#### WebAssembly Runtime Fuzzing\n\n- Differential‑fuzz runtimes such as V8, Wasmer, and Wasmtime with tools like `wasmtime-fuzz` and `wafl`.\n\n#### Smart‑Contract Fuzzing\n\n- Use _Echidna_ and _Foundry‑fuzz_ for Solidity, or _Move‑Fuzz_ for Aptos\u002FSui; all integrate cleanly into CI pipelines.\n\n#### USB & Bluetooth Stack Fuzzing\n\n- Snapshot‑plus‑wire‑capture harnesses from _HydraUSBFuzz_ and _BT‑SnoopFuzz_ enable realistic peripheral fuzzing.\n\n#### DMA-BUF Subsystem Fuzzing\n\n- Target memory-sharing frameworks in the Linux kernel that don't use traditional `copy_from_user`\n- Focus on fuzzing:\n  - Custom implementations of `struct dma_buf_ops` callbacks\n  - Page fault handlers in VM operations structures\n  - DMA-BUF heap allocation operations\n  - Bounds checking in buffer access operations\n- Generate test cases that exercise:\n  - Memory mapping with different page offsets\n  - Buffer allocation with various sizes and flags\n  - Complex interaction patterns between different DMA-BUF operations\n- Use coverage-guided fuzzing with kernel instrumentation to identify execution paths in these subsystems\n\n#### AI\u002FML Model Fuzzing\n\n- Tools such as _DeepFuzz_ and _TextFuzzer_ measure neuron coverage and search for jailbreak or adversarial failures.\n\n#### Fuzzing Rust Crates\n\n- First‑class Rust support through `cargo‑fuzz`, `honggfuzz‑rs`, or LibAFL with Cargo feature flags.\n\n## Diagrams\n\n### Fuzzer Architecture\n\n```mermaid\nflowchart TB\n    Input[\"Input Generation\u002FMutation\"]\n    Target[\"Target Program\"]\n    Feedback[\"Feedback Mechanism\"]\n    Crash[\"Crash Detection\"]\n    Analysis[\"Crash Analysis\"]\n\n    Input --> Target\n    Target --> Feedback\n    Feedback --> Input\n    Target --> Crash\n    Crash --> Analysis\n\n    subgraph Fuzzer\n        Input\n        Feedback\n    end\n\n    subgraph Target Environment\n        Target\n        Crash\n    end\n\n    subgraph Post-Processing\n        Analysis\n    end\n```\n\n### Coverage-Guided Fuzzing Process\n\n```mermaid\nsequenceDiagram\n    participant F as Fuzzer\n    participant H as Harness\n    participant T as Target\n    participant C as Coverage Tracker\n\n    F->>F: Generate\u002FMutate Input\n    F->>H: Send Input\n    H->>T: Execute with Input\n    T->>C: Record Code Coverage\n    C->>F: Return Coverage Info\n    F->>F: Evaluate Coverage\n    F->>F: Add to Corpus if New Coverage\n\n    alt Crash Detected\n        T->>H: Crash Information\n        H->>F: Report Crash\n        F->>F: Save Crash Input\n    end\n```\n\n### Memory Error Detection Techniques\n\n```mermaid\nflowchart LR\n    M[\"Memory Errors\"]\n\n    ASan[\"Address Sanitizer\"]\n    MSan[\"Memory Sanitizer\"]\n    PHeap[\"Page Heap\"]\n    Valgrind[\"Valgrind\"]\n\n    M --> ASan\n    M --> MSan\n    M --> PHeap\n    M --> Valgrind\n\n    subgraph \"Error Types\"\n        BOF[\"Buffer Overflow\"]\n        UAF[\"Use-After-Free\"]\n        UIR[\"Uninitialized Read\"]\n    end\n\n    ASan --> BOF\n    ASan --> UAF\n    MSan --> UIR\n    PHeap --> BOF\n    PHeap --> UAF\n    Valgrind --> BOF\n    Valgrind --> UAF\n    Valgrind --> UIR\n```\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FSnailSploit\u002FClaude-Red\u002Foffensive-fuzzing",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill offensive-fuzzing",{"tool":45,"command":46},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill offensive-fuzzing",{"tool":48,"command":49},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill offensive-fuzzing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FSnailSploit\u002FClaude-Red\u002Foffensive-fuzzing\u002FSKILL.md",true,[],[54,64,74,83,89,96],{"skillNo":55,"name":56,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":60,"publishedAt":26},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[59],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[61,62,63],"model","model hierarchy","model hierarchy skill",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":70,"publishedAt":26},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[69],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[71,72,73],"MCP","zoom","zoom mcp",{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":26},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[80,81,82,72],"sdk","zoom apps sdk","apps",{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":26},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[85],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":95,"publishedAt":26},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[94],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[91],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":26},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[98]]