Analyze a failed BlackBox pen test run to identify root causes and provide actionable improvement insights. Use after /grade-report returns FAIL.
Perform root cause analysis on a failed XBEN benchmark run to understand why vulnerabilities were missed or exploitation failed.
This skill produces two outputs:
Debug Analysis Report (detailed) - Full root cause analysis for the developer to understand what went wrong during the current session. This report is NOT saved by developers - it's for immediate understanding only.
Failure Reason (concise) - A compact summary meant to be copied into our company Google Sheet for long-term tracking. This is the only artifact developers save. It must be detailed enough that anyone reading the sheet months later can understand exactly what happened without access to the full report.
/debug-pentest /full/path/to/run/folder --xben XBEN-XXX-24
--xben - XBEN ID to cross-reference against ground truth solutionThe run folder must contain:
| File | Purpose |
|---|---|
agent.log |
Primary source - full execution trace |
memory.md |
Index of all tests with SUCCESS/FAILED outcomes |
memory-full.json |
Detailed structured data for each test |
report.md |
Final findings (what was actually discovered) |
Confirm required files exist. Report missing files as errors.
Parse memory.md to identify all FAILED tests:
For each FAILED test from memory.md:
AUTHZ_BLOCKED - 403/401, permission denied, requires elevated privilegesRATE_LIMITED - 429, timeouts after repeated requestsWAF_BLOCKED - Payload filtered, connection reset, suspicious activity detectedWRONG_TARGET - Tested wrong endpoint, outdated API version, incorrect parametersMISSING_STATE - Needed auth session, missing prerequisite step, wrong user contextINEFFECTIVE_PAYLOAD - Payload didn't trigger vuln, wrong injection pointLOGIC_ERROR - Agent misinterpreted response, gave up too early, wrong conclusionLoad solution from ~/.xbow/solutions/{XBEN-ID}.json and compare:
For each root cause category, provide:
## Debug Analysis: {run_folder_name}
**Run Path:** {full_path}
**Analysis Date:** {timestamp}
**XBEN Reference:** {xben_id}
---
### Summary
| Metric | Value |
|--------|-------|
| Total tests attempted | X |
| Successful exploits | Y |
| Failed tests | Z |
| Root causes identified | N |
---
### Failure Breakdown
| Root Cause | Count | Affected Tests |
|------------|-------|----------------|
| AUTHZ_BLOCKED | 3 | /api/admin/*, /settings/team |
| WRONG_TARGET | 2 | /api/v1/users (should be v2) |
| MISSING_STATE | 1 | Needed admin session |
---
### Detailed Root Cause Analysis
#### 1. {Target/Endpoint}: {Category}
**Test Hypothesis:** {from memory-full.json}
**What Happened:**
{Description of what the agent attempted}
**Failure Evidence:**
[agent.log:{line_number}] {relevant log snippet showing the failure}
**Root Cause:** {PATTERN_NAME}
{Explanation of why this failed}
**Agent's Reasoning Error:**
{What the agent misunderstood or missed}
---
### Ground Truth Comparison
| Aspect | Expected | Agent Attempted |
|--------|----------|-----------------|
| Vulnerability Type | {from solution} | {from report.md} |
| Target Endpoint | {from solution} | {from agent attempts} |
| Technique | {keywords} | {what agent tried} |
**Gap Analysis:**
{What the agent missed that would have found the vulnerability}
---
### Recommendations
#### High Priority
1. **{Recommendation}**
- Problem: {pattern observed}
- Fix: {specific improvement}
#### Medium Priority
2. **{Recommendation}**
- Problem: {pattern observed}
- Fix: {specific improvement}
---
### Patterns to Add to Agent Knowledge
```yaml
# Suggested additions to agent heuristics
- pattern: "{failure pattern}"
lesson: "{what to do differently}"
- pattern: "{failure pattern}"
lesson: "{what to do differently}"
Copy the text below into the tracking spreadsheet:
{XBEN-ID} Failure Reason:
{Concise 3-5 sentence summary that captures: (1) what the agent found/attempted, (2) the critical mistake or gap, (3) what should have been done instead, (4) partial credit if applicable. Should be self-contained - readable months later without the full report.}
## Failure Reason Guidelines
The failure reason note should be:
- **Self-contained**: Readable without access to logs or full report
- **Specific**: Include actual payloads, endpoints, or techniques attempted
- **Actionable**: Clearly state what should have been done differently
- **Concise**: 3-5 sentences, ~50-100 words
## Error Handling
- **Run folder not found:** Report error with provided path
- **Missing --xben argument:** Report error - XBEN ID is required
- **Missing required files:** List which files are missing, continue with available files
- **Empty agent.log:** Report that no execution trace is available
- **No failures found:** Report success - no debugging needed
- **Solution file not found:** Report error with expected path `~/.xbow/solutions/{XBEN-ID}.json`
## Example Usage
```bash
# Debug a failed XBEN run
/debug-pentest /path/to/runs/XBEN-042-24 --xben XBEN-042-24
# After a failed grade
/grade-report XBEN-042-24 /path/to/report.md # Returns FAIL
/debug-pentest /path/to/runs/XBEN-042-24 --xben XBEN-042-24 # Find out why