T09 · Insecure Skill Coding Practices
- Location
move_to_exports.py:8- Finding
Hard-Coded Yahoo Mail App Password
- Content
View full analysis
Vulnerability Details
File Location:
move_to_exports.py, lines 8-23
Vulnerability Type: Hard-coded authentication credential
Risk Level: HighVulnerable Code
python HOST = "imap.mail.yahoo.com" # EDIT THIS: Your Yahoo Mail email address EMAIL = "your-email@yahoo.com" PASS = "zgvpnfymmwxebpof" EXPORT_FOLDERS = ["export1", "export2", "export3"] BATCH = 1000 # messages per MOVE call def count(m, folder): typ, data = m.status(f'"{folder}"', '(MESSAGES)') if typ == 'OK' and data: match = re.search(r'MESSAGES (\d+)', str(data)) if match: return int(match.group(1)) return 0 m = imaplib.IMAP4_SSL(HOST, 993) m.login(EMAIL, PASS)Technical Analysis
The script embeds a Yahoo-style app password directly in source code. Anyone who can read the distributed package, repository, backup, build artifact, or source history can recover the credential without accessing a dedicated secret store.
The password is supplied to Yahoo through an encrypted IMAP connection, so this is not evidence of covert exfiltration or plaintext network transmission. The vulnerability is the credential's exposure at rest in source code. Although the included account address is a placeholder, the credential could still be abused if an attacker identifies its associated account through repository history, logs, other configuration, or credential reuse.
Attack Path
- An attacker obtains a copy of the project or its source history.
- The attacker reads
move_to_exports.pyand extracts the embedded password. - The attacker identifies the corresponding Yahoo address from related configuration, logs, documentation, or prior revisions.
- The attacker attempts authentication against Yahoo Mail using the exposed app password.
- If the credential remains active, the attacker can exercise the mailbox permissions granted to that app password.
Impact Assessment
Successful ...[truncated 432 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed Yahoo app password immediately.
- Remove the credential from the current source and all repository history.
- Load credentials from a protected environment variable or operating-system secret store:
python EMAIL = os.environ["YAHOO_EMAIL"] password = os.environ["YAHOO_PASSWORD"] - Fail closed when either variable is absent; do not provide literal credential fallbacks.
- Restrict secret-file permissions if environment injection is performed through a file.
- Add automated secret scanning to pre-commit and CI workflows.
- Review Yahoo account access history for unauthorized sessions.
