T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Database Credentials Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 40–49 and 64–70
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: HighVulnerable Code
bash # PostgreSQL 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;" # MongoDB mongosh "mongodb://user:password@host:27017/dbname" --eval "db.getCollectionNames()" mongosh "mongodb://user:password@host:27017/dbname" --eval "db.collection_name.countDocuments()" # Redis redis-cli -h host -p 6379 -a password INFO keyspace redis-cli -h host -p 6379 -a password DBSIZE redis-cli -h host -p 6379 -a password KEYS "*"Technical Analysis
The skill asks users to provide database credentials and demonstrates inserting passwords directly into command-line arguments. Secrets supplied this way can be disclosed through:
- Shell history files.
- Process inspection utilities and monitoring agents.
- Terminal session recordings.
- Agent transcripts and command logs.
- Error reports that capture complete command lines.
PostgreSQL and MongoDB connection URIs explicitly contain plaintext passwords. Redis commands use the
-aargument, which similarly places the password in the process argument list. This behavior contradicts the skill's own safety rule stating that passwords should not be placed in history. Merely using a connection string does not protect a secret if that string is passed directly as an argument.Attack Path
- A user supplies valid database credentials to the agent as requested by the skill.
- The agent substitutes those credentials into one of the documented commands.
- The command, including its plaintext password, is saved in shell history, agent logs, or process-monito ...[truncated 853 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all examples that embed passwords in command-line arguments or connection URIs.
- For PostgreSQL, use a permission-restricted
PGPASSFILEor.pgpassfile and pass only a password-free connection target. - For MySQL, use
mysql_config_editor, an appropriately protected option file, or an interactive password prompt. - For MongoDB, use an interactive password prompt or a protected configuration mechanism rather than embedding credentials in the URI.
- For Redis, prefer an interactive authentication workflow or a tightly scoped secret mechanism. If
REDISCLI_AUTHis used, set it only for the required process and clear it immediately afterward. - Ensure credential files are readable only by the owning user and are deleted securely when temporary.
- Redact passwords, authentication tokens, and complete credential-bearing URIs from agent output, command previews, logs, diagnostics, and errors.
- Add an explicit rule prohibiting direct substitution of secrets into shell commands, rather than suggesting that connection strings inherently avoid history exposure.
- Use least-privileged, short-lived database credentials and rotate any credential that may already have been used with the documented commands.
