variant-analysis

Locate vulnerability variants across a codebase using ripgrep, Semgrep, and CodeQL.

6.5k|561|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/trailofbits/skills --skill variant-analysis-trailofbits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: variant-analysis
Source: https://github.com/trailofbits/skills/tree/main/plugins/variant-analysis/skills/variant-analysis
Command: npx skills add https://github.com/trailofbits/skills --skill variant-analysis-trailofbits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps security teams locate vulnerability variants by generalizing from a known issue to find similar patterns across large codebases.

Core Features & Use Cases

  • Exact-match patterning to capture the original bug instance for reproducibility.
  • Iterative generalization to uncover copy-paste bugs and related manifestations across modules.
  • Query generation support for CodeQL and Semgrep to automate variant detection and triage.

Quick Start

Describe the original vulnerability and ask for a complete variant analysis across the codebase.

Frequently Asked Questions about variant-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find vulnerability variants across multiple codebases after finding a security bug?

To find vulnerability variants, describe the original issue and the skill applies iterative generalization across the codebase. It uses ripgrep, Semgrep, and CodeQL to discover similar security patterns and copy-paste bugs across different languages and file types.

Can I generate CodeQL and Semgrep queries from a known security pattern?

Yes, you can generate CodeQL and Semgrep queries from a known security pattern. The skill supports query generation to automate variant detection and triage, expanding from exact matches to broader semantic patterns across your repository.

What is the best way to locate copy-paste bugs across different programming languages in a repository?

The best way to locate copy-paste bugs is using iterative pattern generalization across the repository. The skill applies exact-match patterning and semantic search using ripgrep, Semgrep, and CodeQL to uncover related manifestations across multiple languages and file types.

Does variant analysis work with ripgrep for code search across large projects?

Yes, variant analysis works with ripgrep for code search across large projects. It uses ripgrep alongside Semgrep and CodeQL to apply iterative generalization, searching the entire repository to discover similar security issues across teams and modules.

How do I triage security issues found during a codebase variant analysis?

To triage security issues found during variant analysis, the skill applies query generation support for CodeQL and Semgrep. This automates the detection and triage of vulnerability variants, providing reporting on similar issues located across the codebase.

When should I use iterative generalization instead of exact-match patterning for vulnerability detection?

Use iterative generalization after capturing the original bug instance with exact-match patterning for reproducibility. Generalization then expands the search to uncover broader semantic vulnerability variants and related manifestations across the codebase.