Security researchers have warned that API keys stored in .env files pose significant risks, as they can be exploited to turn AI agents into "insider threats." If these keys are exposed, attackers can perform unauthorized actions through the AI, potentially leading to massive data leaks or unauthorized service usage.
Recent studies have also highlighted specific vulnerabilities within the Model Context Protocol (MCP), a standard designed to allow AI models to access external tools and data. Research into "Tool Poisoning" attacks suggests that malicious instructions can manipulate MCP servers, causing them to execute unintended commands or leak sensitive information. Additionally, the "confused deputy" problem remains a concern, where an AI agent might be tricked into using its legitimate permissions to perform actions on behalf of an attacker.
To mitigate these risks, experts recommend implementing strict secret management practices, such as using dedicated vault services instead of plain-text .env files, and adopting more robust authentication frameworks like OAuth to control agent permissions.
Sources:
- その.envのAPIキーが、AIエージェントを「内通者」に変える――“人間前提のやり方”は破綻した (ITmedia AI+, 2026-09-15)