| name | pentest-workflow |
| description | Orchestrates PTES-aligned phases, gates, and subgates for pentest engagements. Each subgate links to a skill the agent must load and execute. Use when starting an engagement, advancing phases, completing subgates, or when the user asks about workflow, gates, checkpoints, or pentest methodology structure. |
Pentest Workflow: Phases, Gates, Subgates
Architecture
Phase (PTES macro)
└── Gate (exit criteria before next phase)
└── Subgates (atomic tasks)
└── Skill (agent loads and executes)
└── Agent (optional delegate)
└── Skill content (self-contained techniques)
Framework synthesis:
- PTES defines 7 macro phases (state machine)
- NIST SP 800-115 allows loopback: post_exploit -> recon when new scope found
- OWASP WSTG provides web analyze/recon subgates (web_app type)
- MITRE ATT&CK tags internal post-exploit subgates (internal_ad type)
- Unified Kill Chain tracks objective depth (In / Through / Out)
Full research: frameworks.md
Configuration files
| File | Purpose |
|---|
engagements/catalogs/phases.yaml | Phase definitions, gates, skill/agent routing |
engagements/catalogs/subgates-common.yaml | Pre-engage, model, exploit, report subgates |
engagements/catalogs/subgates-web-app.yaml | OWASP WSTG subgates |
engagements/catalogs/subgates-internal-ad.yaml | ATT&CK subgates |
engagements/{id}/phase-state.yaml | Current phase, completed subgates |
engagements/{id}/world-state.md | Human-readable action log + gate/subgate status |
engagements/{id}/world-state-index.json | Machine index for duplicate-action detection |
engagements/{id}/objectives.yaml | Engagement objectives with status |
engagements/{id}/targets.yaml | Prioritized targets (model phase) |
engagements/{id}/roe.yaml | ROE + engagement_type |
Phase overview
| Phase | PTES | Gate | Primary agent | Core skills |
|---|
| pre_engage | 1 | G0 (hard) | harness-orchestrator | msf-harness |
| recon | 2 | G1 | msf-recon-agent | msf-recon, hacktricks-methodology |
| model | 3 | G2 (hard) | harness-orchestrator | pentest-knowledge-base |
| analyze | 4 | G3 | msf-recon-agent | web-app-pentest OR internal-ad-pentest |
| exploit | 5 | G4 (hard) | msf-exploit-agent | msf-exploit-chain |
| post_exploit | 6 | G5 | msf-post-agent | msf-post, internal-ad-pentest |
| report | 7 | G6 (hard) | harness-orchestrator | pentest-knowledge-base |
Agent operating procedure
1. Read state
engagements/{engagement_id}/world-state.md
engagements/{engagement_id}/phase-state.yaml
engagements/{engagement_id}/roe.yaml
engagements/catalogs/phases.yaml
Initialize or refresh world state when starting work:
MSF MCP (preferred): No direct module. Use workflow scripts below.
CLI fallback:
python .cursor/skills/pentest-workflow/scripts/world-state.py init <engagement_id>
python .cursor/skills/pentest-workflow/scripts/world-state.py sync <engagement_id>
Hooks on shell and MCP calls will:
- Before execution: warn the agent if the same action fingerprint already exists
- After execution: append command/tool output to
world-state.md
2. Check gate and pending subgates
MSF MCP (preferred): No direct module. Use gate-check script.
CLI fallback:
python .cursor/skills/pentest-workflow/scripts/gate-check.py <engagement_id>
3. RPC connectivity subgate (SG0.2)
MSF MCP (preferred):
msf_status()
CLI fallback:
wsl -e bash -lc "msfconsole -q -x 'version; exit'"
Mark complete:
python .cursor/skills/pentest-workflow/scripts/complete-subgate.py SG0.2-rpc-check --engagement <engagement_id> --evidence "msf_status: connected"
4. Work subgates in order
For each PENDING subgate:
- Load the subgate's
skill (from catalog YAML)
- Execute the subgate
tasks using that skill's workflow
- Verify
exit_criteria
- Mark complete:
MSF MCP (preferred): No direct module. Use complete-subgate script.
CLI fallback:
python .cursor/skills/pentest-workflow/scripts/complete-subgate.py SG0.2-rpc-check --engagement <engagement_id> --evidence "msf_status: connected"
- Save evidence to
evidence/msf/ with subgate ID in filename when possible
5. Pre-exploit gates (SG4.1 and SG4.3 are SEPARATE subgates)
SG4.1: Reviewer Gate (approval by /msf-reviewer)
This is a security REVIEW, not a technical check. The /msf-reviewer agent reads scope,
ROE, and proposed action, then produces an APPROVED/DENIED/NEEDS_INFO verdict.
Completion evidence: evidence/msf/review-{engagement_id}-{date}.md with verdict APPROVED.
SG4.3: Module Vulnerability Check (technical probe)
This is the actual msf_module_check call that probes the target:
msf_module_check(
engagement_id="<id>",
module_type="exploit",
module_name="<module>",
options={"RHOSTS": "<target>"}
)
Parse the check_result:
- "vulnerable" -> proceed to exploit
- "safe" / "not vulnerable" -> STOP, do not exploit
- "cannot be determined" / "not supported" -> proceed with caution
Order: SG4.1 MUST complete before SG4.3. SG4.3 MUST complete before exploit.
Reviewer gate must pass before any msf_run_exploit call.
6. Advance phase
When all subgates pass and gate criteria met:
MSF MCP (preferred): No direct module. Use gate-check with advance flag.
CLI fallback:
python .cursor/skills/pentest-workflow/scripts/gate-check.py <engagement_id> --advance
Or update phase-state.yaml manually with phase_history entry.
7. Delegate to subagents
When subgate specifies an agent, delegate:
| Subgate agent | When |
|---|
/harness-orchestrator | Phase transitions, model, report |
/msf-recon-agent | Recon and analyze subgates |
/msf-exploit-agent | Exploit subgates (SG4.*) |
/msf-post-agent | Post-exploit subgates |
/msf-reviewer | SG4.1 reviewer gate (mandatory before exploit) |
Engagement types
| Type | Recon/analyze catalog | Post catalog |
|---|
web_app | subgates-web-app.yaml | minimal post |
internal_ad | subgates-internal-ad.yaml | full ATT&CK through |
hybrid | both (web first, then AD) | full |
external | internal_ad recon + hacktricks | scope-limited |
Set engagement_type in roe.yaml.
Loopback (NIST 800-115)
From post_exploit, if subgate SG-I-LOOPBACK finds new hosts/services:
- Increment
loopback_count in phase-state.yaml
- Set
current_phase: recon
- Add note to phase_history with reason
- Re-run recon subgates for new scope only
Hard gates (never skip)
| Gate | Requirement |
|---|
| G0 | Scope + ROE + RPC |
| G2 | targets.yaml + objectives.yaml |
| G4 | Reviewer approval + msf_module_check |
| G6 | Findings documented + sessions cleaned |
Subgate -> skill map (quick reference)
| Subgate prefix | Skill |
|---|
| SG0.* | msf-harness, pentest-workflow |
| SG-W-* | web-app-pentest |
| SG-I-RECON*, SG-I-AD* | hacktricks-methodology, internal-ad-pentest |
| SG-I-VULN*, SG-I-CRED-PATHS | msf-recon, internal-ad-pentest |
| SG2.* | pentest-knowledge-base, methodology-cheatsheets |
| SG4.* | msf-exploit-chain |
| SG-I-DISCOVERY..SG-I-DOMAIN | internal-ad-pentest, msf-post |
| SG-I-ADCS, SG-I-CVE | internal-ad-pentest |
| SG-I-PERSIST, SG-I-PIVOT, SG-I-EVASION | internal-ad-pentest |
| SG-I-CLOUD | cloud-pentest |
| SG-I-CONTAINERS | container-devops-pentest |
| SG-I-LINUX | linux-pentest |
| SG-I-MACOS | macos-pentest |
| SG-W-AI | ai-llm-pentest |
| SG6.* | pentest-knowledge-base, msf-post |
Output format (orchestrator)
When reporting workflow progress:
## Workflow Status
**Phase:** recon (Intelligence Gathering)
**Gate:** G1-recon-complete - BLOCKED
### Subgates
- [x] SG0.1-scope-verify (msf-harness)
- [ ] SG-I-RECON-PASSIVE (hacktricks-methodology) <- CURRENT
### Next action
Load hacktricks-methodology skill, run msf_host_info + service enum, save evidence/msf/recon-{date}.txt, then complete-subgate.
Related skills
pentest-knowledge-base - skill routing
web-app-pentest - OWASP/WSTG execution
internal-ad-pentest - AD/ATT&CK execution
hacktricks-methodology - Service pentest
cloud-pentest - AWS/Azure/IBM cloud abuse
container-devops-pentest - Docker/K8s/CI-CD
mobile-pentest - Android/iOS when in ROE
macos-pentest - macOS privesc and red teaming
linux-pentest - Linux privesc and post-ex
ai-llm-pentest - LLM prompt injection and AI MCP abuse
binary-exploit-pentest - Binary exploitation when ROE allows
methodology-cheatsheets - methodology and tool refs
msf-recon, msf-exploit-chain, msf-post - MCP tool workflows
msf-harness - Setup and safety