T09 · Insecure Skill Coding Practices
Error
- Location
- test-smtp.js:36
- Finding
- Hard-Coded SMTP Account Credential<![CDATA[ ## Vulnerability Details **File Location**: `test-smtp.js:36-37` **Vulnerability Type**: Hard-coded secret **Risk Level**: Critical ### Vulnerable Code ```javascript const user = '8@batype.com'; const pass = '960515@ss.com'; ``` ### Technical Analysis A plaintext SMTP username and password are embedded directly in an executable test script. Anyone able to obtain the project files, repository history, packaged Skill, backup, or build artifact can recover the credential without executing the code. The script actively supplies this credential to Nodemailer, so it is not merely example text. If the credential remains valid, it can potentially be used outside the Skill. ### Attack Path 1. An attacker obtains a copy of the project or reads `test-smtp.js`. 2. The attacker extracts the hard-coded username and password. 3. The attacker connects to the associated SMTP service. 4. If authentication succeeds, the attacker sends email as the account, distributes spam or phishing messages, or attempts related account access. 5. Abuse continues until the credential is revoked or rotated. ### Impact Assessment A successful attacker may gain authenticated access to the SMTP account and the ability to send messages under the account's identity. This can cause impersonation, phishing, reputation damage, provider suspension, and disclosure of any information exposed through the SMTP account. Because the credential has already been committed into project content, deleting only the current line is insufficient if repository history or previously distributed artifacts remain accessible. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Immediately revoke and rotate the exposed credential. 2. Review SMTP account activity for unauthorized authentication and sent messages. 3. Remove the secret from the current files and all repository history. 4. Invalidate previously published packages or artifacts containing the credential. 5. Load credentials from an operating-system secret manager or protected runtime environment. 6. Use a dedicated, least-privilege test account rather than a production mailbox. 7. Add automated secret scanning to CI and pre-commit checks. 8. Ensure test fixtures contain only clearly invalid placeholder values. ]]>
