variant-analysis
Skill2 starsChanged 3 months agoMITView on GitHub
KAVACH companion skill finding every sibling of a vulnerability already found - the same root cause manifesting elsewhere in the codebase - via an abstraction-ladder pattern methodology (exact match to semantic taint pattern) and per-language CodeQL/Semgrep taint skeletons. Post-finding expansion usable by every domain agent (kavach-sast, kavach-api, kavach-llm, kavach-billing, kavach-crypto, kavach-supply, kavach-config, kavach-logic). Use after any domain agent confirms or suspects a finding, before writing it up, to check whether the same mistake repeats elsewhere in the surface. Not for initial vulnerability discovery.
8 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- BrentRector/claude-skillstheir own version, first seen Oct 3, 2026
- lecluse-net/galaristheir own version, first seen Sep 27, 2026
- mtarcure/claude-vibe-squadtheir own version, first seen Sep 19, 2026
- waybarrios/opencode-power-packedited, first seen Aug 17, 2026
- annatchijova/SKILLStheir own version, first seen Jul 8, 2026
- romaintoso78/claude-skillsedited, first seen Jun 25, 2026
Used with
Projects with it also use insecure-defaults.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
the-huginSkillinsecure-defaults
Detects fail-open vulnerabilities where applications run insecurely with missing configuration. Finds hardcoded credentials, weak env var fallbacks, and insecure-by-default settings. Adapted from Trail of Bits methodology.
Also in 3 projects that use this
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- waybarrios/opencode-power-pack★ 53175% same
- romaintoso78/claude-skills★ 176% same
Wrote their own version · 6
- mtarcure/claude-vibe-squad★ 162same name
- 0x-Shashi/WEB3-AUDIT-SKILLS★ 61same name
- cropsgg/skills★ 15same name
- annatchijova/SKILLS★ 8same name
- BrentRector/claude-skills★ 4same name
- lecluse-net/galaris★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- ci-agent-actionsSkill
- codeqlSkill
- kavachSkill
- semgrep-rule-creatorSkill
- spec-complianceSkill
- threat-modelSkill
- zeroize-auditSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 11 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Use this skill when:
- Distinctive: line 28
Do NOT use this skill for:
- Distinctive: line 38
Before searching, deeply understand the known bug:
- Distinctive: line 39
What is the root cause?: Not the symptom, but WHY it's vulnerable
- Distinctive: line 45
Start with a pattern that matches ONLY the known instance:
- Distinctive: line 49
Verify: Does it match exactly ONE location (the original)?
- Distinctive: line 66
If FP rate acceptable, generalize next element
- Distinctive: line 67
If FP rate too high, revert and try different abstraction
- Distinctive: line 101
Search everywhere: Always search the ENTIRE codebase, not just the module where the bug was found
- Very specific: line 103
Never invent a second severity axis: every variant gets severity/cvss_vector/confidence per the shared schema - a variant taxonomy of its …
- Distinctive: line 115
Mitigation: Always run searches against the entire codebase root directory.
- Distinctive: line 142
Mitigation: Test with: unauthenticated users, null/undefined values, empty collections, and boundary conditions.
- Very specific: line 146
Do not write a bespoke report format into .kavach/findings/.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Adapted from piolium (github.com/vigolium/piolium) - MIT License, © j3ssie.
Variant Analysis
You are running variant analysis: given one confirmed or suspected finding, find every other
place the same root cause manifests. This is a post-finding expansion technique, callable by
any KAVACH domain agent (kavach-sast, kavach-api, kavach-llm, kavach-billing,
kavach-crypto, kavach-supply, kavach-config, kavach-logic) once it has one concrete
instance in hand - not a way to discover the first instance of anything.
When to Use
Use this skill when:
- A vulnerability has been found (confirmed or suspected) and you need to search for siblings before finalizing the finding count
- Building or refining a Semgrep/CodeQL pattern to sweep a whole vulnerability class across the repo
- A finding's root cause looks like a developer habit or copy-paste boilerplate, not a one-off
- Hunting for the same logic-bug shape (inverted condition, null-equality bypass, wrong default) elsewhere in authz/business-logic code
When NOT to Use
Do NOT use this skill for:
- Initial vulnerability discovery - that's the domain agent's own checklist (
domains/*.md), not this skill - General code review with no known pattern to search for
- Writing the finding's remediation text - that's
finding-schema.md'sremediationfield - Deep unfamiliar-code comprehension before you have any lead at all
The Five-Step Process
Step 1: Understand the Original Issue
Before searching, deeply understand the known bug:
- What is the root cause? Not the symptom, but WHY it's vulnerable
- What conditions are required? Control flow, data flow, state
- What makes it exploitable? User control, missing validation, etc.
Step 2: Create an Exact Match
Start with a pattern that matches ONLY the known instance:
rg -n "exact_vulnerable_code_here"Verify: Does it match exactly ONE location (the original)?
Step 3: Identify Abstraction Points
| Element | Keep Specific | Can Abstract |
| Function name | If unique to bug | If pattern applies to family |
| Variable names | Never | Always use metavariables |
| Literal values | If value matters | If any value triggers bug |
| Arguments | If position matters | Use ... wildcards |
Step 4: Iteratively Generalize
Change ONE element at a time:
- Run the pattern
- Review ALL new matches
- Classify: true positive or false positive?
- If FP rate acceptable, generalize next element
- If FP rate too high, revert and try different abstraction
Stop when false positive rate exceeds ~50%
Step 5: Analyze and Triage Results
For each match, do not invent a new taxonomy - map straight onto KAVACH's own finding fields
(finding-schema.md, severity-model.md):
- Location:
file:line, function - the same discipline as any other finding'slocations[] - Confidence:
confirmed(you read the line and it reproduces the same flaw) orsuspected(pattern matches but you haven't traced reachability yet) - never a third bucket - Exploitability / severity: score it with the same CVSS vector the original finding got, adjusted for this instance's actual reachability - a variant in dead code is not automatically the same severity as the original
- Priority: based on impact and exploitability, same as any other finding
For deeper strategic guidance, see METHODOLOGY.md.
Tool Selection
| Scenario | Tool | Why |
| Quick surface search | ripgrep | Fast, zero setup |
| Simple pattern matching | Semgrep | Easy syntax, no build needed |
| Data flow tracking | Semgrep taint / CodeQL | Follows values across functions |
| Cross-function analysis | CodeQL (see the codeql skill) | Best interprocedural analysis - reach for it when a variant's taint path crosses files a grep pattern can't span |
| Non-building code | Semgrep | Works on incomplete code |
Key Principles
- Root cause first: Understand WHY before searching for WHERE
- Start specific: First pattern should match exactly the known bug
- One change at a time: Generalize incrementally, verify after each change
- Know when to stop: 50%+ FP rate means you've gone too generic
- Search everywhere: Always search the ENTIRE codebase, not just the module where the bug was found
- Expand vulnerability classes: One root cause often has multiple manifestations
- Never invent a second severity axis: every variant gets
severity/cvss_vector/confidenceper the shared schema - a variant taxonomy of its own (EASY/MED/HARD, tiers, etc.) is not a KAVACH finding field
Critical Pitfalls to Avoid
These common mistakes cause analysts to miss real vulnerabilities:
1. Narrow Search Scope
Searching only the module where the original bug was found misses variants in other locations.
Example: Bug found in api/handlers/ → only searching that directory → missing variant in utils/auth.py
Mitigation: Always run searches against the entire codebase root directory.
2. Pattern Too Specific
Using only the exact attribute/function from the original bug misses variants using related constructs.
Example: Bug uses isAuthenticated check → only searching for that exact term → missing bugs using related properties like isActive, isAdmin, isVerified
Mitigation: Enumerate ALL semantically related attributes/functions for the bug class.
3. Single Vulnerability Class
Focusing on only one manifestation of the root cause misses other ways the same logic error appears.
Example: Original bug is "return allow when condition is false" → only searching that pattern → missing:
- Null equality bypasses (
null == nullevaluates to true) - Documentation/code mismatches (function does opposite of what docs claim)
- Inverted conditional logic (wrong branch taken)
Mitigation: List all possible manifestations of the root cause before searching.
4. Missing Edge Cases
Testing patterns only with "normal" scenarios misses vulnerabilities triggered by edge cases.
Example: Testing auth checks only with valid users → missing bypass when userId = null matches resourceOwnerId = null
Mitigation: Test with: unauthenticated users, null/undefined values, empty collections, and boundary conditions.
Output
Do not write a bespoke report format into .kavach/findings/. Working notes (pattern history, FP
log, tracking table) go to .kavach/tmp/variant-workspace/<original-finding-slug>/ - see
resources/variant-report-template.md for the tracking-doc
shape; treat it as a scratch artifact for your own iteration, not the finding record. Once a
variant is confirmed or suspected, it becomes a normal entry in the calling agent's own
agent-<domain>.json, cross-referencing the original finding's kavach_id in its own reasoning -
one root cause, multiple locations[], or multiple linked findings if severity differs per site;
do not silently fold a lower-severity variant into the original's score.
Resources
Ready-to-use templates in resources/:
CodeQL (resources/codeql/):
python.ql,javascript.ql,java.ql,go.ql,cpp.ql
Semgrep (resources/semgrep/):
python.yaml,javascript.yaml,java.yaml,go.yaml,cpp.yaml
Tracking template: resources/variant-report-template.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

