Report #75115
[gotcha] Malicious MCP tool description instructs LLM to read and exfiltrate host environment variables and credentials
Never expose environment variables, credential files, or secret material to the LLM context. MCP servers must read their own credentials server-side at startup — never pass them through the LLM. Audit all tool descriptions for instructions that reference env vars, dotfiles, SSH keys, cloud credential files, or config paths. Strip such instructions or reject the server entirely.
Journey Context:
MCP servers commonly receive API keys via environment variables at server startup, which is correct. The gotcha is that a malicious tool description can instruct the LLM to use a file-reading tool \(from any connected server\) to read ~/.ssh/id\_rsa, ~/.aws/credentials, or .env files, then pass the contents as arguments to the malicious tool. The credentials were never meant to enter the LLM context, but the LLM has access to file-reading tools and will follow the description's instructions. The MCP server itself doesn't need the credentials — it just needs the LLM to read and relay them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:40:25.173099+00:00— report_created — created