T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:30
- Finding
- API Key Disclosure Through Terminal Output<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 30–33 **Vulnerability Type**: Credential exposure through plaintext terminal output **Risk Level**: High ### Vulnerable Code ```sh # Prefer the env var tripadvisor-mcp itself reads (check its .env first): grep -h TRIPADVISOR_API_KEY ~/git/tripadvisor-mcp/.env 2>/dev/null export TRIPADVISOR_API_KEY='...' ``` ### Technical Analysis The documented setup command reads `TRIPADVISOR_API_KEY` from another project's `.env` file and writes the complete matching line to standard output. Accessing an existing key may support the declared API-query functionality, but printing its value is unnecessary and exceeds minimum disclosure requirements. Terminal output may be retained in agent transcripts, command logs, CI logs, terminal scrollback, screen recordings, or support diagnostics. The fixed path also causes the Skill to inspect a credential-bearing file outside its own project directory without first obtaining explicit confirmation from the user. Redirecting errors to `/dev/null` does not protect the key because successful output remains visible. The command may also print duplicate definitions or additional text appearing on any line containing the variable name. ### Attack Path 1. A user or agent follows the documented one-time setup instructions. 2. The `grep` command reads `~/git/tripadvisor-mcp/.env`. 3. The matching line, including the plaintext API key, is printed to standard output. 4. The output is captured in an agent transcript, terminal log, CI output, screen share, or another observable channel. 5. A party with access to that channel extracts the key. 6. The exposed key is used to make requests against the TripAdvisor Terra API until it is revoked or its quota is exhausted. ### Impact Assessment An attacker obtaining the key can exercise the Terra API permissions associated with that credential. Based on the audited documentation, the API operations are read-only, so this does n ...[truncated 368 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not print or otherwise return the API key through agent-visible output. - Ask the user to configure the environment variable independently through an approved secret manager or shell configuration. - If loading the existing `.env` file is required, obtain explicit user approval and import it without displaying its contents: ```sh if [ -f "$HOME/git/tripadvisor-mcp/.env" ]; then set -a . "$HOME/git/tripadvisor-mcp/.env" set +a fi test -n "${TRIPADVISOR_API_KEY:-}" || printf '%s\n' 'TRIPADVISOR_API_KEY is not configured.' >&2 ``` - Before sourcing a file, verify that it is a regular file owned by the current user and is not writable by other users. - Prefer a dedicated secret manager over sourcing arbitrary `.env` content. - Never echo the variable, include it in generated reports, or enable shell tracing while it is being loaded. - Revoke and rotate any key that has already appeared in retained logs or transcripts. ]]>
