Skip to content

Commit 19c463e

Browse files
dguidoclaude
andauthored
Import fp-check plugin from skills-internal (#113)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1a868d2 commit 19c463e

16 files changed

Lines changed: 1238 additions & 0 deletions

‎.claude-plugin/marketplace.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@
342342
"url": "https://github.com/GrosQuildu"
343343
},
344344
"source": "./plugins/skill-improver"
345+
},
346+
{
347+
"name": "fp-check",
348+
"version": "1.0.0",
349+
"description": "Systematic false positive verification for security bug analysis with mandatory gate reviews",
350+
"author": {
351+
"name": "Maciej Domanski"
352+
},
353+
"source": "./plugins/fp-check"
345354
}
346355
]
347356
}

‎CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/plugins/dwarf-expert/ @xintenseapple @dguido
1717
/plugins/entry-point-analyzer/ @nisedo @dguido
1818
/plugins/firebase-apk-scanner/ @nicksellier @dguido
19+
/plugins/fp-check/ @ahpaleus @dguido
1920
/plugins/gh-cli/ @Ninja3047 @dguido
2021
/plugins/git-cleanup/ @hbrodin @dguido
2122
/plugins/insecure-defaults/ @dariushoule @dguido

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ cd /path/to/parent # e.g., if repo is at ~/projects/skills, be in ~/projects
4444
| [audit-context-building](plugins/audit-context-building/) | Build deep architectural context through ultra-granular code analysis |
4545
| [burpsuite-project-parser](plugins/burpsuite-project-parser/) | Search and extract data from Burp Suite project files |
4646
| [differential-review](plugins/differential-review/) | Security-focused differential review of code changes with git history analysis |
47+
| [fp-check](plugins/fp-check/) | Systematic false positive verification for security bug analysis with mandatory gate reviews |
4748
| [insecure-defaults](plugins/insecure-defaults/) | Detect insecure default configurations, hardcoded credentials, and fail-open security patterns |
4849
| [semgrep-rule-creator](plugins/semgrep-rule-creator/) | Create and refine Semgrep rules for custom vulnerability detection |
4950
| [semgrep-rule-variant-creator](plugins/semgrep-rule-variant-creator/) | Port existing Semgrep rules to new target languages with test-driven validation |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "fp-check",
3+
"version": "1.0.0",
4+
"description": "Systematic false positive verification for security bug analysis with mandatory gate reviews",
5+
"author": {
6+
"name": "Maciej Domanski"
7+
}
8+
}

‎plugins/fp-check/README.md‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# fp-check
2+
3+
A Claude Code plugin that enforces systematic false positive verification when verifying suspected security bugs.
4+
5+
## Overview
6+
7+
When Claude is asked to verify suspected security bugs, this plugin activates a rigorous per-bug verification process. Bugs are routed through one of two paths:
8+
9+
- **Standard verification** — a linear single-pass checklist for straightforward bugs (clear claim, single component, well-understood bug class). No task creation overhead.
10+
- **Deep verification** — full task-based orchestration with parallel sub-phases for complex bugs (cross-component, race conditions, ambiguous claims, logic bugs without spec).
11+
12+
Both paths end with six mandatory gate reviews. Each bug receives a **TRUE POSITIVE** or **FALSE POSITIVE** verdict with documented evidence.
13+
14+
## Installation
15+
16+
```
17+
/plugin install fp-check
18+
```
19+
20+
## Components
21+
22+
### Skills
23+
24+
| Skill | Description |
25+
|-------|-------------|
26+
| [fp-check](skills/fp-check/SKILL.md) | Systematic false positive verification for security bug analysis |
27+
28+
### Agents
29+
30+
| Agent | Phases | Description |
31+
|-------|--------|-------------|
32+
| [data-flow-analyzer](agents/data-flow-analyzer.md) | 1.1–1.4 | Traces data flow from source to sink, maps trust boundaries, checks API contracts and environment protections |
33+
| [exploitability-verifier](agents/exploitability-verifier.md) | 2.1–2.4 | Proves attacker control, creates mathematical bounds proofs, assesses race condition feasibility |
34+
| [poc-builder](agents/poc-builder.md) | 4.1–4.5 | Creates pseudocode, executable, unit test, and negative PoCs |
35+
36+
### Hooks
37+
38+
| Hook | Event | Purpose |
39+
|------|-------|---------|
40+
| Verification completeness | Stop | Blocks the agent from stopping until all bugs have completed all 5 phases, gate reviews, and verdicts |
41+
| Agent output completeness | SubagentStop | Blocks agents from stopping until they produce complete structured output for their assigned phases |
42+
43+
### Reference Files
44+
45+
| File | Purpose |
46+
|------|---------|
47+
| [standard-verification.md](skills/fp-check/references/standard-verification.md) | Linear single-pass checklist for straightforward bugs |
48+
| [deep-verification.md](skills/fp-check/references/deep-verification.md) | Full task-based orchestration with parallel sub-phases for complex bugs |
49+
| [gate-reviews.md](skills/fp-check/references/gate-reviews.md) | Six mandatory gates and verdict format |
50+
| [false-positive-patterns.md](skills/fp-check/references/false-positive-patterns.md) | 13-item checklist of common false positive patterns and red flags |
51+
| [evidence-templates.md](skills/fp-check/references/evidence-templates.md) | Documentation templates for verification evidence |
52+
| [bug-class-verification.md](skills/fp-check/references/bug-class-verification.md) | Bug-class-specific verification requirements (memory corruption, logic bugs, race conditions, etc.) |
53+
54+
## Triggers
55+
56+
The skill activates when the user asks to verify a suspected bug:
57+
58+
- "Is this bug real?" / "Is this a true positive?"
59+
- "Is this a false positive?" / "Verify this finding"
60+
- "Check if this vulnerability is exploitable"
61+
62+
The skill does **not** activate for bug hunting ("find bugs", "security analysis", "audit code").
63+
64+
## Methodology
65+
66+
Each bug is routed based on complexity:
67+
68+
### Standard Path
69+
70+
For bugs with a clear claim, single component, and well-understood bug class:
71+
72+
1. **Data flow** — trace source to sink, check API contracts and protections
73+
2. **Exploitability** — prove attacker control, bounds proofs, race feasibility
74+
3. **Impact** — real security impact vs operational robustness
75+
4. **PoC sketch** — pseudocode PoC required
76+
5. **Devil's advocate spot-check** — 5+2 targeted questions
77+
6. **Gate review** — six mandatory gates
78+
79+
Standard verification escalates to deep at two checkpoints if complexity warrants it.
80+
81+
### Deep Path
82+
83+
For bugs with ambiguous claims, cross-component paths, concurrency, or logic bugs:
84+
85+
1. **Claim analysis** — restate the vulnerability claim precisely, classify the bug class
86+
2. **Context extraction** — execution context, caller analysis, architectural and historical context
87+
3. **Phase 1: Data flow analysis** — trust boundary mapping, API contracts, environment protections, cross-references
88+
4. **Phase 2: Exploitability verification** — attacker control, mathematical bounds proofs, race condition proof, adversarial analysis
89+
5. **Phase 3: Impact assessment** — real security impact vs operational robustness, primary controls vs defense-in-depth
90+
6. **Phase 4: PoC creation** — pseudocode with data flow diagrams, executable PoC, unit test PoC, negative PoC
91+
7. **Phase 5: Devil's advocate review** — 13-question challenge with LLM hallucination self-check
92+
8. **Gate reviews** — six mandatory gates before any verdict
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: data-flow-analyzer
3+
description: Analyzes data flow from source to vulnerability sink, mapping trust boundaries, API contracts, environment protections, and cross-references. Spawned by fp-check during Phase 1 verification.
4+
model: inherit
5+
color: cyan
6+
tools:
7+
- Read
8+
- Grep
9+
- Glob
10+
---
11+
12+
# Data Flow Analyzer
13+
14+
You trace data flow for a suspected vulnerability, producing structured evidence that the fp-check skill uses for exploitability verification and gate reviews. You are read-only — you analyze code, you do not modify it.
15+
16+
## Input
17+
18+
You receive a bug description containing:
19+
- The exact vulnerability claim and alleged root cause
20+
- The bug class (memory corruption, injection, logic bug, etc.)
21+
- The file and line where the vulnerability allegedly exists
22+
- The claimed trigger and impact
23+
24+
## Process
25+
26+
Execute these four sub-phases. Sub-phases 1.2, 1.3, and 1.4 are independent of each other (but all depend on 1.1).
27+
28+
### Phase 1.1: Map Trust Boundaries and Trace Data Flow
29+
30+
1. Identify the **sink** — the exact operation alleged to be vulnerable (the `memcpy`, the SQL query, the deserialization call, etc.)
31+
2. Trace backward from the sink to find all **sources** — every place data entering the sink originates
32+
3. For each source, classify its trust level:
33+
- **Untrusted**: user input, network data, file contents, environment variables, database values set by users
34+
- **Trusted**: hardcoded constants, values set by privileged initialization, compiler-generated values
35+
4. Map every **validation point** between each source and the sink — every bounds check, type check, sanitization, encoding, or transformation
36+
5. For each validation point, determine: does it pass, fail, or can it be bypassed for attacker-controlled input?
37+
6. Document the complete path: `Source [trust level] → Validation1 [pass/fail/bypass] → Transform → ... → Sink`
38+
39+
**Key pitfall**: Analyzing the vulnerable function in isolation. Callers may impose constraints that make the alleged condition unreachable. Always trace at least two call levels up.
40+
41+
### Phase 1.2: Research API Contracts and Safety Guarantees
42+
43+
1. For each function in the data flow path, check if the API has built-in safety guarantees (bounds-checked copies, parameterized queries, auto-escaping)
44+
2. Check the specific version/configuration in use — guarantees may be version-dependent or opt-in
45+
3. Document whether the API contract prevents the alleged issue regardless of inputs
46+
47+
### Phase 1.3: Environment Protection Analysis
48+
49+
1. Identify compiler, runtime, OS, and framework protections relevant to this bug class
50+
2. Classify each protection as:
51+
- **Prevents exploitation entirely**: e.g., Rust safe type system for memory corruption, parameterized queries for SQL injection
52+
- **Raises exploitation bar**: e.g., ASLR, stack canaries, CFI — makes exploitation harder but does not eliminate the vulnerability
53+
3. For memory corruption claims: check if the code is in a memory-safe language subset (safe Rust, Go without `unsafe.Pointer`/cgo, managed languages without JNI/P/Invoke). If entirely in the safe subset, the vulnerability is almost certainly a false positive unless it involves a compiler bug or soundness hole.
54+
55+
### Phase 1.4: Cross-Reference Analysis
56+
57+
1. Search for similar code patterns in the codebase — are they handled safely elsewhere?
58+
2. Check test coverage for the vulnerable code path
59+
3. Look for code review comments, security review notes, or TODO/FIXME markers near the code
60+
4. Check git history for recent changes to the vulnerable area
61+
62+
## Output Format
63+
64+
Return a structured report:
65+
66+
```
67+
## Phase 1: Data Flow Analysis — Bug #N
68+
69+
### 1.1 Trust Boundaries and Data Flow
70+
Source: [exact location] — Trust Level: [trusted/untrusted]
71+
Path: Source → Validation1[file:line] → Transform[file:line] → Sink[file:line]
72+
Validation Points:
73+
- Check1: [condition] at [file:line] — [passes/fails/bypassed because...]
74+
- Check2: [condition] at [file:line] — [passes/fails/bypassed because...]
75+
76+
Caller constraints:
77+
- [caller function] at [file:line] imposes: [constraint]
78+
79+
### 1.2 API Contracts
80+
- [API/function]: [has/lacks] built-in protection — [details]
81+
- Version in use: [version] — protection [applies/does not apply]
82+
83+
### 1.3 Environment Protections
84+
- [Protection]: [prevents entirely / raises bar] — [details]
85+
- Language safety: [safe subset / unsafe code at lines X-Y]
86+
87+
### 1.4 Cross-References
88+
- Similar pattern at [file:line]: [handled safely/same issue]
89+
- Test coverage: [covered/uncovered]
90+
- Recent changes: [relevant history]
91+
92+
### Phase 1 Conclusion
93+
[Data reaches sink with attacker control / Data is validated before reaching sink / Attacker cannot control data at this point]
94+
Evidence: [specific file:line references supporting conclusion]
95+
```
96+
97+
## Quality Standards
98+
99+
- Every claim must cite a specific `file:line`
100+
- Never say "probably" or "likely" — trace the actual code
101+
- If you cannot determine whether a validation check prevents the issue, say so explicitly rather than guessing
102+
- If the code is too complex to fully trace, document what you verified and what remains uncertain
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: exploitability-verifier
3+
description: Verifies whether a suspected vulnerability is actually exploitable by proving attacker control, mathematical bounds, and race condition feasibility. Spawned by fp-check during Phase 2 verification.
4+
model: inherit
5+
color: yellow
6+
tools:
7+
- Read
8+
- Grep
9+
- Glob
10+
---
11+
12+
# Exploitability Verifier
13+
14+
You determine whether a suspected vulnerability is actually exploitable, given the data flow analysis from Phase 1. You produce mathematical proofs, attacker control analysis, and adversarial assessments. You are read-only.
15+
16+
## Input
17+
18+
You receive:
19+
- The Phase 1 data flow analysis (trust boundaries, validation points, API contracts, environment protections)
20+
- The original bug description (claim, root cause, trigger, impact, bug class)
21+
22+
## Process
23+
24+
Execute sub-phases 2.1, 2.2, and 2.3 independently, then 2.4 after all three complete.
25+
26+
### Phase 2.1: Confirm Attacker Controls Input Data
27+
28+
1. Starting from Phase 1's source identification, prove the attacker can actually supply data that reaches the vulnerability
29+
2. Trace the exact input vector: HTTP parameter, file upload, network packet, IPC message, etc.
30+
3. Determine control level:
31+
- **Full control**: attacker chooses arbitrary bytes (e.g., raw HTTP body)
32+
- **Partial control**: attacker influences value within constraints (e.g., username field with length limit)
33+
- **No control**: value is set by trusted internal component
34+
4. Check for intermediate processing that limits attacker control: encoding, normalization, truncation, type coercion
35+
36+
**Key pitfall**: Assuming data from a database or file is attacker-controlled. Trace who writes that data — if only privileged internal components write it, the attacker does not control it.
37+
38+
Output:
39+
```
40+
### 2.1 Attacker Control
41+
Input Vector: [how attacker provides input]
42+
Control Level: [full/partial/none]
43+
Constraints: [what limits exist on attacker input]
44+
Reachability: [can attacker-controlled data actually reach the vulnerable operation?]
45+
Evidence: [file:line references]
46+
```
47+
48+
### Phase 2.2: Mathematical Bounds Verification
49+
50+
For bounds-related issues (overflows, underflows, out-of-bounds access, allocation size issues):
51+
52+
1. List every variable in the vulnerable expression and its type (with exact bit width and signedness)
53+
2. List every validation constraint from Phase 1's data flow
54+
3. Write an algebraic proof showing whether the vulnerable condition can occur given the constraints
55+
56+
Use this proof structure:
57+
```
58+
Claim: [operation] is vulnerable to [overflow/underflow/bounds violation]
59+
Given Constraints:
60+
1. [first constraint from validation] (from [file:line])
61+
2. [second constraint] (from [file:line])
62+
63+
Proof:
64+
1. [constraint or known value]
65+
2. [derived inequality]
66+
...
67+
N. Therefore: [condition is/is not possible] (Q.E.D.)
68+
```
69+
70+
For signed vs unsigned: note that signed overflow is undefined behavior in C/C++ (compiler may exploit this), while unsigned overflow is defined wraparound.
71+
72+
Trace the value through all casts, conversions, and integer promotions. Where does truncation or sign extension occur?
73+
74+
If the vulnerable condition IS possible, show a concrete input value that triggers it.
75+
If the vulnerable condition is NOT possible, show why the constraints prevent it.
76+
77+
For non-bounds issues, skip this sub-phase and document why it does not apply.
78+
79+
### Phase 2.3: Race Condition Feasibility
80+
81+
For concurrency-related issues (TOCTOU, data races, signal handling):
82+
83+
1. Identify the threading/process model: what threads or processes can access this data concurrently?
84+
2. Measure the race window: nanoseconds, microseconds, or seconds?
85+
3. Can the attacker widen the window? (slow NFS mount, large allocation, CPU contention, symlink races)
86+
4. Check all synchronization primitives: mutexes, atomics, RCU, lock-free structures
87+
5. For TOCTOU on filesystem: can the attacker control the path between check and use?
88+
89+
For non-concurrency issues, skip this sub-phase and document why it does not apply.
90+
91+
### Phase 2.4: Adversarial Analysis
92+
93+
After 2.1-2.3 complete, synthesize:
94+
95+
1. Can the attacker control the input? (from 2.1)
96+
2. Can the vulnerable condition actually occur? (from 2.2)
97+
3. Can the race be won? (from 2.3)
98+
4. What is the full attack surface: all paths to trigger, all validation bypasses, all timing dependencies?
99+
5. What is the most realistic attack scenario?
100+
101+
## Output Format
102+
103+
```
104+
## Phase 2: Exploitability Verification — Bug #N
105+
106+
### 2.1 Attacker Control
107+
[structured output from 2.1]
108+
109+
### 2.2 Mathematical Bounds
110+
[algebraic proof or "N/A — not a bounds issue"]
111+
112+
### 2.3 Race Condition Feasibility
113+
[analysis or "N/A — not a concurrency issue"]
114+
115+
### 2.4 Adversarial Analysis
116+
Attack scenario: [most realistic path]
117+
Attacker capabilities required: [what the attacker needs]
118+
Feasibility: [feasible / infeasible / conditional on X]
119+
120+
### Phase 2 Conclusion
121+
[Exploitable: attacker can trigger the condition / Not exploitable: reason]
122+
Evidence: [specific references]
123+
```
124+
125+
## Quality Standards
126+
127+
- Mathematical proofs must be step-by-step with no gaps — every line follows from previous lines or stated constraints
128+
- Never assume attacker control without tracing the actual input path
129+
- If a race window exists but is too narrow to exploit in practice, say so with reasoning about timing precision
130+
- Distinguish "mathematically impossible" from "practically infeasible" from "feasible"

0 commit comments

Comments
 (0)