variant-analysis

Solid

Find similar vulnerabilities across a codebase after discovering one instance. Uses pattern matching, AST search, Semgrep/CodeQL queries, and manual tracing to propagate findings. Adapted from Trail of Bits. Use after finding a bug to check if the same pattern exists elsewhere.

AI & Automation 501 stars 42 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 91/100

Stars 20%
90
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Variant Analysis When you find a bug, the same mistake almost certainly exists elsewhere. Variant analysis systematically hunts for siblings of a known vulnerability. ## Process ### Step 1: Characterize the Original Bug Before searching, understand what makes this bug a bug: ``` ORIGINAL BUG: File: src/api/users.ts:42 Type: Missing input validation Pattern: req.params.id used directly in DB query without sanitization Root cause: Developer assumed framework sanitizes params Trigger: Untrusted input reaches database query ``` Extract the **abstract pattern** -- not the specific code, but the class of mistake: - Missing validation at a trust boundary - Incorrect error handling in auth path - Race condition between check and use - Hardcoded secret in source - SQL injection via string concatenation ### Step 2: Generate Search Queries For each bug class, create multiple search strategies: #### Grep/Ripgrep (Fast, broad) ```bash # Example: SQL injection via concatenation rg "query\(.*\+.*\)" --type ts rg "execute\(.*\$\{" --type ts rg "\.raw\(.*\+" --type ts # Example: Missing auth middleware rg "router\.(get|post|put|delete)\(" --type ts -l | \ xargs rg -L "authenticate|authorize|requireAuth" # Example: Hardcoded secrets rg "(password|secret|key|token)\s*[=:]\s*['\"][^'\"]{8,}" --type ts ``` #### Semgrep (AST-aware, precise) ```yaml # Example: SQL injection rules: - id: sql-injection-concatenation patterns: - pattern: $DB.query($X + ...) ...

Details

Author
vibeeval
Repository
vibeeval/vibecosystem
Created
3 months ago
Last Updated
2 days ago
Language
C#
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category