Fp check

From RedHatProductSecurity/prodsec-skills · View interactive version

Fp check is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Systematically verifies suspected security bugs to eliminate false positives. Produces TRUE POSITIVE or FALSE POSITIVE verdicts with documented evidence for each bug.

How to use this skill

Skill file

False Positive Check

When to Use

When NOT to Use

Rationalizations to Reject

If you catch yourself thinking any of these, STOP.

| Rationalization | Why It's Wrong | Required Action |

|---|---|---|

| "Rapid analysis of remaining bugs" | Every bug gets full verification | Return to task list, verify next bug through all phases |

| "This pattern looks dangerous, so it's a vulnerability" | Pattern recognition is not analysis | Complete data flow tracing before any conclusion |

| "Skipping full verification for efficiency" | No partial analysis allowed | Execute all steps per the chosen verification path |

| "The code looks unsafe, reporting without tracing data flow" | Unsafe-looking code may have upstream validation | Trace the complete path from source to sink |

| "Similar code was vulnerable elsewhere" | Each context has different validation, callers, and protections | Verify this specific instance independently |

| "This is clearly critical" | LLMs are biased toward seeing bugs and overrating severity | Complete devil's advocate review; prove it with evidence |


Step 0: Understand the Claim and Context

Before any analysis, restate the bug in your own words. If you cannot do this clearly, ask the user for clarification by asking the user clarifying questions. Half of false positives collapse at this step — the claim doesn't make coherent sense when restated precisely.

Document:

Route: Standard vs Deep Verification

After Step 0, choose a verification path.

Standard Verification

Use when ALL of these hold:

Follow ## Inlined: Standard Verification below. No separate task tracker required — work through the linear checklist, documenting findings inline.

Deep Verification

Use when ANY of these hold:

Follow ## Inlined: Deep Verification below. Track phases with explicit tasks or a checklist and execute them in dependency order (parallelize independent work when practical).

Default

Start with standard. Standard verification has two built-in escalation checkpoints that route to deep when complexity exceeds the linear checklist.

Batch Triage

When verifying multiple bugs at once:

  1. Run Step 0 for all bugs first — restating each claim often collapses obvious false positives immediately
  2. Route each bug independently (some may be standard, others deep)
  3. Process all standard-routed bugs first, then deep-routed bugs
  4. After all bugs are verified, check for exploit chains — findings that individually failed gate review may combine to form a viable attack

Final Summary

After processing ALL suspected bugs, provide:

  1. Counts: X TRUE POSITIVES, Y FALSE POSITIVES
  2. TRUE POSITIVE list: Each with brief vulnerability description
  3. FALSE POSITIVE list: Each with brief reason for rejection

References (in this document)

(See upstream Trail of Bits prodsec-skills fp-check plugin for companion agents and automation.)


Inlined: Standard Verification

Standard Verification

Linear single-pass checklist for straightforward bugs. No task creation — work through each step sequentially and document findings inline.

Escalation Checkpoints

Two points in this checklist may trigger escalation to deep-verification.md:

  1. After Step 1 (Data Flow): Escalate if 3+ trust boundaries, callbacks/async control flow, or ambiguous validation chain
  2. After Step 5 (Devil's Advocate): Escalate if any question produces genuine uncertainty you cannot resolve

When escalating, hand off all evidence gathered so far — deep verification will continue from where you left off.

Checklist

Step 1: Data Flow

Trace data from source to the alleged vulnerability sink.

Key pitfall: Analyzing the vulnerable code in isolation. Conditional logic upstream may make the vulnerability mathematically unreachable. Trace the full validation chain.

Escalation check: If you found 3+ trust boundaries, callbacks or async control flow in the path, or an ambiguous validation chain — escalate to deep verification.

Step 2: Exploitability

Prove the attacker can trigger the vulnerability.

Step 3: Impact

Determine whether exploitation has real security consequences.

Step 4: PoC Sketch

Create a pseudocode PoC showing the attack path. Executable and unit test PoCs are optional for standard verification.

Data Flow: [Source] → [Validation?] → [Transform?] → [Vulnerable Op] → [Impact]
Attacker controls: [what input, how]
Trigger: [pseudocode showing the exploit path]

See evidence-templates.md for the full PoC template.

Step 5: Devil's Advocate Spot-Check

Answer these 7 questions. If any produces genuine uncertainty, escalate to deep verification.

Against the vulnerability:

  1. Am I seeing a vulnerability because the pattern "looks dangerous" rather than because it actually is? (pattern-matching bias)
  2. Am I incorrectly assuming attacker control over trusted data? (trust boundary confusion)
  3. Have I rigorously proven the mathematical condition for vulnerability can occur? (proof rigor)
  4. Am I confusing defense-in-depth failure with a primary security vulnerability? (defense-in-depth confusion)
  5. Am I hallucinating this vulnerability? LLMs are biased toward seeing bugs everywhere — is this actually real or am I pattern-matching on scary-looking code? (LLM self-check)

For the vulnerability (always ask — false-negative protection):

  1. Am I dismissing a real vulnerability because the exploit seems complex or unlikely?
  2. Am I inventing mitigations or validation logic that I haven't verified in the actual source code? Re-read the code after reaching a conclusion.

Escalation check: If any question above produces genuine uncertainty you cannot resolve with the evidence at hand — escalate to deep verification.

Step 6: Gate Review

Apply all six gates from gate-reviews.md and all 13 items from false-positive-patterns.md to reach a verdict.


Inlined: Deep Verification

Deep Verification

Full task-based verification for complex bugs. Use when routing from SKILL.md selects the deep path, or when standard verification escalates.

If Escalated from Standard

When a bug escalates from standard verification:

  1. Review all evidence gathered during the standard pass — do not repeat completed work
  2. Identify which phases below are already satisfied by existing evidence
  3. Create tasks only for remaining phases, starting from where standard left off
  4. Preserve and reference all prior findings in new task descriptions

Verification Task List

For each bug (Bug #N), define tasks with the dependency structure below. Record task IDs and dependencies in your tracker (spreadsheet, issue system, or checklist) so nothing starts before its prerequisites complete.

── Phase 1: Data Flow Analysis ──────────────────────────────────
"BUG #N - Phase 1.1: Map trust boundaries and trace data flow"
  Then in parallel (each blocked by 1.1):
  "BUG #N - Phase 1.2: Research API contracts and safety guarantees"
  "BUG #N - Phase 1.3: Environment protection analysis"
  "BUG #N - Phase 1.4: Cross-reference analysis"

── Phase 2: Exploitability Verification (blocked by Phase 1) ───
  In parallel:
  "BUG #N - Phase 2.1: Confirm attacker controls input data"
  "BUG #N - Phase 2.2: Mathematical bounds verification"
  "BUG #N - Phase 2.3: Race condition feasibility proof"
  Then (blocked by 2.1, 2.2, 2.3):
  "BUG #N - Phase 2.4: Adversarial analysis"

── Phase 3: Impact Assessment (blocked by Phase 2) ─────────────
  In parallel:
  "BUG #N - Phase 3.1: Demonstrate real security impact"
  "BUG #N - Phase 3.2: Primary control vs defense-in-depth"

── Phase 4: PoC Creation (blocked by Phase 3) ──────────────────
  "BUG #N - Phase 4.1: Create pseudocode PoC with data flow diagrams"
  Then in parallel (each blocked by 4.1):
  "BUG #N - Phase 4.2: Create executable PoC if feasible"
  "BUG #N - Phase 4.3: Create unit test PoC if feasible"
  "BUG #N - Phase 4.4: Negative PoC — show exploit preconditions"
  Then (blocked by 4.2, 4.3, 4.4):
  "BUG #N - Phase 4.5: Verify PoC demonstrates the vulnerability"

── Phase 5: Devil's Advocate (blocked by Phase 4) ──────────────
  "BUG #N - Phase 5.1: Devil's advocate review"

── Gate Review (blocked by Phase 5) ────────────────────────────
  "BUG #N - GATE REVIEW: Evaluate all six gates before verdict"

Execution Rules

Delegation (optional)

You may assign phase work to specialized reviewers or separate focused sessions:

| Focus | Phases | Purpose |

|-------|--------|---------|

| Data-flow pass | 1.1–1.4 | Trace data flow, map trust boundaries, check API contracts and environment protections |

| Exploitability pass | 2.1–2.4 | Prove attacker control, mathematical bounds, race condition feasibility |

| PoC pass | 4.1–4.5 | Pseudocode, executable, unit test, and negative PoCs |

Phases 3 (Impact Assessment), 5 (Devil's Advocate), and the Gate Review should be synthesized in one place — do not split accountability for the final verdict.

(See upstream Trail of Bits prodsec-skills for named agents that mirror these phases.)

Phase Requirements

The task list above names every phase. Below are the key pitfalls and decision criteria for each — focus on what you might get wrong.

Phase 1: Data Flow Analysis

1.1: Map trust boundaries (internal/trusted vs external/untrusted) and trace data from source to alleged vulnerability. Apply class-specific verification from bug-class-verification.md. Key pitfall: Analyzing code in isolation without tracing the full validation chain. Conditional logic upstream may make the vulnerable code mathematically unreachable (see false-positive-patterns.md items 1 and 1a).

1.2: Check API contracts before claiming overflows — many APIs have built-in bounds protection that prevents the alleged issue regardless of inputs.

1.3: Before concluding vulnerability, verify that no compiler, runtime, OS, or framework protections prevent exploitation. Note: mitigations like ASLR and stack canaries raise the exploitation bar but do not eliminate the vulnerability itself. Distinguish "prevents exploitation entirely" (e.g., Rust's safe type system) from "makes exploitation harder" (e.g., ASLR).

1.4: Check if similar code patterns exist elsewhere and are handled safely. Review test coverage, code review history, and design documentation for this area.

Phase 2: Exploitability Verification

2.1: Prove attacker controls the data reaching the vulnerability. Key pitfall: Assuming network/external data reaches the operation without tracing the actual path — internal storage set by trusted components is not attacker-controlled.

2.2: Create explicit algebraic proofs for bounds-related issues. Use the template in evidence-templates.md. Verify: IF validation_check_passes THEN bounds_guarantee_holds.

2.3: For race conditions, prove concurrent access is actually possible. Key pitfall: Assuming race conditions in single-threaded initialization or synchronized contexts.

2.4: Assess full attack surface: input control, validation bypass paths, timing dependencies, and state manipulation.

Phase 3: Impact Assessment

3.1: Distinguish real security impact (RCE, privesc, info disclosure) from operational robustness issues.

3.2: Distinguish primary security controls from defense-in-depth. Failure of a defense-in-depth measure is not a vulnerability if primary protections remain intact.

Phase 4: PoC Creation

Always create a pseudocode PoC. Additionally, create executable and/or unit test PoCs when feasible:

  1. Pseudocode with data flow diagrams showing the attack path (always)
  2. Executable PoC in the target language demonstrating the vulnerability (if feasible)
  3. Unit test PoC exercising the vulnerable code path with crafted inputs (if feasible)

See evidence-templates.md for PoC templates.

Negative PoC (Phase 4.4): Demonstrate the gap between normal operation and the exploit path — what preconditions must hold for the vulnerability to trigger, and why they don't hold under normal conditions.

Phase 5: Devil's Advocate Review

Before final verdict, systematically challenge the vulnerability claim. Assume you are biased toward finding bugs and rating them as critical — actively work against that bias.

Challenges arguing AGAINST the vulnerability:

  1. What non-vulnerability explanations exist for this code pattern?
  2. How would the original developers justify this implementation?
  3. What crucial system architecture context might be missing?
  4. Am I seeing a vulnerability because the pattern "looks dangerous" rather than because it actually is?
  5. Even if validation looks insufficient, does it actually prevent the claimed condition?
  6. Am I incorrectly assuming attacker control over trusted data?
  7. Have I rigorously proven the mathematical condition for vulnerability can occur?
  8. Beyond theoretical possibility, is this practically exploitable?
  9. Am I confusing defense-in-depth failure with a primary security vulnerability?
  10. What compiler/runtime/OS protections might prevent exploitation?
  11. Am I hallucinating this vulnerability? LLMs are biased toward seeing bugs everywhere and rating every finding as critical — is this actually a real, exploitable issue or am I pattern-matching on scary-looking code?

Challenges arguing FOR the vulnerability (false-negative protection):

  1. Am I dismissing a real vulnerability because the exploit seems complex or unlikely?
  2. Am I inventing mitigations or validation logic that I haven't verified in the actual source code? Re-read the code after reaching a conclusion.

See evidence-templates.md for the devil's advocate documentation template.

Gate Review

Apply the six gates from gate-reviews.md to reach a verdict.


Inlined: Gate Reviews and Verdicts

Before reporting ANY bug as a vulnerability, all six gate reviews must pass. Evaluate these during the GATE REVIEW task after all phases are complete:

| Gate | Criterion | Pass | Fail |

|------|-----------|------|------|

| 1. Process | All phases completed with documented evidence | Evidence exists for every phase | Phases lack concrete evidence |

| 2. Reachability | Attacker can reach and control data at the vulnerability | Clear evidence of attacker-controlled path + PoC confirms | Cannot demonstrate attacker control or reachability |

| 3. Real Impact | Exploitation leads to RCE, privesc, or info disclosure | Direct impact with concrete scenarios | Only operational robustness issue |

| 4. PoC Validation | PoC (pseudocode, executable, or unit test) demonstrates the attack path | Shows attacker control, trigger, and impact | PoC fails to show attack path or impact |

| 5. Math Bounds | Mathematical analysis confirms vulnerable condition is possible | Algebraic proof shows condition is possible | Math proves validation prevents it |

| 6. Environment | No environmental protections entirely prevent exploitation | Protections do not eliminate vulnerability | Environmental protections block it entirely |

Verdict Format

If any phase fails verification, document the failure with evidence and continue all remaining phases. Issue the FALSE POSITIVE verdict only after all phases are complete.

Example Verdict

BUG #3 FALSE POSITIVE — Integer underflow in packet_handler.c:142
  Gate 5 (Math Bounds) FAIL: validation at line 98 ensures packet_size >= 16,
  making (packet_size - header_size) >= 8. Underflow is mathematically impossible.

Inlined: Bug-Class-Specific Verification

Bug-Class-Specific Verification

Different bug classes require different verification approaches. After classifying the bug in Step 0, apply the class-specific requirements below in addition to the generic verification phases.

Memory Corruption

Buffer overflow, heap overflow, stack overflow, out-of-bounds read/write, use-after-free, double-free, type confusion.

Language safety check first: Memory corruption in safe Rust, Go (without unsafe.Pointer/cgo), or managed languages (Java, C#, Python) is almost always a false positive — the type system or runtime prevents it. Verify whether the code is in an unsafe block (Rust), uses cgo/unsafe.Pointer (Go), or calls native code via JNI/P/Invoke. If the code is entirely in the safe subset, reject the memory corruption claim unless it involves a compiler bug or soundness hole.

Verify:

Logic Bugs

Authentication bypass, access control errors, incorrect state transitions, confused deputy, privilege escalation through API misuse.

Verify:

Race Conditions

TOCTOU, data races, signal handling races, concurrent state modification.

Verify:

Integer Issues

Overflow, underflow, truncation, signedness errors, wraparound.

Verify:

Crypto Weaknesses

Weak algorithms, bad parameters, nonce reuse, padding oracle, insufficient randomness, timing side channels.

Verify:

Injection

SQL injection, XSS, command injection, server-side template injection, path traversal, LDAP injection.

Verify:

Information Disclosure

Uninitialized memory reads, error message leaks, timing side channels, padding oracles.

Verify:

Denial of Service

Algorithmic complexity, resource exhaustion, crash bugs, infinite loops, memory bombs.

Verify:

Deserialization

Unsafe deserialization, object injection, gadget chain exploitation.

Verify:


Inlined: False Positive Patterns — Lessons Learned

False Positive Patterns — Lessons Learned

Apply ALL items in this checklist to EACH potential bug during verification.

Checklist

1. Trace Full Validation Chain

Don't analyze isolated code snippets. Trace backwards to find ALL validation that precedes potentially dangerous operations. Network packet size operations may look dangerous but often have bounds validation earlier in the function.

1a. Map Complete Conditional Logic Flow

Vulnerable-looking code may be unreachable due to conditional logic that creates mathematical guarantees. Example: array access buffer[length-4] appears unsafe when length < 4, but if the code is only reachable when length > 12 due to earlier validation, the vulnerability is impossible.

Verify:

2. Identify Defensive Programming Patterns

Distinguish between actual vulnerabilities and defensive assertions/validations. ASSERT(size == expected_size) followed by size-controlled operations is defensive, not vulnerable. Verify that checks actually prevent the alleged vulnerability.

3. Confirm Exploitable Data Paths

Only report vulnerabilities with CONFIRMED exploitable data flow paths. Don't assume network-controlled data reaches dangerous functions without tracing the actual path step by step.

4. Understand Data Source Context

Distinguish between data sources and their trust levels. API return values, compile-time constants, and network data have different risk profiles. Determine the actual source and whether it is attacker-controlled.

5. Analyze Bounds Validation Logic

Look for mathematical relationships between validation checks and subsequent operations. If packet_size >= MIN_SIZE is checked and MIN_SIZE >= sizeof(header), then packet_size - sizeof(header) cannot underflow.

6. Verify TOCTOU Claims

Time-of-check-time-of-use issues require proof that the checked value can change between check and use. If a size is checked and immediately used in the same function with no external modification possible, there is no TOCTOU.

7. Understand API Contract and Trust Boundaries

Always understand API contracts before claiming buffer overflows. Some APIs have built-in bounds protection and cannot write beyond the buffer regardless of input parameters.

8. Distinguish Internal Storage from External Input

Internal storage systems (configuration stores, registries) are controlled by trusted components, not attackers. Values set during installation by trusted components are not attacker-controlled.

9. Don't Confuse Pattern Recognition with Vulnerability Analysis

Code patterns that "look vulnerable" may be safely implemented due to context and API contracts. Size parameters being modified doesn't mean buffer overflow if the API prevents writing beyond bounds.

10. Verify Concurrent Access is Actually Possible

Don't assume race conditions exist without proving concurrent access patterns. Single-threaded initialization contexts cannot have race conditions. Verify the threading model and synchronization mechanisms.

11. Assess Real vs Theoretical Security Impact

Focus on vulnerabilities with actual security impact. Storage failure for non-critical data is an operational issue, not a security vulnerability. Ask: would this lead to code execution, privilege escalation, or information disclosure?

12. Understand Defense-in-Depth vs Primary Controls

Failure of defense-in-depth mechanisms is not always a vulnerability if primary protections exist. Token cleanup failure is not critical if tokens are single-use by design at the server.

13. Apply the Checklist Rigorously, Not Superficially

Having a checklist doesn't prevent false positives if it isn't applied systematically. For EVERY potential vulnerability, work through ALL checklist items before concluding.


Red Flags for False Positives

Pattern-Based False Positives

Context-Blind Analysis False Positives

Mathematical/Bounds Analysis False Positives

API Contract Misunderstanding False Positives


Inlined: Evidence Templates

Evidence Templates

Use these templates when documenting verification evidence for each bug.

Data Flow Documentation

Bug #N Data Flow Analysis
Source: [exact location] — Trust Level: [trusted/untrusted]
Path: Source → Validation1[file:line] → Transform[file:line] → Vulnerability[file:line]
Validation Points:
  - Check1: [condition] at [file:line] — [passes/fails/bypassed]
  - Check2: [condition] at [file:line] — [passes/fails/bypassed]

Mathematical Bounds Proof

Bug #N Mathematical Analysis
Claim: Operation X is vulnerable to [overflow/underflow/bounds violation]
Given Constraints: [list all validation conditions]

Algebraic Proof:
1. [first constraint from validation]
2. [constant or known value]
3. [derived inequality]
...
N. Therefore: [vulnerability confirmed/debunked] (Q.E.D.)

Conclusion: [vulnerability is/is not mathematically possible]

Example:

Given: validation ensures (input_size >= MIN_SIZE)
Given: MIN_SIZE = 16, header_size = 8
Prove: (input_size - header_size) cannot underflow

1. input_size >= MIN_SIZE             (from validation)
2. MIN_SIZE = 16                      (constant)
3. header_size = 8                    (constant)
4. input_size >= 16                   (substitution of 1,2)
5. input_size - 8 >= 16 - 8          (subtract header_size from both sides)
6. input_size - header_size >= 8     (simplification)
7. Therefore: underflow impossible    (Q.E.D.)

Attacker Control Analysis

Bug #N Attacker Control Analysis
Input Vector: [how attacker provides input]
Control Level: [full/partial/none]
Constraints: [what limits exist on attacker input]
Reachability: [can attacker-controlled data reach vulnerable operation?]

PoC — Pseudocode with Data Flow Diagram

PoC for Bug #N: [Brief Description]

Data Flow Diagram:

[External Input] → [Validation Point] → [Processing] → [Vulnerable Operation]
     |                    |                   |                    |
  Attacker           (May be bypassed)    (Transforms data)   (Unsafe operation)
  Controlled              |                   |                    |
     |                    v                   v                    v
  [Malicious Data] → [Insufficient Check] → [Processed Data] → [Impact]

PSEUDOCODE:
function vulnerable_operation(user_data):
    validation_result = weak_validation(user_data)  // Explain why this fails
    processed_data = transform_data(user_data)      // Show transformation
    unsafe_operation(processed_data)               // Show vulnerability trigger

Devil's Advocate Review

Bug #N Devil's Advocate Review
Vulnerability Claim: [brief description]

For each of the 13 questions from the devil's advocate review, document your answer:
1-11. [Challenges arguing AGAINST the vulnerability]
12-13. [Challenges arguing FOR the vulnerability — false-negative protection]

Final Assessment: [Vulnerability confirmed/debunked with reasoning]
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.