T09 · Insecure Skill Coding Practices
- Location
msmtprc.md:2- Finding
Plaintext SMTP Application Password Storage Without Required File-Permission Hardening
- Content
View full analysis
Vulnerability Details
File Location:
msmtprc.md, lines 2 and 13
Vulnerability Type: Plaintext credential storage and insecure configuration guidance
Risk Level: MediumVulnerable Code
text # Fill out your details and place this file in ~/.msmtprctext password abcd efgh ijkl mnop # Use the password from https://myaccount.google.com/apppasswordsTechnical Analysis
The configuration template directs users to replace a placeholder with a Gmail application password and store it directly in
~/.msmtprc. Storing an authentication secret in plaintext creates a credential-exposure risk. The documentation also does not require restrictive permissions such as mode0600or verify that the file is owned by the intended user.Consequently, a real application password may become accessible through permissive file permissions, local access by another account, insecure backups, or accidental inclusion in version control. This finding concerns the documented credential-handling pattern; the audited template itself contains only a placeholder, not a confirmed live credential.
Attack Path
- A user copies the template to
~/.msmtprc. - The user replaces the sample value with a valid Gmail application password.
- The file remains readable by unintended local users, is copied into an insecure backup, or is accidentally committed to a repository.
- An attacker obtains the plaintext application password from the exposed file or copy.
- The attacker authenticates to Gmail's SMTP service using the compromised account and application password.
- The attacker sends unauthorized email within the permissions and restrictions associated with that application password.
Impact Assessment
Successful exploitation can disclose the configured Gmail application's SMTP credential. An attacker may send email as the affected account, enabling impersonation, spam, phishing, reputational ...[truncated 396 chars]
- A user copies the template to
- Remediation
View remediation
Remediation Suggestions
- Prefer retrieving the password from an operating-system keyring or dedicated secret manager through msmtp's
passwordevaldirective instead of embedding it in the configuration file. - If file-based storage is unavoidable, explicitly require restrictive ownership and permissions:
bash chown "$USER":"$(id -gn)" ~/.msmtprc chmod 600 ~/.msmtprc - Add setup-time validation that rejects configuration files readable or writable by group or other users.
- Clearly identify the displayed password as a non-secret placeholder and warn users never to commit a populated
.msmtprcto version control. - Exclude credential-bearing configuration files from backups unless the backups are encrypted and access-controlled.
- Rotate the Gmail application password immediately if the populated file is exposed, committed, or copied to an untrusted location.
- Prefer retrieving the password from an operating-system keyring or dedicated secret manager through msmtp's
