Back to Skills

variant-analysis

Find similar vulnerabilities and bugs across codebases using pattern-based analysis. Use when hunting bug variants, building CodeQL/Semgrep queries, analyzing security vulnerabilities, or performing systematic code audits after finding an initial issue.

5,266stars466forksUpdated 5/18/2026

Security Assessment

Medium Risk(50/100)

Detected risks:

Remote Code Execution([METHODOLOGY.md] eval()
Security Score50/100

About variant-analysis

The variant-analysis skill is designed to help security analysts and developers identify similar vulnerabilities and bugs across codebases once an initial issue has been detected. By leveraging pattern-based analysis, this skill enables systematic exploration of code to uncover variants of known bugs, which might manifest in different functions, files, or modules. It addresses the challenge of missed vulnerabilities due to scattered or slightly altered code implementations and reduces the manual effort required to hunt for repetitive or derivative security issues.

Key capabilities of this skill include creating precise initial patterns for known vulnerabilities, identifying points in code that can be safely abstracted, and iteratively generalizing these patterns to find related instances while monitoring false positive rates. It integrates tools such as ripgrep, Semgrep, and CodeQL, enabling fast surface searches, pattern matching, and interprocedural analysis. Additionally, it emphasizes thorough documentation of each match, assessing location, confidence, exploitability, and priority. Core principles include understanding the root cause before searching, starting with exact matches, generalizing one element at a time, and expanding the search across the entire codebase for comprehensive coverage.

This skill is particularly useful for security researchers, penetration testers, and software engineers performing code audits. Typical use cases involve refining or building CodeQL and Semgrep queries, hunting for bug variants, performing systematic vulnerability analysis, and analyzing the propagation of a single root cause across different code paths. It is intended for situations where an initial vulnerability is known, rather than for discovering entirely new issues or conducting general code reviews. Users benefit from structured guidance on iterative pattern generalization and risk-based triage of discovered variants.

FAQ

When should I use the variant-analysis skill?

Use it after identifying a known vulnerability or bug to find similar instances, refine security queries, or perform systematic code audits. It is not meant for initial vulnerability discovery.

Which tools are compatible with this skill?

The skill supports ripgrep for quick searches, Semgrep for simple pattern matching and taint analysis, and CodeQL for cross-function or interprocedural analysis.

Can I use variant-analysis for general code review?

No. It is designed to search for patterns based on a known issue. For general code review or understanding unfamiliar code, other audit skills should be used first.

How do I manage false positives when generalizing patterns?

Change one element at a time, review all matches, and classify them as true or false positives. Stop generalizing when the false positive rate exceeds roughly 50%.

Does this skill require building the code?

Not necessarily. Tools like Semgrep work on non-building or incomplete code, while CodeQL may require build information for advanced cross-function analysis.

All Files

13 files
resources/codeql/go.ql2.0 KB
View
resources/semgrep/cpp.yaml2.7 KB
View
SKILL.md5.5 KB
View
resources/semgrep/java.yaml2.0 KB
View
resources/codeql/javascript.ql1.7 KB
View
resources/codeql/python.ql2.4 KB
View
resources/codeql/cpp.ql3.4 KB
View
resources/semgrep/javascript.yaml1.7 KB
View
METHODOLOGY.md9.4 KB
View
resources/semgrep/go.yaml1.8 KB
View
resources/variant-report-template.md1.3 KB
View
resources/codeql/java.ql2.3 KB
View
resources/semgrep/python.yaml2.0 KB
View

Install variant-analysis

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill