
Variant Analysis
SkillTrail of Bits 出品,从一个已确认的漏洞出发提炼根因,编写并逐步泛化 CodeQL / Semgrep 查询,在整个代码库里查找同类变体并分级报告。
Variant Analysis
Find similar vulnerabilities and bugs across codebases using pattern-based analysis.
Author: Axel Mierczuk
When to Use
- Hunt for bug variants after finding an initial vulnerability
- Build CodeQL or Semgrep queries from a known bug pattern
- Perform systematic code audits across large codebases
- Create reusable patterns for recurring vulnerability classes
What It Does
A five-step process: extract the root cause, write a pattern matching only the known bug, generalize it one element at a time, triage what it finds, and report.
Each step has its own strategy reference under skills/variant-analysis/references/.
Entry Points
| Use when | |
|---|---|
/variant-analysis:variants | Workflow, for a large codebase or a root cause with many manifestations. Runs the steps across parallel subagents, one per expansion axis (generalizing variable names, function names, sink APIs, …), looping until the sweep stops finding anything new. Takes bug, root, lang, out as a JSON object, which Claude fills from the current context. Below ~40 source files (the primary language's, excluding vendored and fixture trees) it sweeps narrow and once, because fan-out buys nothing at that size. |
The variant-analysis skill | The knowledge behind the workflow, and the path for a narrow hunt you want to drive yourself — a handful of files, pasted snippets, or a candidate list to triage against a known root cause. Both fire on their own from a conversational "are there others like this?"; measured on a real codebase, Claude reaches for the workflow more often than the skill, so ask for the skill by name if you want to weigh in on each generalization. |
Included
- Tool selection guidance (ripgrep, Semgrep, CodeQL)
- Ready-to-use CodeQL and Semgrep templates for Python, JavaScript, Java, Go, and C++
- A report template, and the pitfalls that most often cause hunts to miss variants
Installation
/plugin install trailofbits/skills/plugins/variant-analysis
Related Skills
codeql— deep interprocedural variant analysissemgrep— fast pattern matching for simpler variantssarif-parsing— process variant analysis results
相關資源

Trail of Bits Skills
Skill安全公司 Trail of Bits 出品的技能合集,40 多个插件覆盖代码审计、CodeQL/Semgrep 静态分析、差异评审、智能合约与密码学审计、模糊测试等,也可作为 Claude Code / Codex 插件市场安装。
trailofbits/skills7.6k
Static Analysis
SkillTrail of Bits 出品的静态分析技能组:用 CodeQL 做跨过程污点追踪与数据流分析,用 Semgrep 做规则扫描,并解析、去重 SARIF 结果。需本机安装 CodeQL 或 Semgrep。
trailofbits/skills7.6k
Semgrep
CLI语义化的多语言静态分析工具:用写法接近源码的规则查找漏洞与缺陷,支持 30 多种语言与自定义规则,默认在本地扫描、不上传代码。跨文件分析与 Pro 规则需登录。
semgrep/semgrep17.1k
Trail of Bits Skills
Plugin安全公司 Trail of Bits 的插件市场,收录 40 多个插件,覆盖代码审计、CodeQL / Semgrep 静态分析、变体分析、供应链风险、智能合约安全与逆向分析。Codex 也可以直接加载。
trailofbits/skills7.6k
Supply Chain Risk Auditor
SkillTrail of Bits 出品的技能:审计 npm、PyPI、Go 依赖的供应链风险——直接依赖与整棵锁文件树的已知漏洞公告、已弃用或归档的上游、npm 发布者集中度、安装期脚本执行。需要 uv,建议配置已登录的 gh。
trailofbits/skills7.6k
Semgrep MCP
MCPSemgrep 官方 MCP 服务器,已并入 semgrep 主仓库,通过 semgrep mcp 启动:让 agent 对代码做静态安全扫描、用自定义规则查找问题并查看语法树。需先安装 Semgrep CLI;接入 AppSec 平台需 SEMGREP_APP_TOKEN。
semgrep/semgrep17.1k