T09 · Insecure Skill Coding Practices
Error
- Location
- script.py:10
- Finding
- Hard-Coded Gmail SMTP Credentials## Vulnerability Details **File Location**: `script.py`, lines 10-14 **Vulnerability Type**: Hard-coded authentication secret **Risk Level**: High ### Vulnerable Code ```python def send_email(to, subject, body, attachment_path=None, from_name="OpenClaw Bot", cc=None): # === SMTP Configuration === SMTP_SERVER = "smtp.gmail.com" # Gmail SMTP server SMTP_PORT = 587 # TLS port SENDER_EMAIL = "elodyzen@gmail.com" # Sender email SENDER_PASSWORD = "[REDACTED: hard-coded Gmail App Password]" # App password ``` The password value has been redacted from this report to avoid further credential exposure. The project source contains the complete plaintext credential. ### Technical Analysis A Gmail address and corresponding application password are embedded directly in the distributed Python source. Source-level secrets are available to every user, process, archive, repository, build system, or package registry with access to the skill. The credential is subsequently supplied to `server.login`, so it is an operational authentication secret rather than an example or unused configuration value. Transport encryption does not mitigate exposure at rest in the source package. ### Attack Path 1. An attacker downloads the skill package or obtains access to a copy of its source. 2. The attacker opens `script.py` and extracts the Gmail address and application password. 3. The attacker connects directly to Gmail SMTP at `smtp.gmail.com:587`. 4. The attacker authenticates using the exposed credentials. 5. The attacker sends unauthorized email independently of the skill and its intended controls. ### Impact Assessment Successful exploitation permits unauthorized use of the configured Gmail identity for outbound email. This can facilitate spam, phishing, impersonation, account reputation damage, service suspension, and consumption of provider quotas. The precise account scope depends on the p ...[truncated 234 chars]
- Remediation
- ## Remediation Suggestions 1. Revoke the exposed Gmail application password immediately and generate a replacement only if the integration remains necessary. 2. Remove all credentials from the source code and package history. 3. Obtain SMTP credentials at runtime from a protected secret manager or narrowly scoped environment variables. 4. Ensure secret values are excluded from logs, exception messages, version control, build artifacts, and published packages. 5. Use a dedicated service account with the minimum required permissions, sending limits, monitoring, and abuse alerts. 6. Add automated secret scanning to pre-commit hooks and CI/CD pipelines. 7. Review Gmail account activity for unauthorized authentication or email sent using the compromised credential.
