Community编程与开发github.com

trailofbits/fuzzing-obstacles

用于修补代码以克服模糊测试障碍的技术。当校验和、全局状态或其他屏障阻碍模糊器进度时使用。

fuzzing-obstacles 是什么?

该技能提供了一系列代码修补技术,旨在帮助开发者和安全研究人员克服模糊测试(fuzzing)过程中遇到的常见障碍。它专注于解决校验和验证、全局状态依赖、复杂的条件检查等问题,这些问题常常会阻止模糊器(如 AFL、LibFuzzer 等)有效探索代码路径。通过运用所描述的策略,用户能够系统地修改目标代码,从而绕过这些障碍,使模糊器能够发现更深层次的漏洞。该技能适用于任何基于覆盖率引导的模糊测试平台。其方法基于实际经验,从简单的校验和绕过到高级的状态重置技巧,涵盖了多种场景。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/trailofbits/skills/tree/main/skills/fuzzing-obstacles

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

fuzzing-obstacles 是做什么的?

用于修补代码以克服模糊测试障碍的技术。当校验和、全局状态或其他屏障阻碍模糊器进度时使用。

概述

模糊测试是一种强大的自动化测试技术,但当目标代码包含校验和、全局状态依赖或复杂的条件检查时,模糊器可能无法有效探索代码路径。该技能提供了一系列经过验证的修补策略,帮助绕过这些障碍,使模糊器能够发现更深层次的漏洞。

支持的平台

该技能适用于任何基于覆盖率引导的模糊测试平台,包括但不限于:

  • AFL/AFL++
  • LibFuzzer
  • Honggfuzz
  • ClusterFuzz

常见障碍及修补技术

校验和(Checksums)

当代码对输入数据进行校验和验证时,模糊器生成的随机输入几乎不可能通过检查。常见的修补方法包括:

  1. 替换校验和检查:将校验和验证函数直接替换为返回成功值(如 0)的桩函数。
  2. 移除校验和:完全删除校验和检查逻辑。
  3. 硬编码跳过:在检测到特定标记时跳过校验和检查。

示例:

// 原始代码
if (checksum(data) != expected) {
    return ERROR;
}

// 修补后代码
if (0) {  // 始终跳过
    return ERROR;
}

全局状态(Global State)

全局状态(如计数器、标志变量)可能导致模糊器在不同测试间无法保持一致性。修补方法包括:

  1. 重置状态:在每次模糊测试输入前重置相关全局变量。
  2. 移除状态依赖:将全局状态转换为局部变量或完全移除。
  3. 使用原子操作:确保状态更新是线程安全的。

示例:

// 修补后代码
void reset_global_state() {
    global_counter = 0;
    initialized = true;
}

复杂条件检查

当存在深度嵌套的条件或基于魔数(magic numbers)的检查时,模糊器可能难以满足所有条件。修补方法包括:

  1. 简化条件:将多个条件合并或移除不必要的检查。
  2. 使用模糊器友好变量:将魔数替换为可配置的宏或变量。
  3. 引入暴力搜索:对于少量魔数,使用暴力搜索辅助模糊器。

实用建议

  • 始终保留原始代码的备份。
  • 使用预处理器宏(#ifdef FUZZING)来有条件地启用修补代码,便于维护。
  • 在修补后运行现有测试套件,确保未引入功能性回归。
  • 对于复杂障碍,考虑使用 ASAN(AddressSanitizer)等工具辅助调试。

结论

通过应用这些修补技术,您可以显著提高模糊测试的效果和覆盖范围,帮助发现那些隐藏在不同障碍背后的漏洞。记住,关键在于识别瓶颈并选择合适的绕过策略。


该技能基于实际模糊测试经验编写,持续更新中。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

trailofbits/address-sanitizer

AddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.

trailofbits/aflpp

AFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.

trailofbits/agentic-actions-auditor

Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI Inference. Detects attack vectors where attacker-controlled input reaches AI agents running in CI/CD pipelines, including env var intermediary patterns, direct expression injection, dangerous sandbox configurations, and wildcard user allowlists. Use when reviewing workflow files that invoke AI coding agents, auditing CI/CD pipeline security for prompt injection risks, or evaluating agentic action configurations.

trailofbits/algorand-vulnerability-scanner

Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access control issues. Use when auditing Algorand projects (TEAL/PyTeal).

trailofbits/ask-questions-if-underspecified

Clarify requirements before implementing. Use when serious doubts arise.

trailofbits/atheris

Atheris is a coverage-guided Python fuzzer based on libFuzzer. Use for fuzzing pure Python code and Python C extensions.

trailofbits/audit-augmentation

Augments Trailmark code graphs with external audit findings from SARIF static analysis results and weAudit annotation files. Maps findings to graph nodes by file and line overlap, creates severity-based subgraphs, and enables cross-referencing findings with pre-analysis data (blast radius, taint, etc.). Use when projecting SARIF results onto a code graph, overlaying weAudit annotations, cross-referencing Semgrep or CodeQL findings with call graph data, or visualizing audit findings in the context of code structure.

trailofbits/audit-context-building

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

trailofbits/audit-prep-assistant

Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes dead code, ensures accessibility, and generates documentation (flowcharts, user stories, inline comments).

trailofbits/burpsuite-project-parser

Searches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting security audit findings, dumping proxy history or site map data, or analyzing HTTP traffic captured in a Burp project.

trailofbits/cairo-vulnerability-scanner

Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects.

trailofbits/cargo-fuzz

cargo-fuzz is the de facto fuzzing tool for Rust projects using Cargo. Use for fuzzing Rust code with libFuzzer backend.

trailofbits/chrome-mcp-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/claude-in-chrome-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/code-improver

Runs an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using a reviewer the user names: any installed skill or agent. Keeps a cross-round findings ledger, escalates when fixes stop converging, and guards scope mechanically. Use when asked to 'improve this code until review passes', 'run an improvement loop with <reviewer>', or to iterate review-and-fix with a specific reviewer. For skills prefer the skill-improver entry; for a branch prefer pr-improver.

trailofbits/code-maturity-assessor

Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls, complexity, decentralization, documentation, MEV risks, low-level code, and testing. Produces professional scorecard with evidence-based ratings and actionable recommendations.

trailofbits/codeql

Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "codeql analysis", "build codeql database", or "find vulnerabilities with codeql". Supports "run all" (security-and-quality + security-experimental suites) and "important only" (high-precision security findings) scan modes. Also handles creating data extension models and processing CodeQL SARIF output.

trailofbits/constant-time-analysis

Detects timing side-channel vulnerabilities in cryptographic code. Use when implementing or reviewing crypto code, encountering division on secrets, secret-dependent branches, or constant-time programming questions in C, C++, Go, Rust, Swift, Java, Kotlin, C#, PHP, JavaScript, TypeScript, Python, or Ruby.

trailofbits/constant-time-testing

Constant-time testing detects timing side channels in cryptographic code. Use when auditing crypto implementations for timing vulnerabilities.

trailofbits/cosmos-vulnerability-scanner

Scans Cosmos SDK blockchain modules and CosmWasm contracts for consensus-critical vulnerabilities — chain halts, fund loss, state divergence. 25 core + 16 IBC + 10 EVM + 3 CosmWasm patterns. Use when auditing custom x/ modules, reviewing IBC integrations, or assessing pre-launch chain security. Updated for SDK v0.53.x.

相关技能