T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_unseen.py:16- Finding
Credential Redirection Through Independently Overridable IMAP Host
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Gmail digest skill mostly does what it says, but its credential handling can redirect stored email credentials to a host chosen by environment variables.
Review this before installing. Use a narrowly scoped Gmail app password, prefer environment variables over the config file, avoid setting IMAP_HOST unless you fully trust the server, and do not store the config file in a shared or synced location. Treat email content in summaries as untrusted because an email sender can put instructions in the message body.
scripts/fetch_unseen.py:16Credential Redirection Through Independently Overridable IMAP Host
SKILL.md:44Plaintext Credential File Is Documented Without Permission Enforcement
scripts/fetch_unseen.py:126Untrusted Email Content Is Passed to the Agent Without Prompt-Injection Isolation
The declared purpose says the skill sends a digest, but the documented workflow includes fetching full unread email bodies, reading credentials from disk or environment, and returning raw JSON from the script. This mismatch is security-significant because it masks broader data access than the user-facing description implies, increasing the chance of over-collection and unintended disclosure of sensitive email contents.
The workflow and output rules require the digest and summaries to be produced in Chinese, including a mandatory translation of email body summaries. This is a language-policy constraint applied without user opt-in or any documented regional justification.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
5. If result is empty, send: 📭 近两日暂无未读邮件
## Output Rules
- Send the digest message ONLY. Do NOT add any extra comments, greetings, explanations, or follow-up questions before or after the digest.
- Do NOT say things like "主人,以下是您的邮件摘要" or "如需了解详情请告知" etc.
- The digest message itself is the complete and final response.
The skill requires access to environment variables, local files, and the network to read Gmail credentials and connect to an IMAP server, but it does not declare any explicit tool scope or allowed-tools boundary. That omission weakens reviewability and containment because a caller cannot easily verify what capabilities the skill is expected to exercise before running it.
Broad trigger phrases like 'check my Gmail' or 'summarize my emails' can overlap with ordinary conversation and cause the skill to activate in contexts where the user did not intend credentialed mailbox access. Because this skill reads private email through IMAP, accidental invocation materially raises privacy and consent risks.
The script reads sensitive credentials from environment variables and later uses them to authenticate to Gmail and fetch message content. Although the module docstring says it fetches unread Gmail, there is no explicit warning, prompt, or user-facing notice that credentials will be used and email body data will be transmitted and processed.
When environment variables are not present, the script loads a config file and reads IMAP username and password fields. This is sensitive credential access, but the code provides no confirmation, warning, or user-facing disclosure beyond an internal comment.