other
- Location
scripts/generate_runbook.py:206- Finding
Host-Wide Service and Network Reconnaissance Produces a Sensitive Inventory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill performs the host service inventory it advertises, with no hidden network transfer, credential access, or destructive behavior found.
Install only if you want an agent to inventory this host. Treat generated runbooks as sensitive because they can reveal services, ports, container names, images, mount names, and process details; keep reports out of public repos and shared folders, and use sudo only when you intentionally want broader port visibility.
scripts/generate_runbook.py:206Host-Wide Service and Network Reconnaissance Produces a Sensitive Inventory
The declared description presents a broad host-service inventory tool spanning Docker, init/system services, and network listening ports, with Markdown documentation output. The supplied code chunk is much narrower: it only interacts with the Docker CLI (docker info, docker ps) to enumerate running containers and returns structured JSON. There is no code for launchd/systemd inspection, port scanning, cron behavior, cross-platform service enumeration, or Markdown generation. This is a material description-versus-behavior mismatch because the implemented primary purpose is a Docker-only scanner, not a comprehensive machine-wide service/runbook generator.
The declared description presents a broad host-service inventory and documentation tool, but the supplied code chunk implements only a network port scanner for listening TCP sockets. While port scanning is one subset of the declared behavior, the primary claimed functionality—documenting Docker containers and system services and producing a Markdown runbook with richer metadata—is absent. The actual code's purpose is materially narrower than the declared purpose, so this is a clear description-behavior mismatch.
The implemented code is substantially narrower than the declared description. It uses launchctl list on macOS and systemctl list-units --type=service --state=running on Linux to enumerate running system services only. Its output is JSON, not a human-readable Markdown runbook. It does not query Docker, network sockets, container images, volume mounts, or health checks, and there is no code for scheduled execution. While the description mentions macOS and Linux service scanning, the broader declared purpose materially overstates the actual behavior.
The skill instructs the agent to use shell execution and write a runbook file, but it does not declare any explicit tool scope or permissions. That omission weakens policy enforcement and user transparency, increasing the chance the skill runs with broader host access than intended while collecting sensitive host inventory data.
The trigger phrases are broad enough to match common requests like 'what's running' or 'scan ports', which can cause the skill to activate in situations where the user did not clearly intend host enumeration. Because the skill gathers sensitive local infrastructure details, overbroad activation increases the risk of unnecessary reconnaissance and unintended disclosure.
The skill enumerates Docker containers, system services, open ports, images, mounts, PIDs, and health data, then writes them into a Markdown file, but the instructions omit a warning that this is sensitive host reconnaissance data. In context, this is especially dangerous because the output can expose internal topology, management ports, filesystem paths, and service metadata that could aid lateral movement or unauthorized access if shared or stored insecurely.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""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,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def docker_available():
try:
result = subprocess.run(
["docker", "info"],
capture_output=True,
timeout=5,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# Try --format json (Docker 20.10+)
try:
result = subprocess.run(
["docker", "ps", "--format", "{{json .}}"],
capture_output=True,
text=True,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# Fallback: plain docker ps
try:
result = subprocess.run(
["docker", "ps", "--no-trunc"],
capture_output=True,
text=True,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""Use lsof to find listening TCP ports."""
lsof = _find_lsof()
try:
result = subprocess.run(
[lsof, "-iTCP", "-sTCP:LISTEN", "-n", "-P"],
capture_output=True,
text=True,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def scan_linux():
"""Use ss to find listening TCP ports."""
try:
result = subprocess.run(
["ss", "-tlnp"],
capture_output=True,
text=True,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def scan_linux_netstat():
"""Fallback using netstat if ss is not available."""
try:
result = subprocess.run(
["netstat", "-tlnp"],
capture_output=True,
text=True,
The implementation materially underdelivers relative to the skill metadata, claiming broad host scanning and runbook generation while only enumerating launchd/systemd services and emitting JSON. This can create a false sense of coverage, causing users to rely on incomplete inventory data and overlook exposed ports, containers, mounts, or unhealthy services during security or operations workflows.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def scan_macos():
"""Use launchctl list to get running services."""
try:
result = subprocess.run(
["launchctl", "list"],
capture_output=True,
text=True,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def scan_linux():
"""Use systemctl to list running services."""
try:
result = subprocess.run(
[
"systemctl",
"list-units",