Vulnerability PoC Generator
Workflow
- Validate and normalize the commit URL.
- Run
scripts/fetch_commit_diff.py to fetch .diff and .patch artifacts.
- Run
scripts/analyze_patch.py on the fetched diff to extract likely sources/sinks/guards/CWE hints.
- Run
scripts/generate_poc_outline.py to create an initial Markdown PoC draft.
- Run
scripts/run_poc_pipeline.py to automatically chain draft generation and real verification.
- Identify repository, commit hash, affected files, and vulnerability-relevant code paths.
- Infer vulnerability class from patch delta plus analysis signals.
- Refine the draft into a minimal, deterministic PoC.
- Provide environment setup, run steps, expected results, and cleanup.
- Include the verification report findings for both vulnerable and patched revisions.
Input Requirements
Require at minimum:
Request if missing:
- Target runtime constraints (OS/container/toolchain)
- Whether Docker-based reproduction is acceptable
- Preferred output style (script-only, markdown report, both)
If details are missing, assume a safe, local, disposable environment and continue.
Commit Analysis Procedure
- Fetch artifacts:
python3 scripts/fetch_commit_diff.py <commit_url> --out-dir ./artifacts --prefix commit
- Run heuristic analyzer:
python3 scripts/analyze_patch.py ./artifacts/commit-<sha>.diff
- Generate an outline draft:
python3 scripts/generate_poc_outline.py \
--meta ./artifacts/commit-<sha>.json \
--analysis ./artifacts/commit-<sha>.diff.analysis.json \
--poc-lang auto # or force: go/python/js/...
- Run auto pipeline (outline + verification in one command):
python3 scripts/run_poc_pipeline.py \
--meta ./artifacts/commit-<sha>.json \
--analysis ./artifacts/commit-<sha>.diff.analysis.json \
--poc-script ./poc_generated.py \
--verdict-mode different_exit_codes
- Parse
.diff, .patch, .analysis.json, generated .md, and verification report together.
- Extract:
- Changed files and functions
- Guard conditions added/removed
- Input sources (HTTP params, file paths, headers, serialized blobs, CLI args)
- Security-sensitive sinks (filesystem, eval, query execution, auth checks, unsafe memory ops)
- Build a concise root-cause statement:
- "Before patch: ..."
- "Trigger condition: ..."
- "Impact in local test: ..."
- "Patch blocks by: ..."
- Map to a candidate CVE/CWE class when strongly supported by diff evidence.
PoC Construction Rules
- Prefer minimal local impact and deterministic execution.
- Prefer containerized or isolated setup instructions.
- Keep payloads narrowly scoped to proving the bug, not maximizing damage.
- Include prerequisites and exact version pinning when possible.
- Include two checks:
- Vulnerable version should reproduce
- Patched version should fail to reproduce (or return safe behavior)
Output Format
Produce the final result in this order:
Vulnerability Summary
- Commit URL
- Affected component
- Root cause
- Expected vulnerable behavior
Reproduction Environment
- OS/runtime/dependencies
- Build/run commands
- Dataset/fixtures required
PoC Steps
- Step-by-step commands
- PoC script or request examples
- Trigger payload
Expected Results
- On vulnerable commit
- On patched commit
Troubleshooting
- Common setup failures and fixes
Safety Notes
- Run only in local or explicitly authorized test environments
- Do not run against production or third-party systems
PoC Script Guidance
When writing executable PoC scripts:
- Use clear command-line arguments (
--target, --port, --input, --mode)
- Print explicit success/failure markers
- Use timeout/retry to avoid hanging tests
- Exit non-zero on setup failures
- Keep logs concise and actionable
Resource Usage
- Use fetch_commit_diff.py first to produce normalized artifacts.
- Use analyze_patch.py next to generate structured analysis signals.
- Use generate_poc_outline.py to create an initial report draft (auto language inference; override with
--poc-lang).
- Use run_poc_pipeline.py to chain generation + verification automatically.
- Use verify_repro.py directly for custom verification control and advanced command overrides.
- Read poc-template.md before finalizing the answer.
- Reuse the template headings and fill only evidence-backed claims.
- If an assumption is required, label it as
Assumption.
Quality Checklist
Before finalizing, verify:
- Commit URL is valid and parsed correctly
- PoC references exact vulnerable behavior from diff
- Steps are reproducible without hidden prerequisites
- Patched behavior check is included
- Risky actions are excluded or clearly gated
1---2name: vuln-poc-generate3description: Analyze a GitHub vulnerability fix commit and generate a reproducible proof-of-concept (PoC) for the vulnerable behavior. Use when the user provides a GitHub commit URL and asks to reproduce, verify, or demonstrate the vulnerability before/after the patch.4---56# Vulnerability PoC Generator78## Workflow9101. Validate and normalize the commit URL.112. Run `scripts/fetch_commit_diff.py` to fetch `.diff` and `.patch` artifacts.123. Run `scripts/analyze_patch.py` on the fetched diff to extract likely sources/sinks/guards/CWE hints.134. Run `scripts/generate_poc_outline.py` to create an initial Markdown PoC draft.145. Run `scripts/run_poc_pipeline.py` to automatically chain draft generation and real verification.156. Identify repository, commit hash, affected files, and vulnerability-relevant code paths.167. Infer vulnerability class from patch delta plus analysis signals.178. Refine the draft into a minimal, deterministic PoC.189. Provide environment setup, run steps, expected results, and cleanup.1910. Include the verification report findings for both vulnerable and patched revisions.2021## Input Requirements2223Require at minimum:24- GitHub commit URL2526Request if missing:27- Target runtime constraints (OS/container/toolchain)28- Whether Docker-based reproduction is acceptable29- Preferred output style (script-only, markdown report, both)3031If details are missing, assume a safe, local, disposable environment and continue.3233## Commit Analysis Procedure34351. Fetch artifacts:36```bash37python3 scripts/fetch_commit_diff.py <commit_url> --out-dir ./artifacts --prefix commit38```392. Run heuristic analyzer:40```bash41python3 scripts/analyze_patch.py ./artifacts/commit-<sha>.diff42```433. Generate an outline draft:44```bash45python3 scripts/generate_poc_outline.py \46 --meta ./artifacts/commit-<sha>.json \47 --analysis ./artifacts/commit-<sha>.diff.analysis.json \48 --poc-lang auto # or force: go/python/js/...49```504. Run auto pipeline (outline + verification in one command):51```bash52python3 scripts/run_poc_pipeline.py \53 --meta ./artifacts/commit-<sha>.json \54 --analysis ./artifacts/commit-<sha>.diff.analysis.json \55 --poc-script ./poc_generated.py \56 --verdict-mode different_exit_codes57```585. Parse `.diff`, `.patch`, `.analysis.json`, generated `.md`, and verification report together.596. Extract:60- Changed files and functions61- Guard conditions added/removed62- Input sources (HTTP params, file paths, headers, serialized blobs, CLI args)63- Security-sensitive sinks (filesystem, eval, query execution, auth checks, unsafe memory ops)647. Build a concise root-cause statement:65- "Before patch: ..."66- "Trigger condition: ..."67- "Impact in local test: ..."68- "Patch blocks by: ..."698. Map to a candidate CVE/CWE class when strongly supported by diff evidence.7071## PoC Construction Rules72731. Prefer minimal local impact and deterministic execution.742. Prefer containerized or isolated setup instructions.753. Keep payloads narrowly scoped to proving the bug, not maximizing damage.764. Include prerequisites and exact version pinning when possible.775. Include two checks:78- Vulnerable version should reproduce79- Patched version should fail to reproduce (or return safe behavior)8081## Output Format8283Produce the final result in this order:84851. `Vulnerability Summary`86- Commit URL87- Affected component88- Root cause89- Expected vulnerable behavior90912. `Reproduction Environment`92- OS/runtime/dependencies93- Build/run commands94- Dataset/fixtures required95963. `PoC Steps`97- Step-by-step commands98- PoC script or request examples99- Trigger payload1001014. `Expected Results`102- On vulnerable commit103- On patched commit1041055. `Troubleshooting`106- Common setup failures and fixes1071086. `Safety Notes`109- Run only in local or explicitly authorized test environments110- Do not run against production or third-party systems111112## PoC Script Guidance113114When writing executable PoC scripts:115- Use clear command-line arguments (`--target`, `--port`, `--input`, `--mode`)116- Print explicit success/failure markers117- Use timeout/retry to avoid hanging tests118- Exit non-zero on setup failures119- Keep logs concise and actionable120121## Resource Usage122123- Use [fetch_commit_diff.py](scripts/fetch_commit_diff.py) first to produce normalized artifacts.124- Use [analyze_patch.py](scripts/analyze_patch.py) next to generate structured analysis signals.125- Use [generate_poc_outline.py](scripts/generate_poc_outline.py) to create an initial report draft (auto language inference; override with `--poc-lang`).126- Use [run_poc_pipeline.py](scripts/run_poc_pipeline.py) to chain generation + verification automatically.127- Use [verify_repro.py](scripts/verify_repro.py) directly for custom verification control and advanced command overrides.128- Read [poc-template.md](references/poc-template.md) before finalizing the answer.129- Reuse the template headings and fill only evidence-backed claims.130- If an assumption is required, label it as `Assumption`.131132## Quality Checklist133134Before finalizing, verify:135- Commit URL is valid and parsed correctly136- PoC references exact vulnerable behavior from diff137- Steps are reproducible without hidden prerequisites138- Patched behavior check is included139- Risky actions are excluded or clearly gated