Back to skill

Security audit

Consul Service Deregister

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but it can perform live batch Consul deregistration and forward ACL tokens over unvalidated HTTP targets without strong confirmation or scoping.

Review before installing. Use only with trusted Consul agent addresses, prefer HTTPS, avoid passing ACL tokens on the command line, use narrowly scoped tokens, and require an explicit dry-run and human confirmation before any live batch deregistration.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/deregister.py:33
Finding
Consul ACL Token Can Be Sent to Arbitrary Destinations over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/deregister.py:33-49` **Additional Relevant Locations**: `scripts/deregister.py:86-88`, `scripts/deregister.py:103-110`; `SKILL.md:58-61`, `SKILL.md:91` **Vulnerability Type**: Unrestricted credential forwarding and plaintext transmission of sensitive authentication data **Risk Level**: High ### Vulnerable Code ```python def build_url(agent: str, service_id: str) -> str: if not agent.startswith("http"): agent = "http://" + agent return agent.rstrip("/") + CONSUL_DEREGISTER_PATH + service_id def deregister(agent: str, service_id: str, token: str = None, dry_run: bool = False) -> dict: url = build_url(agent, service_id) if dry_run: return {"agent": agent, "service_id": service_id, "url": url, "status": "DRY_RUN", "ok": True} try: req = urllib.request.Request(url, method="PUT") if token: req.add_header("X-Consul-Token", token) with urllib.request.urlopen(req, timeout=10) as resp: status = resp.status ok = status == 200 return {"agent": agent, "service_id": service_id, "url": url, "status": status, "ok": ok} ``` The affected destinations and token are accepted from user-controlled command-line inputs: ```python parser.add_argument("--agents-file", help="File with one agent address per line") parser.add_argument("--from-curl", help="Raw curl command(s) to parse and replay") parser.add_argument("--token", help="Consul ACL token (X-Consul-Token header)") ``` ```python if args.from_curl: parsed = parse_curl_commands(args.from_curl) if not parsed: print("❌ No valid consul deregister curl commands found in input.", file=sys.stderr) sys.exit(1) tasks = [(p["agent"], p["service_id"]) for p in parsed] else: if not args.service_id: parser.error("--service-id is required unless using --from-curl") agents = list(args.agents or []) if args.agents_file: ...[truncated 3111 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Require HTTPS when authentication is used** - Reject any `http://` destination whenever an ACL token is supplied. - Do not silently convert an address without a scheme to HTTP. - Prefer making HTTPS mandatory by default and require an explicit, prominently warned development-only option for plaintext operation. 2. **Restrict credential recipients** - Parse destinations using `urllib.parse.urlsplit()`. - Permit only the exact `https` scheme for authenticated requests. - Reject embedded credentials, fragments, malformed hosts, and unexpected ports. - Validate destination hostnames or IP addresses against an explicit operator-managed allowlist of approved Consul agents or trusted network ranges. - Resolve and validate hostnames carefully if restrictions are intended to prevent access to untrusted or internal destinations. 3. **Limit batch credential propagation** - Display the validated destination list before authenticated batch execution. - Require explicit confirmation before sending one token to multiple agents. - Consider using destination-specific credentials where operationally practical. 4. **Avoid command-line token exposure** - Read the token from a protected environment variable, restricted-permission file, standard input, or secret manager. - If backward compatibility requires `--token`, deprecate it and warn that command-line arguments can be exposed through process listings and logs. - Ensure tokens are never included in normal, JSON, exception, or debug output. 5. **Harden TLS behavior** - Retain certificate and hostname verification. - Support a configurable trusted CA bundle for private Consul deployments rather than disabling verification. - Document the expected certificate trust model and secure deployment procedure. 6. **Apply least-privilege ACL policies** - Use a narrowly scoped Consul token that authorizes only the service deregistration operati ...[truncated 508 chars]
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Lp3

Medium
Category
MCP Least Privilege
Confidence
97% confidence
Finding
The skill declares shell and network-capable behavior but does not constrain tool scope with explicit permissions or allowed-tools. In an agent environment, that means a natural-language trigger can cause live HTTP requests and command execution without clear guardrails, increasing the chance of unintended destructive actions or abuse if the skill is invoked in the wrong context.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger term "offline" is overly broad and can match many benign operational discussions unrelated to Consul deregistration. Because this skill performs irreversible service removal, accidental invocation could turn an informational conversation into live deregistration requests against production agents.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill documentation describes how to execute deregistration but does not prominently warn that it is a destructive, potentially irreversible action against live Consul agents. In this context, the absence of a strong warning lowers operator caution and raises the risk of production outages, especially since the skill supports batch and parallel execution across multiple nodes.

Static analysis

No suspicious patterns detected.