other
Warning
- Location
- scripts/generate_runbook.py:206
- Finding
- Host-Wide Service and Network Reconnaissance Produces a Sensitive Inventory<![CDATA[ ## Vulnerability Details **File Location**: - `scripts/generate_runbook.py:28-46` - `scripts/generate_runbook.py:206-217` - `scripts/scan_docker.py:30-61` - `scripts/scan_services.py:16-53` - `scripts/scan_services.py:62-99` - `scripts/scan_ports.py:22-75` - `scripts/scan_ports.py:87-142` - `scripts/scan_ports.py:152-194` **Vulnerability Type**: `other: Excessive Host Reconnaissance` **Risk Level**: Medium The skill systematically collects Docker container details, running system services, listening network addresses and ports, process names, PIDs, images, container identifiers, and mount names. This behavior is consistent with the documented runbook-generation purpose, and no data exfiltration was identified. Nevertheless, the generated report is a consolidated, security-sensitive host inventory that could materially assist an attacker if exposed. ### Relevant Code Automatic scanner execution and optional persistence of the resulting report in `scripts/generate_runbook.py:28-46` and `scripts/generate_runbook.py:206-217`: ```python def run_scanner(script_name): """Run a scanner script and return its parsed JSON output.""" script = os.path.join(SCRIPTS_DIR, script_name) try: result = subprocess.run( [sys.executable, script], capture_output=True, text=True, timeout=30, ) if result.stdout.strip(): return json.loads(result.stdout) return {"error": result.stderr.strip() or "No output", "data": []} except subprocess.TimeoutExpired: return {"error": f"{script_name} timed out"} except json.JSONDecodeError as e: return {"error": f"JSON parse error: {e}"} except Exception as e: return {"error": str(e)} ``` ```python else: # Run all scanners inline print("Running scanners...", file=sys.stderr) docker_data = run_scanner("scan_docker.py") services_data = run_scanner("scan_services.py") ports_data = run_ ...[truncated 9235 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit user confirmation before performing a complete host-wide scan, particularly when it includes process ownership, PIDs, mounts, or Docker metadata. 2. Add independent command-line switches such as `--scan-docker`, `--scan-services`, and `--scan-ports`, and default to the minimum category requested by the user. 3. Minimize report contents by default: - Omit container IDs. - Redact mount information. - Exclude PIDs unless explicitly requested. - Consider omitting loopback-only listeners. - Normalize image references to avoid exposing private registry details. 4. Create output files with restrictive permissions. On POSIX systems, use an explicit mode equivalent to `0600`, or safely create the file with `os.open()` using `O_CREAT | O_WRONLY | O_TRUNC` and mode `0o600`. 5. Warn users that the generated runbook contains sensitive infrastructure information and should not be stored in public repositories, shared workspaces, or broadly readable directories. 6. Validate the destination path and optionally refuse symbolic links or non-regular files when writing reports in automated environments. 7. Avoid recommending elevated execution by default. Request `sudo` only after explicit user consent and only when privileged process visibility is essential. 8. Add configurable allowlists and exclusion filters so operators can suppress sensitive containers, services, addresses, and ports without modifying source code. 9. Consider separating collection from rendering and provide a redacted output profile suitable for routine or scheduled reports. ]]>
