Analyze cve

From ShulkwiSEC/bb-huge · View interactive version

Analyze cve is an AI agent skill from the GitHub repository ShulkwiSEC/bb-huge. Analyzes CVE vulnerabilities in project dependencies with code path tracing and PoC generation for Burp Suite. Traces vulnerable code from user input to sink, assesses exploitability, and generates HTTP requests for testing.

How to use this skill

Skill file

CVE Vulnerability Analysis Workflow

Purpose

This workflow provides a structured methodology for analyzing whether a CVE affecting a project dependency poses a real security risk. It:

Language/Framework Agnostic: Works with Python, Node.js, Java, Go, Ruby, PHP, and more.

Important Assumptions

Trust User-Provided Information

What This Means


CHAIN COMMITMENTS — DECLARE BEFORE STARTING

Read this before executing any workflow phase. Commit to MANDATORY chains before your first tool call.

| Trigger | Chain | Mandatory? | Claude Code | opencode |

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

| After session(action="complete") (confirmed exploitable finding) | /gh-export | OPTIONAL — user request only | Skill(skill="gh-export") | cat ~/.config/opencode/commands/gh-export.md |

| Exploitable CVE confirmed + live target available | /web-exploit | OPTIONAL | Skill(skill="web-exploit") | cat ~/.config/opencode/commands/web-exploit.md |

| Exploitable CVE confirmed + Metasploit module available | /metasploit | OPTIONAL | Skill(skill="metasploit") | cat ~/.config/opencode/commands/metasploit.md |

Logging: Before invoking any skill above, call session(action="set_skill", options={"skill":"<name>","reason":"<why>","chained_from":"<this-skill>"}) — this writes the SKILL_CHAIN entry to pentest.log.


Analysis Workflow

Phase 1: Vulnerability Context Gathering

  1. Read CVE Details
  1. Trust User-Provided Version Information

Phase 2: Code Path Analysis

  1. Understand Vulnerable Function from CVE
  1. Trace Usage in Application

Phase 3: User Input Trace

  1. Identify Entry Points
  1. Trace User Input Flow

Phase 4: Dataflow Analysis

  1. Construct Dataflow Graph
  1. Exploitability Assessment

Phase 5: Proof of Concept Development

  1. Craft HTTP Request
  1. Document Expected Behavior

Phase 5b: Report to Dashboard (when MCP tools are available)

If pentest-agent MCP tools are available (e.g. when chained from /pentester), report findings to the live dashboard:

  1. Log confirmed vulnerabilities
  1. Route PoC through Burp Suite

Skip this phase if MCP tools are not available (standalone analysis). The markdown report is always produced regardless.

Phase 6: Report Generation

  1. Compile Findings

Output Report Template

⚠️ CRITICAL: Every report MUST include the "Tracking Tool Summary" section at the end with file paths and line numbers. This section is MANDATORY and should NEVER be omitted.

# CVE-YYYY-XXXXX Analysis Report

## Executive Summary
**Exploitability**: [HIGH/MEDIUM/LOW/NOT EXPLOITABLE]
**Impact**: [Brief description]
**Recommendation**: [Immediate action needed]

## Vulnerability Information
- **CVE ID**: CVE-YYYY-XXXXX
- **Dependency**: [name]
- **Installed Version**: [version]
- **Vulnerable Versions**: [range]
- **Vulnerability Type**: [RCE/XSS/SQLi/etc.]
- **CVSS Score**: [if available]

## Vulnerability Description
[Detailed description from CVE source]

## Code Path Analysis

### Vulnerable Function
- **Location in Dependency**: [module.function]
- **Function Signature**: `[signature]`
- **Vulnerability Mechanism**: [how it works]

### Import Evidence
[Show where and how the vulnerable package is imported - this proves the dependency is loaded]

1. `file.ext:line` - Import statement:
   ```[language]
   [line_number] [actual import statement from code with line numbers preserved]
   ```

2. `file.ext:line` - Import statement:
   ```[language]
   [line_number] [actual import statement from code with line numbers preserved]
   ```

**Note**: Include line numbers in all code snippets to show exact locations in source files.

### Usage in Application
[List all locations where vulnerable code is used]

1. `file.ext:line` - [context]
   ```[language]
   [line_number] [code snippet showing vulnerable function call with line numbers]
   ```

2. `file.ext:line` - [context]
   ```[language]
   [line_number] [code snippet showing vulnerable function call with line numbers]
   ```

## Dataflow Analysis

### Source (User Input Entry Point)
- **Endpoint**: `[METHOD] /api/path`
- **Parameter**: [parameter_name]
- **Location**: `file.ext:line`

### Flow Path
1. **Entry**: `file.ext:line` - [description]
   ```[language]
   [line_number] [code snippet with line numbers preserved]
   ```

2. **Step 2**: `file.ext:line` - [description]
   ```[language]
   [line_number] [code snippet with line numbers preserved]
   ```

[...continue for each step...]

N. **Sink**: `file.ext:line` - Vulnerable function called
   ```[language]
   [line_number] [code snippet with line numbers preserved]
   ```

**Note**: All code snippets must include line numbers from the original source files for precise traceability.

## Security Controls Analysis
- [Input validation present/absent]
- [Authentication/authorization]
- [Other relevant controls]
- [Bypass techniques if applicable]

## Exploitability Assessment
- **Verdict**: [HIGH/MEDIUM/LOW/NOT EXPLOITABLE]
- **Reasoning**: [detailed explanation]
- **Attack Complexity**: [Low/Medium/High]
- **Prerequisites**: [what attacker needs]

## Proof of Concept

### HTTP Request for Burp Suite

POST /api/endpoint HTTP/1.1

Host: localhost:PORT

Content-Type: application/json

Content-Length: XXX

[payload]


### Reproduction Steps
1. [Step 1]
2. [Step 2]
3. [Step 3]

### Expected Results
- [What happens on successful exploitation]
- [Observable indicators]

### Verification
- Response code: [expected]
- Response body: [expected patterns]
- Log entries: [what to look for]
- Side effects: [file creation, code execution, etc.]

## Recommendations

### Immediate Actions
- [ ] Upgrade [dependency] to version [safe version]
- [ ] Apply workaround: [if available]
- [ ] Monitor for exploitation attempts

### Long-term Fixes
- [ ] Update dependency management policy
- [ ] Implement additional input validation
- [ ] Add security controls: [specific recommendations]

### Detection & Monitoring
- Monitor for requests to: [endpoint]
- Watch for patterns: [attack signatures]
- Alert on: [specific conditions]

## References
- [CVE Link]
- [GitHub Advisory]
- [Vendor Security Bulletin]
- [PoC/Exploit References]

---

## Tracking Tool Summary
⚠️ **MANDATORY SECTION - NEVER OMIT THIS**

**Quick Copy-Paste Summary** (1-2 sentences + file locations):
[Concise explanation of exploitability or why it's a false positive, followed by all relevant file:line references]

**Required Format**: [Explanation]. Found in: `file.ext:line`, `file.ext:line`, `file.ext:line`

**This section MUST always be included at the end of every report**

**Examples**:
- *False Positive*: "The vulnerable function is never called with user-controlled input; all usage is with hardcoded internal configuration values only. Found in: `config/settings.py:45`, `utils/loader.py:123`"
- *False Positive*: "Package is imported but the vulnerable code path is unreachable due to authentication requirements and input validation that prevents exploitation. Import at `api/routes.py:12`, usage at `api/handlers.py:89`"
- *Exploitable*: "User-controlled file uploads directly reach the vulnerable parser without sanitization, enabling remote code execution. Entry point: `api/upload.py:34`, sink: `parsers/document.py:156`"

---
**Analysis Date**: [date]
**Analyst**: Claude (Anthropic)
**Project**: [project name]

Project Auto-Detection

When you run the workflow, the following will be automatically detected:

Framework Detection

Entry Point Detection

Dependency File Location

Import Statement Examples (By Language)

When documenting import evidence, look for patterns like:


Best Practices

  1. Be Thorough: Check all code paths, even indirect ones
  2. Document Everything: Include file:line references for traceability
  3. Show Import Evidence: Always capture and display how vulnerable packages are imported as proof they're loaded
  4. Preserve Line Numbers: All code snippets must include original line numbers from source files for precise traceability
  5. Test Assumptions: Verify dataflow actually reaches the sink
  6. Consider Context: Security controls might mitigate vulnerability
  7. Realistic PoC: Create exploits that work in real application context
  8. Actionable Output: Provide clear, specific recommendations
  9. Tracking Summary: Always include a concise 1-2 sentence summary at the end with ALL relevant file:line references for easy copy-paste into tracking tools

Important Notes


Version: 1.0

Last Updated: 2024

Supported Languages: Python, Node.js, Java, Go, Ruby, PHP, and more

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.