T09 · Insecure Skill Coding Practices
- Location
SKILL.md:248- Finding
Public TCP Tunneling of Sensitive Database Services Without Mandatory Safeguards
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 248–253
Vulnerability Type: Public exposure of sensitive local services
Risk Level: HighVulnerable Code Snippet
text ### 3. TCP Tunnel (Database)- Read auth_token from config
- create_tunnel(token, local_port=5432, protocol="tcp")
- Return tcp://host:port for connection
- close_tunnel(token, tunnel_id) when done
text Technical Analysis
The documented workflow instructs the agent to expose a local PostgreSQL port through a publicly reachable TCP tunnel. The Skill also explicitly identifies PostgreSQL and Redis as intended tunneling targets. However, it does not require the agent to verify that the target service uses strong authentication, encrypted transport, source-address restrictions, or a least-privilege database account.
The workflow does not require explicit user confirmation immediately before exposing a sensitive TCP service. It also lacks a mandatory expiration time or a guaranteed cleanup mechanism if the normal
close_tunnelstep is interrupted. Possession or discovery of the resulting public endpoint may therefore give remote parties direct network access to the local service.The tunnel does not inherently create a database vulnerability, but it can remove the network isolation on which a local database configuration may depend. Local services are frequently configured with weaker controls because they are expected to be reachable only from localhost.
Attack Path
- A user or agent follows the documented TCP database workflow.
- The agent invokes
create_tunnelfor local port5432or another sensitive service port. - Rustunnel creates a publicly reachable TCP endpoint connected to the local database.
- The endpoint is disclosed, leaked through logs or conversation history, or otherwise discovered by an attacker.
- The attacker connects to the database through the tunnel.
- If the database ...[truncated 1111 chars]
- Remediation
View remediation
Remediation Suggestions
- Deny tunneling of sensitive ports such as PostgreSQL
5432, Redis6379, MySQL3306, SSH22, and administrative interfaces by default. - Require explicit, informed user confirmation immediately before creating any TCP tunnel to a sensitive service.
- Before exposure, verify that the service enforces strong authentication and does not use default, blank, or trust-based credentials.
- Require transport encryption at the application layer where supported, especially for databases.
- Use a dedicated least-privilege service account with narrowly scoped permissions.
- Prefer tunnels that support source-IP allowlisting or an authenticated access gateway rather than unrestricted public TCP endpoints.
- Assign a short automatic expiration time and guarantee cleanup through a
finally-style lifecycle mechanism. - Avoid printing full sensitive endpoints into persistent logs or broadly visible conversation history.
- Display a clear warning describing the public exposure scope before returning the endpoint.
- Prefer private networking, VPN access, or SSH forwarding for database administration.
- Deny tunneling of sensitive ports such as PostgreSQL
