T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
Gmail App Password Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:45-55; supporting implementation atscripts/download_gmail_attachments.py:47
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
bash python3 scripts/download_gmail_attachments.py \ --gmail-user "$GMAIL_USER" \ --gmail-pass "$GMAIL_PASS" \ --sender "auth@shove.xforceplus.com" \ --subject "发票" \ --since "01-Jan-2025" \ --extensions ".pdf,.ofd" \ --save-folder "~/Documents/walmart-invoices" \ --max-results 200The script explicitly accepts the credential as a command-line argument:
python parser.add_argument("--gmail-pass", default=os.environ.get("GMAIL_PASS", ""))Technical Analysis
The documented execution command expands
GMAIL_PASSand passes the resulting Gmail app password in the--gmail-passcommand-line argument. Although the secret is initially stored in an environment variable, shell expansion places its plaintext value in the Python process argument vector.Process arguments can be captured by local process-monitoring facilities, orchestration and observability systems, Agent tool-call logs, command histories generated by wrappers, diagnostic reports, or other software that records executed commands. The degree of local visibility depends on the operating-system configuration, but credentials should not be placed in arguments because command lines are commonly treated as non-secret operational metadata.
The network authentication itself is expected: the implementation sends the username and app password over an SSL connection to the fixed official endpoint
imap.gmail.com. The vulnerability is the local handling of the credential before authentication, not transmission to Gmail.Attack Path
- The user provides a Gmail app password or exports it as
GMAIL_PASS. - The Skill follows its documented invocation and expands the ...[truncated 1072 chars]
- The user provides a Gmail app password or exports it as
- Remediation
View remediation
Remediation Suggestions
- Remove
--gmail-passfrom all documented command examples. - Prefer a protected secret-input mechanism such as:
getpass.getpass()for interactive use;- an operating-system credential store or keyring;
- a narrowly scoped inherited file descriptor;
- a secret manager that does not inject the value into the command line.
- If environment-variable support must remain for automation, read
GMAIL_PASSonly inside the process and invoke the script without expanding it into an argument:bash GMAIL_USER="user@gmail.com" GMAIL_PASS="secret" \ python3 scripts/download_gmail_attachments.py \ --save-folder "~/Documents/gmail-attachments" - Deprecate and then remove the
--gmail-passparser option to prevent accidental exposure. - Ensure Agent execution logs, telemetry, crash reports, and error output redact Gmail credentials.
- Advise affected users to revoke and regenerate any app password that may already have appeared in process or execution logs.
- Remove
