Skip to content

Scope and Safety

sm0k3net edited this page Nov 28, 2026 · 5 revisions

Scope and safety

dsh-redteam is built for authorized security testing. This page summarises what the plugin enforces, what the operator owns and where the line sits; the authoritative text is docs/SAFETY.md and SECURITY.md.

On this page: three authorities · safe mode versus DEFAULT · approvals · gated categories · scope matching · lifecycle · assurance surfaces · audit trail · evidence integrity · secrets and egress · operator responsibilities.

Only test systems you own or have written permission to test. Unauthorized access is a criminal offense in most jurisdictions. The safeguards are not a license.

Three authorities

Actor Can do Cannot do
Agent (51 tools) Record and read state, plan phases, run scoped tools, capture evidence, generate reports, propose a scope expansion Accept the RoE, switch mode, resolve its own approvals, replace the scope, approve its own proposal
Operator (panel) Accept the RoE, switch mode, resolve approvals, edit scope, install tools, close the engagement —
Filesystem Store state under $DSH_HOME/redteam/ Reach outside it through the plugin's file paths

The split is implemented in the Host, not in a prompt: acceptRoe, setMode and resolveApproval exist only as operator actions in the HTTP bridge, and the engine rejects every other actor.

Safe mode versus DEFAULT

Safe (opt-in) DEFAULT (default)
Recon, enumeration, vulnerability analysis runs directly runs directly
Exploitation, privesc, lateral, exfiltration, credential blocked pending an operator decision runs directly
Scope checks, audit, evidence, reporting always on always on
Who can switch operator only operator only

defaultMode seeds a new engagement and defaults to default; set defaultMode: safe to keep the approval gate on for new engagements. A stored engagement keeps its own mode, and every change is audited. Switching to DEFAULT does not disable scope enforcement, audit or the report disclaimer.

Approvals

A gated call creates a request only after the target passed the scope check, so an out-of-scope command never reaches the queue. The card shows tool, command, target, phase, rationale and impact.

Decision Effect
Approve once The call runs this time; status approved_once.
Approve for phase Grants that category for that phase; later calls skip the card.
Deny The call returns a denial; the agent is told not to retry in a loop.
No answer Expires after approvalTimeoutMs (default 5 minutes) and returns a denial.

Approvals never persist across engagements, are never granted automatically, and a canceled call expires.

Gated categories

The effective category is the more severe of the catalog category and any category the caller requested — a caller may raise it, never lower it, so an exploitation tool cannot be relabeled recon to dodge the gate. Categories: recon, enumeration, vulnerability, exploitation, privesc, lateral, exfiltration, credential, credential_dump, utility. Safe mode gates exploitation, privesc, lateral, exfiltration, credential and credential_dump.

Scope matching

Scope is { targets, cidrs, domains, exclusions } and is checked at the moment of action: tools resolve the target before approval or spawn, the browser checks launch and navigation, HTTP/API calls check the base URL, and OSINT requires an accepted RoE.

  1. Exclusions always win, even when another entry matches.
  2. A CIDR exclusion refuses overlap, not only a range fully inside it.
  3. Metadata endpoints are always blocked, even in scope: 169.254.169.254, 100.100.100.200, metadata.google.internal, metadata.google.com.
  4. Only http: and https: reach the browser and HTTP client; file:, data:, javascript:, chrome:, devtools: and view-source: are refused.
  5. An empty scope means no active testing, and a target with a port matches only that port.
  6. Top-level Document requests are intercepted, so a redirect cannot leave scope; blocked attempts are logged and subresources still load so real pages render.
  7. Expansion never widens authority by itself. An agent may propose a discovered host with pentest_scope + target: inside an authorized target/CIDR/domain root it is applied and audited with its discovering fact/evidence, outside every root it is a proposed entry that only the operator resolves in Scope & RoE. Exclusions and metadata endpoints are never expandable, and the RoE acceptance survives.
  8. Enrichment is passive and scope-checked. pentest_osint_enrich never scans or connects to the target; it refuses an out-of-scope target (out-of-scope) unless allowOutOfScope is explicit, requires a scope when osint.enforceOsintScope is on (scope-required), and caps CIDR sampling.

Engagement lifecycle

  • Stop kills active tool runs, interrupts tracked native agents, blocks the running phase and denies pending approvals; findings, evidence and the audit trail stay.
  • Restart from scratch archives the previous state and artifacts under $DSH_HOME/redteam/archives/<session>/<engagement>-<timestamp>/, keeps the scope, client and accepted RoE, and starts a new engagement id with no findings, tool runs, reports, plan or team board. Both actions are operator-only and audited.

Assurance surfaces

The assurance tools prove less, not more: they read stored state and never widen the authorization boundary.

  • Verification (pentest_verify) is evidence-only; it sends no request, does not consult a model and may only promote unverified → verified on a confirmed verdict.
  • Identity matrix (pentest_identity) is not credential storage. Only whitelisted account fields persist; passwords, tokens and keys are rejected or redacted. Changes need an accepted RoE.
  • OOB canaries (pentest_oob) are the one unauthenticated bridge route, because the target cannot authenticate: the unguessable token is the capability. The route answers only a 1×1 PNG, is rate-limited and body-capped, and tokens are redacted from snapshots, audit and bundles. A supplied target is checked against scope before creation.
  • Retest replay (pentest_retest) is the only re-send: confirm: true, one request, GET/HEAD/POST, HTTP(S) only, in-scope URL, destructive paths refused. Authentication headers are reused from the stored evidence and redacted in the record, and the finding is never set to exploited.
  • SARIF (pentest_sarif) is metadata only: no bodies, headers, tool output or excerpts; credential-shaped query values are scrubbed and the log is capped at 1000 results.
  • Planner and team are advisory state. Budget accounting never changes approval, scope or audit behavior; the critic is deterministic and cannot approve anything.

Audit trail

Append-only JSONL per session under $DSH_HOME/redteam/audit/, 0600. Recorded: engagement creation, scope changes, RoE acceptance, mode switches, phase changes, every tool run, approvals and denials, installs, report generation and evidence capture. The snapshot exposes a bounded tail (maxAuditTail, default 400); the file keeps everything. Every report carries an audit appendix and the engagement id, and says draft:true until closure.

Evidence integrity

  • Each capture is written once under $DSH_HOME/redteam/evidence/<session>/<id>/ with a per-record meta.json and a SHA-256 over the stored bytes.
  • Nothing overwrites a record; a session manifest and an append-only manifest.jsonl keep the index. The ZIP package adds manifest.json, a README.txt disclaimer and sha256sums.txt, so a third party can verify the hand-off without trusting the report.
  • Paths accepted by the vault and the bridge are resolved and must stay inside $DSH_HOME/redteam/.

Secrets and data egress

OSINT keys resolve from the DSH credential service, the environment, $DSH_HOME/osint-keys.env or the plugin's keys, and never reach the page, tools, audit trail or a report. Authorization, Proxy-Authorization, Cookie, Set-Cookie and X-Api-Key values are redacted from tool output, HTTP results and text evidence; token-like query values are masked in stored targets. Binary evidence is never rewritten; redaction is text-only and the record says which.

Path Leaves the machine? Control
Your target, during testing Yes, by definition Scope and RoE
OSINT lookups The query goes to the third-party service Configured keys; nothing else attached; osintAllowlist, leak approval and hourly budgets bound sensitive connectors
Passive enrichment The target goes to the OSINT connectors and to keyless DNS (PTR/NS/MX/TXT/RDAP/crt.sh) Only the target; no scan or connection to it; the scope guard runs first, CIDR samples are capped and osint.enrichmentDelayMs paces the providers
OOB canary hit Inbound only: the target calls the canary URL Unguessable token, TTL, rate limit, body cap; token redacted in state and bundles
AI wordlist generation Prompt to the Host's model route Category and instruction only by default; engagement context needs explicit consent, and secrets are redacted first
Telemetry No telemetry exists —
Reports and evidence Written locally only You decide what to hand over

Operator responsibilities

The plugin enforces authorization, not judgement. You still own: written authorization before the first packet; proportionality (non-destructive checks, sensible rates, no credential attacks on accounts you were not asked to test); data handling for evidence that may hold personal data or production secrets; third-party OSINT terms and quotas; and sending findings through the agreed channel.

Reporting a vulnerability in the plugin

Report a scope bypass, approval bypass, audit-tampering path, credential leak or bridge path-traversal privately per SECURITY.md, never in a public issue with a working exploit.

Related

Clone this wiki locally