Skip to content

Exploitation

sm0k3net edited this page Nov 28, 2026 · 1 revision

Exploitation loop

Exploitation is not one command. lib/host/exploitation.js defines a deterministic, bounded loop that turns a hypothesis into candidates, one least-impact attempt per round, a classification of the real result and a decision about what to do next. The module never executes anything: the engine persists the loop, execution stays with pentest_exec, and pentest_exploitation is the agent-facing surface. The methodology reference is docs/EXPLOITATION.md.

On this page

  • Caps and gates
  • The ten stages
  • Candidate sources
  • Running the loop
  • Reading an attempt
  • Evidence contract
  • Delegation and verification

Caps and gates

A plan requires an accepted RoE, an active engagement and the exploitation phase. A record requires a plan. Nothing in the loop widens scope or bypasses an approval.

Limit Default Maximum
Rounds 6 12
Attempts per candidate 3 5
Candidates per plan — 20
History entries summarized — 100
Redacted excerpt 600 chars 600 chars

A caller may lower a limit but never raise it beyond the cap; out-of-range values are rejected. Targets are scope-checked before a plan exists, and cloud-metadata endpoints are always refused.

The ten stages

# Stage What happens
1 Identify candidate searchsploit, Exploit-DB, CVE/NVD, Metasploit, nuclei or NSE
2 Baseline behavior One benign probe of the target's normal response
3 Attempt One least-impact variant; check/verify first
4 Observe Classify the real output (exit code, stdout, stderr, timeout)
5 Compare Diff the attempt against the baseline
6 Adapt Change exactly one payload, option or prerequisite
7 Retry Bounded per-candidate retry, never the identical command
8 Pivot Next candidate or vector when the budget is spent
9 Custom Derive the smallest proof, lab first, review and hash
10 Confirm Reproduce once and link the finding and evidence

Candidate sources

plan accepts candidates from searchsploit/exploit-db, cve, metasploit, nuclei, nmap-nse, sqlmap, hydra, smbclient, impacket and manual/custom, plus a searchsploitQuery for a product and version. A destructive: true candidate is rejected and a non-HTTP reference is dropped.

plan also returns toolGuidance: the safe pattern per tool, for example metasploit → search → use → show options → check, sqlmap → --level 2 --risk 1 --technique BEU --threads 1, hydra → one authorized pair with -t 1. The engine's category gate stays authoritative: a cataloged exploitation tool blocks on approval in Safe mode even when the first command is only a local search.

Running the loop

pentest_exploitation { action: "plan", target: "https://lab.example.test",
  service: "Example App", version: "1.4.2", cve: "CVE-2025-12345",
  candidates: [{ source: "exploit-db", id: "EDB-12345" }], maxRounds: 6 }

pentest_exploitation { action: "record", actionName: "attempt",
  round: 1, tool: "metasploit-framework", exitCode: 0,
  stdout: "session 1 opened", evidenceIds: ["ev_..."] }

pentest_exploitation { action: "status" }
pentest_exploitation { action: "delegate", target: "https://lab.example.test" }

record appends one real observation, classifies it and returns next — the recommended action and whether the loop stops. status is read-only. delegate returns the researcher, operator and verifier task payloads with disjoint write scopes.

Reading an attempt

Outcome Meaning Next action
success Strong marker such as session N opened or uid=0(root) Confirm and reproduce
partial A signal but not a full proof Adapt or confirm one step
no-effect / failed Target behaved normally, or the tool could not reach it Adapt after diagnosis
inconclusive No usable signal Adapt with a narrower check
timeout, unstable, detected The target or network is at risk Stop
denied, approval-pending No operator authorization Stop and ask the operator
blocked-scope Out of scope Stop
missing-tool Binary absent (127) Install it and resume

A success is never reported as exploited from one attempt: the loop asks for a confirmation run and only stops with proven after the reproduction. Terminal reasons include exploitation-proven, confirmation-failed, max-rounds, candidate-budget-exhausted, operator-denied, out-of-scope, detection-risk, timed-out and no-candidate.

Evidence contract

Every round must leave enough to reproduce it:

  • exact argv (array, never a shell string), tool and round number;
  • real exit code, duration and a redacted stdout/stderr excerpt;
  • the classification and the signals behind it;
  • baseline versus attempt comparison;
  • the evidence id and the finding it supports;
  • for a custom proof, a separate operator approval, the advisory/version match, lab output and a code/diff hash;
  • for a confirmation, a second run with the same least-impact proof and a second evidence id.

Never store bulk customer data, cleartext credentials, fabricated output or a replayed command. Report a missing tool as missing instead of silently skipping the check.

Delegation and verification

The loop plugs into the same planner and team surfaces as everything else. delegate returns three roles — exploit-researcher, exploit-operator, exploit-verifier — with writeScopes under deliverables/exploitation/, dependency order and maxParallel: 2 (one operator attempt at a time). The verifier is independent and never approves its own run.

Exploitation proof is closed by other tools, not asserted here:

  • pentest_verify is evidence-only and may promote unverified → verified on a confirmed verdict; it never sets exploited.
  • pentest_retest replays one stored request with confirm: true and records fixed, still-vulnerable or inconclusive; it never sets exploited either.
  • pentest_sarif exports the resulting findings for CI; it is metadata only.

Related

Clone this wiki locally