T09 · Insecure Skill Coding Practices
- Location
assets/bt-skills/bt-website-troubleshoot/SKILL.md:116- Finding
Shell Command Injection and Credential Exposure in Database Diagnostics
- Content
View full analysis
/wp-config.php` → extract `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST`. - Other frameworks: search `.env`, `config/database.php`, `application/database.php`, etc. 2. `RunCommand/Bash: mysql -h -u -p -e "SELECT VERSION()"` → a successful connection returns the MySQL version; otherwise, inspect the error code in the next step. 3. If the connection fails, read the error code from the raw `mysql` client output and apply the following logic: - `2002` / `2003` → MySQL is not running. Proceed to service startup failure → MySQL. - `1045` → The password is incorrect. Compare `DB_PASSWORD` from the configuration with the `databases` table; report any discrepancy without automatically resetting the database password. - `1146` → A database table is missing. Use `RunCommand/Bash: mysql -h -u -p -e "SHOW TABLES"` / `DESC ` to confirm. - `1040` → Too many connections. Run `RunCommand/Bash: mysql -h -u -p -e "SHOW GLOBAL STATUS LIKE 'Threads_connected'; SHOW FULL PROCESSLIST"` to inspect connection counts and sources. ``` ### Technical Analysis The Skill directs the agent to read database connection fields from application-controlled files such as `wp-config.php` and `.env`, and then interpolate those values directly into a command executed through `RunCommand/Bash`. These fields are not guaranteed to be trustworthy. A compromised website, malicious repository, or attacker with write access ...[truncated 3067 chars]- Remediation
View remediation
