T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:49
- Finding
- Database Credentials Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md`, lines 49–51 **Vulnerability Type**: Credential exposure through process arguments and shell history **Risk Level**: High ### Vulnerable Code ```bash psql "postgresql://user:password@host:5432/dbname" -c "\dt" # list tables psql "postgresql://user:password@host:5432/dbname" -c "\d table_name" # describe table psql "postgresql://user:password@host:5432/dbname" -c "SELECT count(*) FROM table_name;" ``` Similar unsafe patterns also appear for MongoDB and Redis at lines 65–71, including a password in a MongoDB URI and the Redis `-a password` argument. ### Technical Analysis The documented commands instruct the agent to place database usernames and passwords directly in command-line arguments. If supplied credentials are substituted into these examples, they may become visible in shell history, process listings, terminal transcripts, agent execution logs, audit telemetry, or error reports. This behavior conflicts with the safety rule in the same file stating that passwords must not be placed in history. A connection string does not protect a password when the complete URI is passed as a literal command-line argument. Exploitation requires an attacker to have access to local process information, command history, execution logs, or another system that records agent commands. Once recovered, the credentials can be reused until they expire or are revoked. ### Attack Path 1. A user provides valid database credentials to the agent. 2. The agent substitutes those credentials into one of the documented command templates. 3. The command is executed with the plaintext password in its argument vector. 4. Shell history, process monitoring, terminal capture, or agent telemetry records the command. 5. An attacker with access to one of those sources extracts the credentials. 6. The attacker connects to the database and performs operations allowed by the compromised ac ...[truncated 632 chars]
- Remediation
- ## Remediation Suggestions - Remove examples that embed passwords in connection URIs or command-line options. - Use database-specific protected credential mechanisms: - PostgreSQL: a permission-restricted `.pgpass` file or interactive password prompt. - MySQL: `mysql_config_editor` and encrypted login paths. - MongoDB: an interactive password prompt or a protected configuration mechanism. - Redis: a protected configuration file or another client-supported mechanism that avoids exposing secrets in process arguments. - Set credential-file permissions to `0600` and delete temporary files immediately after use. - Disable command history for sensitive operations where feasible and prevent agent telemetry from recording secrets. - Redact credentials from commands, errors, transcripts, and audit logs. - Use short-lived, read-only credentials with access restricted to the required database and network source. - Add an explicit rule prohibiting literal credentials in both URLs and command-line options.
