T09 · Insecure Skill Coding Practices
- Location
SKILL.md:52- Finding
Database Credentials Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 52–66
Vulnerability Type: Plaintext credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
bash # PostgreSQL psql "postgresql://user:password@host:5432/dbname" -c "\dt" # MongoDB mongosh "mongodb://user:password@host:27017/dbname" --eval "db.getCollectionNames()" # Redis redis-cli -h host -p 6379 -a password INFO keyspaceTechnical Analysis
The documented commands place database passwords directly in command-line arguments. When an agent substitutes real credentials into these examples, the secrets may be exposed through:
- Shell history files
- Process listings and process-monitoring utilities
- Terminal transcripts
- Agent tool-call logs
- Operating-system audit records
- CI/CD or orchestration logs
This conflicts with the safety rule in the same file that states passwords must not be placed in history. Moving an entire connection string into a normal environment variable does not necessarily eliminate exposure if the shell expands that variable into the child process's argument vector.
Attack Path
- A user supplies valid PostgreSQL, MongoDB, or Redis credentials to the agent.
- The agent follows the documented examples and inserts the credentials into a connection URI or password argument.
- The shell or execution environment records the resulting command, or exposes it through process metadata.
- A local user, monitoring service, log reader, or compromised process retrieves the plaintext credential.
- The attacker connects to the affected database using the exposed account.
- The attacker exercises all privileges assigned to that database account.
Impact Assessment
Successful exploitation grants access equivalent to the exposed database identity. Depending on the account's privileges, the attacker may be able to inspect schemas, read sensitive re ...[truncated 382 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all examples that place passwords directly in connection URIs or command-line password arguments.
- Use database-client credential facilities protected by filesystem permissions:
- PostgreSQL: use
PGPASSFILEor a.pgpassfile with mode0600. - MySQL: use
mysql_config_editorand an encrypted login path. - MongoDB: use an interactive password prompt or a protected client configuration file.
- Redis: use a protected configuration file, ACL-based credentials, or standard-input support where available.
- PostgreSQL: use
- If temporary credential files are required, create them with restrictive permissions, avoid predictable names, and securely remove them after use.
- Disable shell history for commands involving secrets and ensure agent execution logs redact connection strings, password flags, and credential-related environment variables.
- Use short-lived, narrowly scoped database credentials and rotate any credential that may already have appeared in execution logs.
- Update the safety instructions to clarify that ordinary environment-variable expansion into command arguments does not protect secrets from process inspection.
