Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:0xSteph Pentest ai agents Least Aggressive First

From Leeroopedia
Knowledge Sources
Domains Reconnaissance, OPSEC, Security_Testing
Last Updated 2026-10-22 12:00 GMT

Overview

Command ordering discipline that defaults to the quieter, less intrusive option first (TCP connect before SYN scan, passive DNS before zone transfer) and escalates only when the quieter option is insufficient.

Description

The Least Aggressive First heuristic requires that Tier 2 agents compose commands starting from the least intrusive option that achieves the objective. Examples: use `-sT` (TCP connect) instead of `-sS` (SYN scan, requires root); use passive DNS queries before attempting zone transfers; use `curl -sI` (headers-only) before full page fetches; use `nmap -sn` (host discovery only) on large ranges before targeted port scans. The heuristic also requires including rate limits (`--min-rate 100 --max-rate 1000`) and timeouts (`--host-timeout 300s`) by default to prevent accidental denial of service. Commands should work without root by default; when root/sudo is required, the agent flags it explicitly and lets the operator decide.

Usage

Use this heuristic when composing any reconnaissance or scanning command against a target. It is embedded in the Scope Guard's Command Composition Rules and reinforced in each Tier 2 agent's Command Defaults section. Apply during both advisory mode (when recommending commands to the operator) and execution mode (when composing commands for Claude Code's permission gate). Especially important when scanning large ranges or fragile infrastructure where aggressive scanning can cause outages.

The Insight (Rule of Thumb)

  • Action: Default to the quieter, less intrusive option. Escalate only when the quieter option is insufficient.
  • Value:
    • nmap: `-sT` (TCP connect) over `-sS` (SYN scan) — SYN requires root
    • nmap: `--min-rate 100 --max-rate 1000` and `--host-timeout 300s` on all scans
    • nmap: `-sn` (host discovery) first on large ranges, then targeted port scans
    • dig: `+noall +answer` for clean output; check zone transfers early but separately
    • curl: `-sI` (headers-only) before full fetch; `--connect-timeout 10 --max-time 30`
    • netcat: `-w 5` timeout to avoid hanging; `-z` for port checks without sending data
  • Trade-off: Slightly slower than aggressive scanning; in exchange, lower detection risk and near-zero chance of accidental DoS.
  • Privilege rule: Compose commands that work without root by default. When root is required, flag it explicitly and explain why. Never run `sudo` without explaining why elevated privileges are needed.

Reasoning

Aggressive scanning can cause three problems: (1) it triggers IDS/IPS alerts, burning stealth; (2) it can overwhelm fragile targets (IoT devices, legacy servers), causing denial of service; and (3) SYN scans require root, which is an unnecessary privilege escalation for most reconnaissance tasks. Starting with the least aggressive option that achieves the objective minimizes all three risks. If the quieter option returns insufficient data (e.g., TCP connect scan misses filtered ports that SYN scan would show), the agent can escalate — but the escalation is a conscious decision, not the default.

Rate limiting prevents accidental DoS on targets with limited bandwidth or processing capacity. The `--host-timeout 300s` flag prevents nmap from hanging indefinitely on unresponsive hosts, which would stall the entire scan.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment