HunterX v7 — Sprint 034.4 — Security & Tool Execution Certification

Phase: Final Release Gate — Phase 4 (Security & Tool Execution) Status: PASS (conditional — see Residual Risks) Date: 2026-08-11 Scope: src/hunterx (v7 package), tests/security, API control plane, tool SDK.

This document is the security certification report for the HunterX v7 platform. It follows the sprint brief sections 1–33. Every claim that a security capability is enforced is backed by a test or an explicit architectural guarantee; policy-only constructs are explicitly labelled POLICY, not enforcement.


1. Security Architecture Inventory

The security-sensitive surface is mapped below. For each component: trust boundary, inputs, outputs, authority, failure behavior, and controls.

Component Trust boundary Inputs Outputs Authority Failure behavior Controls
hunterx.security.manager.SecurityManager In-process authorization core actor, permission allow/deny, secret values policy roles fail-closed (default_deny=True) RBAC check before secret read
hunterx.security.policies.SecurityPolicy Pure policy data role→permissions map decision configuration fail-closed by default default-deny
hunterx.tools.sandbox.ToolSandboxPolicy Permission policy for tool descriptors descriptor, flag allow/raise platform flags fail-closed policy evaluation only
hunterx.tools.sdk.sandbox.ExecutionSandbox Execution-time isolation context, flags, secrets env, tempdirs, masked output context permissions + platform policy fail-closed permission enforcement, secret-gated env, masking, traversal-safe dirs
hunterx.infrastructure.sandbox.SubprocessSandbox Untrusted code boundary code string stdout caller timeout / SandboxError fresh interpreter + timeout ONLY (documented, not an OS sandbox)
hunterx.tools.recon.runner.BinaryRunner Subprocess seam (all adapters) argv, env, timeout bounded stdout/stderr, exit code operator-supplied tools ToolTimeoutError / ToolExecutionError structural argv, output cap, process-tree termination
hunterx.tools.*.adapters Tool execution context, target, params argv, normalized output SDK lifecycle ToolOutput.error typed build_argv, option-injection guards
hunterx.plugins.{manager,loader,permissions,sandbox} Plugin lifecycle manifest instances, permissions manifest + platform PluginLoadError / SandboxError entrypoint validation, permission policy, dependency order
hunterx.infrastructure.secrets / SecretsPort Secret store name value / raise caller with secrets.read SecretResolutionError env/in-memory adapters; masked display
hunterx.config.settings Load-time config env / YAML typed settings operator pydantic validation no secrets stored here
hunterx.domain.web.scope.WebScopeEnforcer Web crawl scope URL decision policy roots fail-closed scheme/host/path/extension gates
hunterx.engines.orchestration.scope.MissionScopeGuard Mission task scope identifier decision (recorded) mission scope fail-closed host/IP/CIDR containment, exclusions win
hunterx.engines.orchestration.{safety,executor} Mission execution plan, step outcome/records mission policies fail-closed (BLOCKED) scope+safety+rate gates before every task
hunterx.tools.parser.ParserEngine / normalizer Tool output boundary raw stdout records registered parsers ToolExecutionError data-only parsing, no code execution
hunterx.reporting.*, domain.reporting.redaction Report generation findings, evidence reports validation gates fail-closed export HTML escaping, redaction, integrity hashes
hunterx.api.* HTTP control plane HTTP requests JSON API key (opt-in) 401/403 when enabled; open when disabled opt-in API-key auth + coarse RBAC
hunterx.infrastructure.logging Log boundary log records JSON log lines LoggingManager best-effort masking sensitive-key deep-mask, correlation ids
hunterx.tools.tech.httpclient.HttpFetcher Outbound fetch boundary URL evidence caller empty evidence http/https scheme allow-list (SSRF-safe)

2. Threat Model

Threat actors and capabilities considered in this certification:

  1. Malicious target (the asset under test). Supplies hostile HTTP content, DNS answers, redirects, hostile filenames/archives, ANSI/terminal escapes.
  2. Malicious tool output — any external tool stdout/stderr treated as hostile.
  3. Malicious/compromised operator input — targets, parameters, config, plugin manifests that attempt injection.
  4. Malicious plugin — arbitrary Python loaded into the process.
  5. Local attacker on the API/CLI — an unauthenticated HTTP client.
  6. Supply-chain attacker — compromised dependencies or tool binaries.

Primary assets: mission scope integrity, evidence integrity, credentials, platform availability (no resource exhaustion), audit trail.

Threats enumerated and disposition:

Threat Disposition
Command injection via target Not possible: structural argv, no shell=True (verified AST scan + tests)
Argument/option injection (target becomes --flag) Fixed: positional guards on nmap/masscan/assetfinder/traceroute/whatweb; flag-value targets stay single argv elements
Shell metacharacters in args Inert data in argv (verified)
Scope bypass via normalization (case, ports, dots, userinfo, IDN, encodings) Fail-closed; verified in scope suite
Redirect scope escape Redirect targets must themselves be in scope; never widen (verified)
SSRF via fetcher to file:// etc. Scheme allow-list added (verified)
Oversized tool output (memory exhaustion) 32 MiB default cap; process terminated on overflow (verified)
Fork/process exhaustion / runaway process Wall-clock timeout kills process tree; parallel-job cap (verified)
Zip/decompression bombs No archive auto-extraction in the SDK; not reachable through tool pipeline (documented)
Malicious tool output → code execution Parsers are data-only; no eval/pickle/yaml.load (verified)
XML XXE / entity-expansion xml.etree.ElementTree does not resolve external entities or expand internal entities (verified)
Secret leakage (argv, logs, reports, API) Secrets only via env; masking/redaction tested incl. explicit failures
Log injection (CRLF/ANSI) JSON-escaped structured logging (verified)
Report injection (XSS/HTML/template) Escaping + data-driven templates (verified)
Plugin abuse (arbitrary code) Architectural limitation: plugins run in-process; only permission policy exists
PATH hijacking / tool binary replacement No integrity pinning; documented residual risk (operators control PATH)
API auth bypass Opt-in API-key auth; default open on loopback — documented residual risk
Evidence tampering Integrity hashes + provenance (verified in reporting suite)

3. Scope Enforcement


4. Target Normalization


5. Command Execution Security


6. Argument Injection


7. Process Isolation — POLICY vs ENFORCEMENT


8. Process Lifecycle


9. Resource Exhaustion

Resource Control Verified
stdout/stderr 32 MiB default per-execution cap; overflow terminates process yes
memory (subprocess capture) bounded chunked reads; overflow stops buffering yes
wall-clock runtime per-execution timeout (pipeline + runner) yes
concurrent tools ResourceManager semaphore (default 1; configurable) yes
queued missions ToolQueue/queue capacity yes
network connections tool-level rate limits (declared profiles) policy-level
CPU no per-process CPU cap at OS level (documented limitation) no
archives no auto-extraction in pipeline (documented) n/a

One hostile tool cannot exhaust the worker’s memory or wall-clock budget; CPU is only bounded by the wall-clock timeout (documented).


10. Tool Output Is Untrusted


11. Parser Security


12. Artifact Security


13. Secret Management


14. Secret Lifecycle

secret acquisition (SecretsPort) → authorized (SecurityManager) → prepare_environment (permission-gated) → child env HUNTERX_SECRET_* → tool process → captured output (masked copy for display; original preserved) → persistence (masked) → reporting (ReportRedactor).


15. API Security


16. CLI Security


17. Plugin Security


18. Tool Binary Trust


19. Dependency Security


20. SSRF / Callback Security


21. Network Egress


22. Evidence Integrity


23. Finding / PoC Security


24. Reporting Security


25. Logging Security


26. Audit Trail


27. Security Failure Modes

Control On failure Default
Scope service (mission) task BLOCKED (fail-closed) closed
Safety enforcer task BLOCKED closed
Empty scope deny (web) / requires-authorization (mission) closed
Sandbox permission SandboxErrorSANDBOX_VIOLATION closed
Binary start failure ToolExecutionError closed
Tool timeout ToolTimeoutError closed
Oversized output execution failed + process terminated closed
Parser failure ToolExecutionError closed
API auth (when enabled) 401/403 closed when enabled
Secret resolution SecretResolutionError closed
Database failure surfaced as infrastructure error documented
Missing binary/version dependency/health gate fails execution closed

28. Security Test Suite

Extended tests/security/ from 254 to 385 tests (+131) in new subpackages:

All coverage areas named in the brief (§28) are exercised.


29. Static Security Analysis


30. Security Regression

Full suite after changes (default -m 'not tools'):

Suite Result
tests/unit + tests/component + tests/architecture 2223 passed
tests/integration + tests/golden 422 passed, 7 skipped (external-service deps)
tests/security 385 passed
tests/acceptance 192 passed, 1 skipped
tests/engineering 91 passed
tests/performance 122 passed

No previous capability regressed.


31. Repairs Performed (this sprint)

  1. BinaryRunner (tools/recon/runner.py) — bounded output capture (32 MiB default), process-tree termination on timeout/overflow, typed start-failure handling, structural argv guarantee.
  2. Option-injection guardsguard_positional_target applied to nmap, masscan, assetfinder, traceroute, whatweb; guard_option_value helper.
  3. API authentication (opt-in)api/auth.py + ApiSettings (auth_enabled, api_key, read_only_key); middleware enforces X-API-Key + coarse RBAC (401/403).
  4. ExecutionSandbox temp/output dirs — tool/execution id components sanitized against traversal.
  5. HttpFetcher — http/https scheme allow-list (SSRF/file-read boundary).
  6. Documentation — SubprocessSandbox and plugin isolation explicitly classified as policy-only / architectural limitation.

32. Residual Risks (documented, not silently accepted as PASS)

# Risk Class Notes
R1 API unauthenticated by default (loopback) P1 Opt-in auth available and verified; deployers must enable it. API-layer rate limiting, CORS/security headers, per-endpoint audit absent.
R2 No OS-level sandbox for plugins / SubprocessSandbox P1 allowed_imports is policy, bypassable via __import__; plugins run arbitrary Python. Requires OS isolation for untrusted plugins.
R3 Tool binaries resolved via PATH without integrity pinning P2 PATH hijack/tampering not mitigated in-process.
R4 No CPU/rlimit per process; CPU bounded only by wall-clock timeout P2 Memory/time bounded; strict CPU budgeting requires OS enforcement.
R5 Report redactor is heuristic: short values and keyword-boundary keys (password2=) not redacted P3 Evidence layer remains protected; report content is operator-reviewed.
R6 SDK ExecutionEngine has no intrinsic scope gate (callers enforce) P3 Consistent with authorized-platform model; documented for integrators.
R7 Process-tree cleanup is best-effort (deep grandchildren on exotic platforms) P3 Group-kill covers standard cases.
R8 Interactsh/OAST callbacks are tool-level; no platform egress firewall P3 Default -no-interactsh; scope gates bound targets.

33. Finding Classification


34. Release Gate Checklist


35. Final Verdict

Sprint 034.4 — SECURITY & TOOL EXECUTION CERTIFICATION: PASS (conditional).

HunterX v7’s tool execution boundary is structurally safe against command and argument injection, treats all external output as hostile data, caps output and runtime resources, enforces scope before mission task execution, and keeps secrets out of argv/logs/reports. The subprocess seam now enforces output caps and process termination.

Two P1 risks remain by design and are mitigated rather than eliminated: the API control plane is unauthenticated by default (opt-in API-key auth + coarse RBAC now shipped and verified) and plugin/sandbox isolation is policy-based, not OS-enforced (explicitly documented as an architectural limitation with deployment-level mitigation). These are accepted for the release with the documented mitigations and operator guidance above.

No P0 or unresolved P1 security blocker remains. Release gate PASSES.