agentleFS
CarbeneAICarbeneAI/Forge/.claude/skills/BugHunter/SKILL.md

BugHunter

Skill9 starsChanged 6 months agoMITView on GitHub

AI-powered source code vulnerability discovery, exploitation, and patching pipeline. Inspired by Praetorian Constantine's 6-stage architecture. USE WHEN user mentions bug bounty, source code audit, vulnerability scanning, code security review, CVE hunting, exploit generation, proof of vulnerability, patch validation, security-relevant file scoring, SAST, static analysis, or wants to find exploitable bugs in a codebase. Integrates with Ehud (pentest agent) and Nehemiah (security auditor) for comprehensive assessments.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check for existing sanitization, validation, or guards

    line 120
  2. Distinctive:

    Run in sandboxed environment when possible (Kali MCP)

    line 137
  3. Distinctive:

    Document: exact reproduction steps, expected vs actual behavior

    line 138
  4. Distinctive:

    Use After Free (CWE-416)

    line 207

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

BugHunter

AI-powered source code vulnerability discovery and patching pipeline. Inspired by Praetorian Constantine -- adapted for Claude Code's native capabilities.

Philosophy

"Never report a finding you can't prove, never propose a fix you haven't tested."

Three core principles (from DARPA AIxCC):

  1. Patching matters 3x more than discovery -- validation through re-exploitation is critical
  2. Accuracy multipliers punish speculation -- independent verification at every stage
  3. Prove it or drop it -- every finding needs a proof-of-vulnerability

Pipeline Overview

1. INGEST --> 2. DETECT --> 3. VERIFY --> 4. EXPLOIT --> 5. PATCH --> 6. REPORT
     |              |            |             |            |            |
  Clone/Map     Multi-pass    Agentic       Generate     Fix + Re-    CWE/CVSS
  + Score       LLM scan      code flow     PoV code     verify       Markdown
  files         (fast+deep)   analysis                                + JSON

Quick Start

Full Scan (recommended)

"Run a BugHunter full scan on <repo-url-or-path>"
"Bug bounty scan this repository"

Quick Triage

"BugHunter quick scan on src/"
"Triage this codebase for security issues"

Targeted Scan

"BugHunter scan the auth module for injection flaws"
"Hunt for deserialization bugs in the API routes"

Patch Validation

"BugHunter validate this patch fixes the vulnerability"
"Re-exploit after patch to confirm the fix"

Workflow Routing

WorkflowTriggerFile
Full Scan"full scan", "bug bounty scan", "comprehensive audit"workflows/FullScan.md
Quick Scan"quick scan", "triage", "fast audit"workflows/QuickScan.md
Patch Validate"validate patch", "verify fix", "re-exploit"workflows/PatchValidate.md

Stage Details

Stage 1: Ingest

Clone (or open) the target repository and build an attack surface map.

File Scoring (0-100): Each file is scored for security relevance:

Score RangeCategoryExamples
80-100CriticalAuth handlers, crypto, input parsers, deserialization, network protocols
60-79HighDatabase queries, file I/O, API controllers, middleware, config loaders
40-59MediumBusiness logic, data models, service layers
20-39LowUtilities, helpers, formatting
0-19SkipTests, fixtures, docs, generated code, vendored deps

Priority signals:

  • Files touching: authentication, authorization, cryptography, input parsing, deserialization, SQL/NoSQL queries, file system ops, command execution, network I/O, secrets/env handling
  • Recent git commits (churn = risk)
  • Large functions with complex control flow
  • Files with prior CVEs or security-related commits

Stage 2: Detect

Multi-pass LLM analysis on high-scoring files:

Pass 1 -- Fast Sweep (subagent, haiku-class):

  • Scan each file for known vulnerability patterns
  • Flag potential issues with low confidence threshold
  • Output: candidate list with file, line range, suspected CWE

Pass 2 -- Deep Analysis (subagent, sonnet/opus-class):

  • Review each candidate with full file context
  • Trace data flow from sources to sinks
  • Classify: Confirmed, Likely, Possible, False Positive
  • Output: refined findings with confidence scores

Pass 3 -- Adversarial Review (optional, for critical findings):

  • Actor agent argues the finding is real
  • Skeptic agent argues it's a false positive
  • Adjudicator decides based on evidence
  • Output: high-confidence findings only

Stage 3: Verify

Agentic code exploration to confirm each finding:

  • Trace taint from untrusted input to vulnerable sink
  • Map the full call chain (caller -> ... -> vulnerable function)
  • Check for existing sanitization, validation, or guards
  • Determine if the vulnerability is reachable from an entry point
  • Assess trust boundaries (is the input actually attacker-controlled?)

Drop criteria: Finding is dropped if:

  • Input is only reachable from trusted/internal callers
  • Existing sanitization adequately prevents exploitation
  • The vulnerable pattern is dead code or unreachable

Stage 4: Exploit

Generate proof-of-vulnerability for each verified finding:

  • Craft actual input/payload that triggers the bug
  • For web apps: HTTP request with malicious parameters
  • For libraries: Code snippet that demonstrates the flaw
  • For CLI tools: Command-line invocation that triggers the issue
  • Run in sandboxed environment when possible (Kali MCP)
  • Document: exact reproduction steps, expected vs actual behavior

Trust model analysis: Eliminate self-inflicted vulnerabilities (e.g., a test that deliberately uses weak crypto is not a finding).

Stage 5: Patch

Generate and validate fixes using tiered approach:

TierFix TypeExample
1Dependency bumpUpdate library past vulnerable version
2Targeted guardAdd input validation, parameterized query
3Structural refactorReplace vulnerable pattern entirely

Validation: Re-run the exploit from Stage 4 against patched code. Only report patches that provably fix the bug.

Stage 6: Report

Generate structured output:

For each finding:

  • Title and description
  • CWE classification (e.g., CWE-89: SQL Injection)
  • CVSS v3.1 score and vector string
  • Severity: Critical / High / Medium / Low / Info
  • Affected file(s) and line numbers
  • Data flow trace (source -> ... -> sink)
  • Proof-of-vulnerability (exact reproduction steps)
  • Recommended patch (with validation status)
  • References (CVE database, OWASP, etc.)

Output formats:

  • findings.md -- Human-readable Markdown report
  • findings.json -- Machine-readable structured data

Vulnerability Pattern Library

Injection (CWE-74 family)

  • SQL Injection (CWE-89)
  • OS Command Injection (CWE-78)
  • LDAP Injection (CWE-90)
  • XPath Injection (CWE-643)
  • Template Injection (SSTI)
  • Header Injection (CWE-113)

Authentication & Access (CWE-287 family)

  • Broken Authentication (CWE-287)
  • Missing Authorization (CWE-862)
  • IDOR / Insecure Direct Object Reference (CWE-639)
  • Privilege Escalation (CWE-269)
  • JWT Vulnerabilities (weak signing, none algorithm)

Cryptographic (CWE-310 family)

  • Weak Algorithms (CWE-327)
  • Hardcoded Credentials (CWE-798)
  • Insufficient Key Length (CWE-326)
  • Missing Encryption (CWE-311)
  • Predictable Random (CWE-330)

Input Handling (CWE-20 family)

  • Path Traversal (CWE-22)
  • Deserialization of Untrusted Data (CWE-502)
  • XML External Entity (CWE-611)
  • Server-Side Request Forgery (CWE-918)
  • Open Redirect (CWE-601)
  • Prototype Pollution (JS-specific)

Memory Safety (C/C++/Rust unsafe)

  • Buffer Overflow (CWE-120)
  • Use After Free (CWE-416)
  • Double Free (CWE-415)
  • Integer Overflow (CWE-190)
  • Format String (CWE-134)

Configuration & Secrets

  • Debug Mode in Production (CWE-489)
  • Exposed Admin Interfaces
  • CORS Misconfiguration
  • Missing Security Headers
  • Secrets in Source Code (CWE-540)

Language-Specific Focus Areas

LanguagePriority Patterns
Pythoneval/exec, pickle, yaml.load, subprocess shell=True, SQL string concat, Jinja2 autoescape=False
JavaScript/TSeval, innerHTML, dangerouslySetInnerHTML, child_process, prototype pollution, regex DoS
JavaObjectInputStream, Runtime.exec, XML parsers (XXE), Spring expression injection, Log4j patterns
Gosql.Query with string concat, template.HTML, exec.Command, path traversal in http.FileServer
C/C++strcpy/strcat/sprintf, malloc/free patterns, format strings, integer arithmetic
PHPsystem/exec/passthru, include/require with user input, unserialize, SQL concat
Rubysend/public_send, ERB/eval, YAML.load, system/backticks, mass assignment
Rustunsafe blocks, raw pointer deref, unchecked indexing, std::mem::transmute

Agent Integration

AgentRole in BugHunter
EhudExploit validation on Kali MCP, network-layer PoC execution
NehemiahDeep security code review, OWASP compliance verification
SolomonCode quality assessment of proposed patches
DeborahAdversarial skeptic in Stage 3 verification

Scan Configurations

ConfigFiles ScoredFindings ReviewedBest For
FullAll filesUp to 250Comprehensive audit, bug bounty
QuickTop 50 by scoreUp to 50Fast triage, PR review
TargetedSpecified paths onlyAll in scopeFocused investigation

Cost & Scope Control

  • File scoring prevents wasting analysis on test fixtures and docs
  • Configurable depth limits per stage
  • Early termination when budget/time constraints hit
  • Progress reporting at each stage transition

Ethical Guidelines

  1. Authorization required -- Only scan repos you own or have explicit permission to test
  2. Responsible disclosure -- Follow coordinated disclosure for public repos
  3. Bug bounty scope -- Respect program scope, rules, and safe harbor provisions
  4. No weaponization -- PoVs demonstrate the bug, not maximize damage
  5. Privacy -- Don't exfiltrate or store sensitive data found during scans

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.