T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Database Password Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 37
Vulnerability Type: Credential exposure through process arguments
Risk Level: MediumVulnerable Code:
bash # MySQL mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME -e "SHOW TABLES;"Technical Analysis
The MySQL password is expanded directly into the command-line argument vector through
-p$DB_PASS. Depending on the operating system and execution environment, command arguments can be observed through process inspection, shell tracing, CI/CD logs, audit records, terminal history, or monitoring software.Although the secret originates from an environment variable, expanding it into an argument removes much of the protection gained by keeping it out of the command itself. This issue does not independently create database privileges, but it can disclose credentials carrying all permissions assigned to
DB_USER.Attack Path
- An operator exports a valid database password as
DB_PASS. - The operator or agent runs the documented MySQL command.
- The shell expands
$DB_PASSinto the MySQL process arguments. - A local user, monitoring service, shell trace, or CI logging system captures the command line.
- The exposed username and password are reused to connect to the database.
- The attacker performs operations allowed by the compromised database account.
Impact Assessment
A successful disclosure grants access equivalent to the affected database account. Depending on its assigned permissions, this could permit reading sensitive records, modifying or deleting data, executing stored routines, or changing database configuration. The scope is limited by the privileges of
DB_USERand database network accessibility.- An operator exports a valid database password as
- Remediation
View remediation
Remediation Suggestions
- Do not provide passwords with the MySQL
-pPASSWORDcommand-line form. - Prefer
mysql_config_editorand an encrypted login path:bash mysql_config_editor set --login-path=db-test --host="$DB_HOST" --user="$DB_USER" --password mysql --login-path=db-test "$DB_NAME" -e "SHOW TABLES;" - Alternatively, use a temporary MySQL option file protected with mode
0600, and securely delete it after use. - Use an interactive password prompt where automation is not required.
- Disable shell tracing around secret-bearing operations and ensure CI systems mask database credentials.
- Provision a dedicated, least-privileged testing account and rotate any credential suspected of appearing in process or build logs.
- Do not provide passwords with the MySQL
