[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BQHV9B38T038T5WXG8MPF":3,"skill-same:01M75BQHV9B38T038T5WXG8MPF":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M75BQHV9B38T038T5WXG8MPF","atheris",null,"Atheris is a coverage-guided Python fuzzer based on libFuzzer. Use for fuzzing pure Python code and Python C extensions.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fatheris\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: atheris\ntype: fuzzer\ndescription: >\n  Atheris is a coverage-guided Python fuzzer based on libFuzzer.\n  Use for fuzzing pure Python code and Python C extensions.\n---\n\n# Atheris\n\nAtheris is a coverage-guided Python fuzzer built on libFuzzer. It enables fuzzing of both pure Python code and Python C extensions with integrated AddressSanitizer support for detecting memory corruption issues.\n\n## When to Use\n\n| Fuzzer | Best For | Complexity |\n|--------|----------|------------|\n| Atheris | Python code and C extensions | Low-Medium |\n| Hypothesis | Property-based testing | Low |\n| python-afl | AFL-style fuzzing | Medium |\n\n**Choose Atheris when:**\n- Fuzzing pure Python code with coverage guidance\n- Testing Python C extensions for memory corruption\n- Integration with libFuzzer ecosystem is desired\n- AddressSanitizer support is needed\n\n## Quick Start\n\n```python\nimport sys\nimport atheris\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    if len(data) == 4:\n        if data[0] == 0x46:  # \"F\"\n            if data[1] == 0x55:  # \"U\"\n                if data[2] == 0x5A:  # \"Z\"\n                    if data[3] == 0x5A:  # \"Z\"\n                        raise RuntimeError(\"You caught me\")\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun:\n```bash\npython fuzz.py\n```\n\n## Installation\n\nAtheris supports 32-bit and 64-bit Linux, and macOS. We recommend fuzzing on Linux because it's simpler to manage and often faster.\n\n### Prerequisites\n\n- Python 3.7 or later\n- Recent version of clang (preferably [latest release](https:\u002F\u002Fgithub.com\u002Fllvm\u002Fllvm-project\u002Freleases))\n- For Docker users: [Docker Desktop](https:\u002F\u002Fwww.docker.com\u002Fproducts\u002Fdocker-desktop\u002F)\n\n### Linux\u002FmacOS\n\n```bash\nuv pip install atheris\n```\n\n### Docker Environment (Recommended)\n\nFor a fully operational Linux environment with all dependencies configured:\n\n```dockerfile\n# https:\u002F\u002Fhub.docker.com\u002F_\u002Fpython\nARG PYTHON_VERSION=3.11\n\nFROM python:$PYTHON_VERSION-slim-bookworm\n\nRUN python --version\n\nRUN apt update && apt install -y \\\n    ca-certificates \\\n    wget \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# LLVM builds version 15-19 for Debian 12 (Bookworm)\n# https:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002Fdists\u002F\nARG LLVM_VERSION=19\n\nRUN echo \"deb http:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002F llvm-toolchain-bookworm-$LLVM_VERSION main\" > \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fllvm.list\nRUN echo \"deb-src http:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002F llvm-toolchain-bookworm-$LLVM_VERSION main\" >> \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fllvm.list\nRUN wget -qO- https:\u002F\u002Fapt.llvm.org\u002Fllvm-snapshot.gpg.key > \u002Fetc\u002Fapt\u002Ftrusted.gpg.d\u002Fapt.llvm.org.asc\n\nRUN apt update && apt install -y \\\n    build-essential \\\n    clang-$LLVM_VERSION \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\nENV APP_DIR \"\u002Fapp\"\nRUN mkdir $APP_DIR\nWORKDIR $APP_DIR\n\nENV VIRTUAL_ENV \"\u002Fopt\u002Fvenv\"\nRUN python -m venv $VIRTUAL_ENV\nENV PATH \"$VIRTUAL_ENV\u002Fbin:$PATH\"\n\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#step-1-compiling-your-extension\nENV CC=\"clang-$LLVM_VERSION\"\nENV CFLAGS \"-fsanitize=address,fuzzer-no-link\"\nENV CXX=\"clang++-$LLVM_VERSION\"\nENV CXXFLAGS \"-fsanitize=address,fuzzer-no-link\"\nENV LDSHARED=\"clang-$LLVM_VERSION -shared\"\nENV LDSHAREDXX=\"clang++-$LLVM_VERSION -shared\"\nENV ASAN_SYMBOLIZER_PATH=\"\u002Fusr\u002Fbin\u002Fllvm-symbolizer-$LLVM_VERSION\"\n\n# Allow Atheris to find fuzzer sanitizer shared libs\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris#building-from-source\nRUN LIBFUZZER_LIB=$($CC -print-file-name=libclang_rt.fuzzer_no_main-$(uname -m).a) \\\n    python -m pip install --no-binary atheris atheris\n\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#option-a-sanitizerlibfuzzer-preloads\nENV LD_PRELOAD \"$VIRTUAL_ENV\u002Flib\u002Fpython3.11\u002Fsite-packages\u002Fasan_with_fuzzer.so\"\n\n# 1. Skip memory allocation failures for now, they are common, and low impact (DoS)\n# 2. https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#leak-detection\nENV ASAN_OPTIONS \"allocator_may_return_null=1,detect_leaks=0\"\n\nCMD [\"\u002Fbin\u002Fbash\"]\n```\n\nBuild and run:\n```bash\ndocker build -t atheris .\ndocker run -it atheris\n```\n\n### Verification\n\n```bash\npython -c \"import atheris; print(atheris.__version__)\"\n```\n\n## Writing a Harness\n\n### Harness Structure for Pure Python\n\n```python\nimport sys\nimport atheris\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    \"\"\"\n    Fuzzing entry point. Called with random byte sequences.\n\n    Args:\n        data: Random bytes generated by the fuzzer\n    \"\"\"\n    # Add input validation if needed\n    if len(data) \u003C 1:\n        return\n\n    # Call your target function\n    try:\n        your_target_function(data)\n    except ValueError:\n        # Expected exceptions should be caught\n        pass\n    # Let unexpected exceptions crash (that's what we're looking for!)\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Harness Rules\n\n| Do | Don't |\n|----|-------|\n| Use `@atheris.instrument_func` for coverage | Forget to instrument target code |\n| Catch expected exceptions | Catch all exceptions indiscriminately |\n| Use `atheris.instrument_imports()` for libraries | Import modules after `atheris.Setup()` |\n| Keep harness deterministic | Use randomness or time-based behavior |\n\n> **See Also:** For detailed harness writing techniques, patterns for handling complex inputs,\n> and advanced strategies, see the **fuzz-harness-writing** technique skill.\n\n## Fuzzing Pure Python Code\n\nFor fuzzing broader parts of an application or library, use instrumentation functions:\n\n```python\nimport atheris\nwith atheris.instrument_imports():\n    import your_module\n    from another_module import target_function\n\ndef test_one_input(data: bytes):\n    target_function(data)\n\natheris.Setup(sys.argv, test_one_input)\natheris.Fuzz()\n```\n\n**Instrumentation Options:**\n- `atheris.instrument_func` - Decorator for single function instrumentation\n- `atheris.instrument_imports()` - Context manager for instrumenting all imported modules\n- `atheris.instrument_all()` - Instrument all Python code system-wide\n\n## Fuzzing Python C Extensions\n\nPython C extensions require compilation with specific flags for instrumentation and sanitizer support.\n\n### Environment Configuration\n\nIf using the provided Dockerfile, these are already configured. For local setup:\n\n```bash\nexport CC=\"clang\"\nexport CFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport CXX=\"clang++\"\nexport CXXFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport LDSHARED=\"clang -shared\"\n```\n\n### Example: Fuzzing cbor2\n\nInstall the extension from source:\n```bash\nCBOR2_BUILD_C_EXTENSION=1 python -m pip install --no-binary cbor2 cbor2==5.6.4\n```\n\nThe `--no-binary` flag ensures the C extension is compiled locally with instrumentation.\n\nCreate `cbor2-fuzz.py`:\n```python\nimport sys\nimport atheris\n\n# _cbor2 ensures the C library is imported\nfrom _cbor2 import loads\n\ndef test_one_input(data: bytes):\n    try:\n        loads(data)\n    except Exception:\n        # We're searching for memory corruption, not Python exceptions\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun:\n```bash\npython cbor2-fuzz.py\n```\n\n> **Important:** When running locally (not in Docker), you must [set `LD_PRELOAD` manually](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#option-a-sanitizerlibfuzzer-preloads).\n\n## Corpus Management\n\n### Creating Initial Corpus\n\n```bash\nmkdir corpus\n# Add seed inputs\necho \"test data\" > corpus\u002Fseed1\necho '{\"key\": \"value\"}' > corpus\u002Fseed2\n```\n\nRun with corpus:\n```bash\npython fuzz.py corpus\u002F\n```\n\n### Corpus Minimization\n\nAtheris inherits corpus minimization from libFuzzer:\n```bash\npython fuzz.py -merge=1 new_corpus\u002F old_corpus\u002F\n```\n\n> **See Also:** For corpus creation strategies, dictionaries, and seed selection,\n> see the **fuzzing-corpus** technique skill.\n\n## Running Campaigns\n\n### Basic Run\n\n```bash\npython fuzz.py\n```\n\n### With Corpus Directory\n\n```bash\npython fuzz.py corpus\u002F\n```\n\n### Common Options\n\n```bash\n# Run for 10 minutes\npython fuzz.py -max_total_time=600\n\n# Limit input size\npython fuzz.py -max_len=1024\n\n# Run with multiple workers\npython fuzz.py -workers=4 -jobs=4\n```\n\n### Interpreting Output\n\n| Output | Meaning |\n|--------|---------|\n| `NEW    cov: X` | Found new coverage, corpus expanded |\n| `pulse  cov: X` | Periodic status update |\n| `exec\u002Fs: X` | Executions per second (throughput) |\n| `corp: X\u002FYb` | Corpus size: X inputs, Y bytes total |\n| `ERROR: libFuzzer` | Crash detected |\n\n## Sanitizer Integration\n\n### AddressSanitizer (ASan)\n\nAddressSanitizer is automatically integrated when using the provided Docker environment or when compiling with appropriate flags.\n\nFor local setup:\n```bash\nexport CFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport CXXFLAGS=\"-fsanitize=address,fuzzer-no-link\"\n```\n\nConfigure ASan behavior:\n```bash\nexport ASAN_OPTIONS=\"allocator_may_return_null=1,detect_leaks=0\"\n```\n\n### LD_PRELOAD Configuration\n\nFor native extension fuzzing:\n```bash\nexport LD_PRELOAD=\"$(python -c 'import atheris; import os; print(os.path.join(os.path.dirname(atheris.__file__), \"asan_with_fuzzer.so\"))')\"\n```\n\n> **See Also:** For detailed sanitizer configuration, common issues, and advanced flags,\n> see the **address-sanitizer** and **undefined-behavior-sanitizer** technique skills.\n\n### Common Sanitizer Issues\n\n| Issue | Solution |\n|-------|----------|\n| `LD_PRELOAD` not set | Export `LD_PRELOAD` to point to `asan_with_fuzzer.so` |\n| Memory allocation failures | Set `ASAN_OPTIONS=allocator_may_return_null=1` |\n| Leak detection noise | Set `ASAN_OPTIONS=detect_leaks=0` |\n| Missing symbolizer | Set `ASAN_SYMBOLIZER_PATH` to `llvm-symbolizer` |\n\n## Advanced Usage\n\n### Tips and Tricks\n\n| Tip | Why It Helps |\n|-----|--------------|\n| Use `atheris.instrument_imports()` early | Ensures all imports are instrumented for coverage |\n| Start with small `max_len` | Faster initial fuzzing, gradually increase |\n| Use dictionaries for structured formats | Helps fuzzer understand format tokens |\n| Run multiple parallel instances | Better coverage exploration |\n\n### Custom Instrumentation\n\nFine-tune what gets instrumented:\n```python\nimport atheris\n\n# Instrument only specific modules\nwith atheris.instrument_imports():\n    import target_module\n# Don't instrument test harness code\n\ndef test_one_input(data: bytes):\n    target_module.parse(data)\n```\n\n### Performance Tuning\n\n| Setting | Impact |\n|---------|--------|\n| `-max_len=N` | Smaller values = faster execution |\n| `-workers=N -jobs=N` | Parallel fuzzing for faster coverage |\n| `ASAN_OPTIONS=fast_unwind_on_malloc=0` | Better stack traces, slower execution |\n\n### UndefinedBehaviorSanitizer (UBSan)\n\nAdd UBSan to catch additional bugs:\n```bash\nexport CFLAGS=\"-fsanitize=address,undefined,fuzzer-no-link\"\nexport CXXFLAGS=\"-fsanitize=address,undefined,fuzzer-no-link\"\n```\n\nNote: Modify flags in Dockerfile if using containerized setup.\n\n## Real-World Examples\n\n### Example: Pure Python Parser\n\n```python\nimport sys\nimport atheris\nimport json\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    try:\n        # Fuzz Python's JSON parser\n        json.loads(data.decode('utf-8', errors='ignore'))\n    except (ValueError, UnicodeDecodeError):\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Example: HTTP Request Parsing\n\n```python\nimport sys\nimport atheris\n\nwith atheris.instrument_imports():\n    from urllib3 import HTTPResponse\n    from io import BytesIO\n\ndef test_one_input(data: bytes):\n    try:\n        # Fuzz HTTP response parsing\n        fake_response = HTTPResponse(\n            body=BytesIO(data),\n            headers={},\n            preload_content=False\n        )\n        fake_response.read()\n    except Exception:\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| No coverage increase | Poor seed corpus or target not instrumented | Add better seeds, verify `instrument_imports()` |\n| Slow execution | ASan overhead or large inputs | Reduce `max_len`, use `ASAN_OPTIONS=fast_unwind_on_malloc=1` |\n| Import errors | Modules imported before instrumentation | Move imports inside `instrument_imports()` context |\n| Segfault without ASan output | Missing `LD_PRELOAD` | Set `LD_PRELOAD` to `asan_with_fuzzer.so` path |\n| Build failures | Wrong compiler or missing flags | Verify `CC`, `CFLAGS`, and clang version |\n\n## Related Skills\n\n### Technique Skills\n\n| Skill | Use Case |\n|-------|----------|\n| **fuzz-harness-writing** | Detailed guidance on writing effective harnesses |\n| **address-sanitizer** | Memory error detection during fuzzing |\n| **undefined-behavior-sanitizer** | Catching undefined behavior in C extensions |\n| **coverage-analysis** | Measuring and improving code coverage |\n| **fuzzing-corpus** | Building and managing seed corpora |\n\n### Related Fuzzers\n\n| Skill | When to Consider |\n|-------|------------------|\n| **hypothesis** | Property-based testing with type-aware generation |\n| **python-afl** | AFL-style fuzzing for Python when Atheris isn't available |\n\n## Resources\n\n### Key External Resources\n\n**[Atheris GitHub Repository](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris)**\nOfficial repository with installation instructions, examples, and documentation for fuzzing both pure Python and native extensions.\n\n**[Native Extension Fuzzing Guide](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md)**\nComprehensive guide covering compilation flags, LD_PRELOAD setup, sanitizer configuration, and troubleshooting for Python C extensions.\n\n**[Continuously Fuzzing Python C Extensions](https:\u002F\u002Fblog.trailofbits.com\u002F2024\u002F02\u002F23\u002Fcontinuously-fuzzing-python-c-extensions\u002F)**\nTrail of Bits blog post covering CI\u002FCD integration, ClusterFuzzLite setup, and real-world examples of fuzzing Python C extensions in continuous integration pipelines.\n\n**[ClusterFuzzLite Python Integration](https:\u002F\u002Fgoogle.github.io\u002Fclusterfuzzlite\u002Fbuild-integration\u002Fpython-lang\u002F)**\nGuide for integrating Atheris fuzzing into CI\u002FCD pipelines using ClusterFuzzLite for automated continuous fuzzing.\n\n### Video Resources\n\nVideos and tutorials are available in the main Atheris documentation and libFuzzer resources.\n","# Atheris\n\nAtheris is a coverage-guided Python fuzzer built on libFuzzer. It enables fuzzing of both pure Python code and Python C extensions with integrated AddressSanitizer support for detecting memory corruption issues.\n\n## When to Use\n\n| Fuzzer | Best For | Complexity |\n|--------|----------|------------|\n| Atheris | Python code and C extensions | Low-Medium |\n| Hypothesis | Property-based testing | Low |\n| python-afl | AFL-style fuzzing | Medium |\n\n**Choose Atheris when:**\n- Fuzzing pure Python code with coverage guidance\n- Testing Python C extensions for memory corruption\n- Integration with libFuzzer ecosystem is desired\n- AddressSanitizer support is needed\n\n## Quick Start\n\n```python\nimport sys\nimport atheris\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    if len(data) == 4:\n        if data[0] == 0x46:  # \"F\"\n            if data[1] == 0x55:  # \"U\"\n                if data[2] == 0x5A:  # \"Z\"\n                    if data[3] == 0x5A:  # \"Z\"\n                        raise RuntimeError(\"You caught me\")\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun:\n```bash\npython fuzz.py\n```\n\n## Installation\n\nAtheris supports 32-bit and 64-bit Linux, and macOS. We recommend fuzzing on Linux because it's simpler to manage and often faster.\n\n### Prerequisites\n\n- Python 3.7 or later\n- Recent version of clang (preferably [latest release](https:\u002F\u002Fgithub.com\u002Fllvm\u002Fllvm-project\u002Freleases))\n- For Docker users: [Docker Desktop](https:\u002F\u002Fwww.docker.com\u002Fproducts\u002Fdocker-desktop\u002F)\n\n### Linux\u002FmacOS\n\n```bash\nuv pip install atheris\n```\n\n### Docker Environment (Recommended)\n\nFor a fully operational Linux environment with all dependencies configured:\n\n```dockerfile\n# https:\u002F\u002Fhub.docker.com\u002F_\u002Fpython\nARG PYTHON_VERSION=3.11\n\nFROM python:$PYTHON_VERSION-slim-bookworm\n\nRUN python --version\n\nRUN apt update && apt install -y \\\n    ca-certificates \\\n    wget \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# LLVM builds version 15-19 for Debian 12 (Bookworm)\n# https:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002Fdists\u002F\nARG LLVM_VERSION=19\n\nRUN echo \"deb http:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002F llvm-toolchain-bookworm-$LLVM_VERSION main\" > \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fllvm.list\nRUN echo \"deb-src http:\u002F\u002Fapt.llvm.org\u002Fbookworm\u002F llvm-toolchain-bookworm-$LLVM_VERSION main\" >> \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fllvm.list\nRUN wget -qO- https:\u002F\u002Fapt.llvm.org\u002Fllvm-snapshot.gpg.key > \u002Fetc\u002Fapt\u002Ftrusted.gpg.d\u002Fapt.llvm.org.asc\n\nRUN apt update && apt install -y \\\n    build-essential \\\n    clang-$LLVM_VERSION \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\nENV APP_DIR \"\u002Fapp\"\nRUN mkdir $APP_DIR\nWORKDIR $APP_DIR\n\nENV VIRTUAL_ENV \"\u002Fopt\u002Fvenv\"\nRUN python -m venv $VIRTUAL_ENV\nENV PATH \"$VIRTUAL_ENV\u002Fbin:$PATH\"\n\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#step-1-compiling-your-extension\nENV CC=\"clang-$LLVM_VERSION\"\nENV CFLAGS \"-fsanitize=address,fuzzer-no-link\"\nENV CXX=\"clang++-$LLVM_VERSION\"\nENV CXXFLAGS \"-fsanitize=address,fuzzer-no-link\"\nENV LDSHARED=\"clang-$LLVM_VERSION -shared\"\nENV LDSHAREDXX=\"clang++-$LLVM_VERSION -shared\"\nENV ASAN_SYMBOLIZER_PATH=\"\u002Fusr\u002Fbin\u002Fllvm-symbolizer-$LLVM_VERSION\"\n\n# Allow Atheris to find fuzzer sanitizer shared libs\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris#building-from-source\nRUN LIBFUZZER_LIB=$($CC -print-file-name=libclang_rt.fuzzer_no_main-$(uname -m).a) \\\n    python -m pip install --no-binary atheris atheris\n\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#option-a-sanitizerlibfuzzer-preloads\nENV LD_PRELOAD \"$VIRTUAL_ENV\u002Flib\u002Fpython3.11\u002Fsite-packages\u002Fasan_with_fuzzer.so\"\n\n# 1. Skip memory allocation failures for now, they are common, and low impact (DoS)\n# 2. https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#leak-detection\nENV ASAN_OPTIONS \"allocator_may_return_null=1,detect_leaks=0\"\n\nCMD [\"\u002Fbin\u002Fbash\"]\n```\n\nBuild and run:\n```bash\ndocker build -t atheris .\ndocker run -it atheris\n```\n\n### Verification\n\n```bash\npython -c \"import atheris; print(atheris.__version__)\"\n```\n\n## Writing a Harness\n\n### Harness Structure for Pure Python\n\n```python\nimport sys\nimport atheris\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    \"\"\"\n    Fuzzing entry point. Called with random byte sequences.\n\n    Args:\n        data: Random bytes generated by the fuzzer\n    \"\"\"\n    # Add input validation if needed\n    if len(data) \u003C 1:\n        return\n\n    # Call your target function\n    try:\n        your_target_function(data)\n    except ValueError:\n        # Expected exceptions should be caught\n        pass\n    # Let unexpected exceptions crash (that's what we're looking for!)\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Harness Rules\n\n| Do | Don't |\n|----|-------|\n| Use `@atheris.instrument_func` for coverage | Forget to instrument target code |\n| Catch expected exceptions | Catch all exceptions indiscriminately |\n| Use `atheris.instrument_imports()` for libraries | Import modules after `atheris.Setup()` |\n| Keep harness deterministic | Use randomness or time-based behavior |\n\n> **See Also:** For detailed harness writing techniques, patterns for handling complex inputs,\n> and advanced strategies, see the **fuzz-harness-writing** technique skill.\n\n## Fuzzing Pure Python Code\n\nFor fuzzing broader parts of an application or library, use instrumentation functions:\n\n```python\nimport atheris\nwith atheris.instrument_imports():\n    import your_module\n    from another_module import target_function\n\ndef test_one_input(data: bytes):\n    target_function(data)\n\natheris.Setup(sys.argv, test_one_input)\natheris.Fuzz()\n```\n\n**Instrumentation Options:**\n- `atheris.instrument_func` - Decorator for single function instrumentation\n- `atheris.instrument_imports()` - Context manager for instrumenting all imported modules\n- `atheris.instrument_all()` - Instrument all Python code system-wide\n\n## Fuzzing Python C Extensions\n\nPython C extensions require compilation with specific flags for instrumentation and sanitizer support.\n\n### Environment Configuration\n\nIf using the provided Dockerfile, these are already configured. For local setup:\n\n```bash\nexport CC=\"clang\"\nexport CFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport CXX=\"clang++\"\nexport CXXFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport LDSHARED=\"clang -shared\"\n```\n\n### Example: Fuzzing cbor2\n\nInstall the extension from source:\n```bash\nCBOR2_BUILD_C_EXTENSION=1 python -m pip install --no-binary cbor2 cbor2==5.6.4\n```\n\nThe `--no-binary` flag ensures the C extension is compiled locally with instrumentation.\n\nCreate `cbor2-fuzz.py`:\n```python\nimport sys\nimport atheris\n\n# _cbor2 ensures the C library is imported\nfrom _cbor2 import loads\n\ndef test_one_input(data: bytes):\n    try:\n        loads(data)\n    except Exception:\n        # We're searching for memory corruption, not Python exceptions\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun:\n```bash\npython cbor2-fuzz.py\n```\n\n> **Important:** When running locally (not in Docker), you must [set `LD_PRELOAD` manually](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md#option-a-sanitizerlibfuzzer-preloads).\n\n## Corpus Management\n\n### Creating Initial Corpus\n\n```bash\nmkdir corpus\n# Add seed inputs\necho \"test data\" > corpus\u002Fseed1\necho '{\"key\": \"value\"}' > corpus\u002Fseed2\n```\n\nRun with corpus:\n```bash\npython fuzz.py corpus\u002F\n```\n\n### Corpus Minimization\n\nAtheris inherits corpus minimization from libFuzzer:\n```bash\npython fuzz.py -merge=1 new_corpus\u002F old_corpus\u002F\n```\n\n> **See Also:** For corpus creation strategies, dictionaries, and seed selection,\n> see the **fuzzing-corpus** technique skill.\n\n## Running Campaigns\n\n### Basic Run\n\n```bash\npython fuzz.py\n```\n\n### With Corpus Directory\n\n```bash\npython fuzz.py corpus\u002F\n```\n\n### Common Options\n\n```bash\n# Run for 10 minutes\npython fuzz.py -max_total_time=600\n\n# Limit input size\npython fuzz.py -max_len=1024\n\n# Run with multiple workers\npython fuzz.py -workers=4 -jobs=4\n```\n\n### Interpreting Output\n\n| Output | Meaning |\n|--------|---------|\n| `NEW    cov: X` | Found new coverage, corpus expanded |\n| `pulse  cov: X` | Periodic status update |\n| `exec\u002Fs: X` | Executions per second (throughput) |\n| `corp: X\u002FYb` | Corpus size: X inputs, Y bytes total |\n| `ERROR: libFuzzer` | Crash detected |\n\n## Sanitizer Integration\n\n### AddressSanitizer (ASan)\n\nAddressSanitizer is automatically integrated when using the provided Docker environment or when compiling with appropriate flags.\n\nFor local setup:\n```bash\nexport CFLAGS=\"-fsanitize=address,fuzzer-no-link\"\nexport CXXFLAGS=\"-fsanitize=address,fuzzer-no-link\"\n```\n\nConfigure ASan behavior:\n```bash\nexport ASAN_OPTIONS=\"allocator_may_return_null=1,detect_leaks=0\"\n```\n\n### LD_PRELOAD Configuration\n\nFor native extension fuzzing:\n```bash\nexport LD_PRELOAD=\"$(python -c 'import atheris; import os; print(os.path.join(os.path.dirname(atheris.__file__), \"asan_with_fuzzer.so\"))')\"\n```\n\n> **See Also:** For detailed sanitizer configuration, common issues, and advanced flags,\n> see the **address-sanitizer** and **undefined-behavior-sanitizer** technique skills.\n\n### Common Sanitizer Issues\n\n| Issue | Solution |\n|-------|----------|\n| `LD_PRELOAD` not set | Export `LD_PRELOAD` to point to `asan_with_fuzzer.so` |\n| Memory allocation failures | Set `ASAN_OPTIONS=allocator_may_return_null=1` |\n| Leak detection noise | Set `ASAN_OPTIONS=detect_leaks=0` |\n| Missing symbolizer | Set `ASAN_SYMBOLIZER_PATH` to `llvm-symbolizer` |\n\n## Advanced Usage\n\n### Tips and Tricks\n\n| Tip | Why It Helps |\n|-----|--------------|\n| Use `atheris.instrument_imports()` early | Ensures all imports are instrumented for coverage |\n| Start with small `max_len` | Faster initial fuzzing, gradually increase |\n| Use dictionaries for structured formats | Helps fuzzer understand format tokens |\n| Run multiple parallel instances | Better coverage exploration |\n\n### Custom Instrumentation\n\nFine-tune what gets instrumented:\n```python\nimport atheris\n\n# Instrument only specific modules\nwith atheris.instrument_imports():\n    import target_module\n# Don't instrument test harness code\n\ndef test_one_input(data: bytes):\n    target_module.parse(data)\n```\n\n### Performance Tuning\n\n| Setting | Impact |\n|---------|--------|\n| `-max_len=N` | Smaller values = faster execution |\n| `-workers=N -jobs=N` | Parallel fuzzing for faster coverage |\n| `ASAN_OPTIONS=fast_unwind_on_malloc=0` | Better stack traces, slower execution |\n\n### UndefinedBehaviorSanitizer (UBSan)\n\nAdd UBSan to catch additional bugs:\n```bash\nexport CFLAGS=\"-fsanitize=address,undefined,fuzzer-no-link\"\nexport CXXFLAGS=\"-fsanitize=address,undefined,fuzzer-no-link\"\n```\n\nNote: Modify flags in Dockerfile if using containerized setup.\n\n## Real-World Examples\n\n### Example: Pure Python Parser\n\n```python\nimport sys\nimport atheris\nimport json\n\n@atheris.instrument_func\ndef test_one_input(data: bytes):\n    try:\n        # Fuzz Python's JSON parser\n        json.loads(data.decode('utf-8', errors='ignore'))\n    except (ValueError, UnicodeDecodeError):\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Example: HTTP Request Parsing\n\n```python\nimport sys\nimport atheris\n\nwith atheris.instrument_imports():\n    from urllib3 import HTTPResponse\n    from io import BytesIO\n\ndef test_one_input(data: bytes):\n    try:\n        # Fuzz HTTP response parsing\n        fake_response = HTTPResponse(\n            body=BytesIO(data),\n            headers={},\n            preload_content=False\n        )\n        fake_response.read()\n    except Exception:\n        pass\n\ndef main():\n    atheris.Setup(sys.argv, test_one_input)\n    atheris.Fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| No coverage increase | Poor seed corpus or target not instrumented | Add better seeds, verify `instrument_imports()` |\n| Slow execution | ASan overhead or large inputs | Reduce `max_len`, use `ASAN_OPTIONS=fast_unwind_on_malloc=1` |\n| Import errors | Modules imported before instrumentation | Move imports inside `instrument_imports()` context |\n| Segfault without ASan output | Missing `LD_PRELOAD` | Set `LD_PRELOAD` to `asan_with_fuzzer.so` path |\n| Build failures | Wrong compiler or missing flags | Verify `CC`, `CFLAGS`, and clang version |\n\n## Related Skills\n\n### Technique Skills\n\n| Skill | Use Case |\n|-------|----------|\n| **fuzz-harness-writing** | Detailed guidance on writing effective harnesses |\n| **address-sanitizer** | Memory error detection during fuzzing |\n| **undefined-behavior-sanitizer** | Catching undefined behavior in C extensions |\n| **coverage-analysis** | Measuring and improving code coverage |\n| **fuzzing-corpus** | Building and managing seed corpora |\n\n### Related Fuzzers\n\n| Skill | When to Consider |\n|-------|------------------|\n| **hypothesis** | Property-based testing with type-aware generation |\n| **python-afl** | AFL-style fuzzing for Python when Atheris isn't available |\n\n## Resources\n\n### Key External Resources\n\n**[Atheris GitHub Repository](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris)**\nOfficial repository with installation instructions, examples, and documentation for fuzzing both pure Python and native extensions.\n\n**[Native Extension Fuzzing Guide](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fatheris\u002Fblob\u002Fmaster\u002Fnative_extension_fuzzing.md)**\nComprehensive guide covering compilation flags, LD_PRELOAD setup, sanitizer configuration, and troubleshooting for Python C extensions.\n\n**[Continuously Fuzzing Python C Extensions](https:\u002F\u002Fblog.trailofbits.com\u002F2024\u002F02\u002F23\u002Fcontinuously-fuzzing-python-c-extensions\u002F)**\nTrail of Bits blog post covering CI\u002FCD integration, ClusterFuzzLite setup, and real-world examples of fuzzing Python C extensions in continuous integration pipelines.\n\n**[ClusterFuzzLite Python Integration](https:\u002F\u002Fgoogle.github.io\u002Fclusterfuzzlite\u002Fbuild-integration\u002Fpython-lang\u002F)**\nGuide for integrating Atheris fuzzing into CI\u002FCD pipelines using ClusterFuzzLite for automated continuous fuzzing.\n\n### Video Resources\n\nVideos and tutorials are available in the main Atheris documentation and libFuzzer resources.\n",{"name":5,"type":23,"description":7},"fuzzer","main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fatheris",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add agisota\u002Fold-one --skill atheris",{"tool":39,"command":40},"bunx","bunx skills add agisota\u002Fold-one --skill atheris",{"tool":42,"command":43},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill atheris","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fatheris\u002FSKILL.md",true,[],[48,55,62,71,78,85],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":66,"licenseFileUrl":67,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]