T09 · Insecure Skill Coding Practices
- Location
SKILL.md:51- Finding
Database Credentials Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:51-65
Vulnerability Type: Credentials exposed in process arguments and shell history
Risk Level: MediumVulnerable Code
bash # PostgreSQL psql "postgresql://user:password@host:5432/dbname" -c "\dt" psql "postgresql://user:password@host:5432/dbname" -c "\d table_name" 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 documented commands place plaintext database passwords in command-line arguments. Depending on the shell and operating system, these values can be retained in shell history, captured by terminal or agent-execution logs, or observed through process-inspection interfaces while the command is running.
This behavior directly conflicts with the skill's stated safety rule that passwords must not be placed in history. Quoting a connection URI does not conceal it from shell history or process metadata.
Attack Path
- A user supplies valid PostgreSQL, MongoDB, or Redis credentials.
- The agent substitutes those credentials into one of the documented command examples.
- The command is executed with the plaintext password in its argument vector.
- A local user, monitoring utility, execution logger, or shell-history reader captures the command.
- The recovered credentials are reused to connect to the database.
Impact Assessment
An attacker can obtain the same database access granted to the exposed account. Depending on that account's privileges, this may allow disclosure of database contents, modification or d ...[truncated 186 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not place plaintext passwords in command-line arguments or literal connection URIs.
- Use protected client configuration mechanisms such as PostgreSQL
.pgpassorPGPASSFILE, MySQL login paths or restricted option files, MongoDB configuration files, and Redis ACL-aware protected configuration. - Prefer an interactive password prompt when automation is unnecessary.
- If environment variables are required, scope them to a single process and unset them immediately afterward; recognize that some execution environments may log environment values.
- Ensure credential files are owned by the executing user and have mode
0600. - Replace the examples with variable-based commands such as
psql "$DATABASE_URL"and explicitly instruct users never to paste secrets into recorded command lines. - Disable shell-history recording for unavoidable sensitive operations and ensure agent/tool telemetry redacts connection strings and password parameters.
- Use short-lived, least-privileged database credentials wherever supported.
