Malicious AGENTS.md Files Can Hijack Coding Agents
Forever Security reports finding a malicious AGENTS.md file in a customer’s Downloads folder containing instructions to deploy malware and exfiltrate session tokens. Defensive systems prevented meaningful damage. In isolated tests, the researchers said malicious AGENTS.md instructions induced OpenAI Codex to execute attack steps in more than 90% of trials, while malicious CLAUDE.md files changed API-related settings in about 50% of Claude Code trials. They characterized the behavior as a consequence of agents’ instruction-following features rather than a patchable software bug.
Malicious instruction files can exploit coding agents’ access to settings, MCP servers, package installation and command execution. Forever Security recommends treating download folders as untrusted, inspecting agent instruction files, monitoring configuration changes and unusual commands, and keeping approval gates and sandboxes enabled.
資安業者Forever Security近日揭露一起利用惡意Markdown檔案攻擊AI程式開發代理的事件。研究人員在客戶電腦的下載資料夾發現惡意AGENTS.md檔案,攻擊者企圖誘使OpenAI Codex修改設定並安裝名為function-color的惡意NPM套件,但資安防護系統阻止了套件安裝。AGENTS.md是供AI程式開發代理讀取的Markdown指引檔,攻擊者將惡意指令藏入其中。
惡意AGENTS.md要求Codex修改全機設定,註冊攻擊者指定的MCP(Model Context Protocol)伺服器,並透過伺服器啟動命令安裝惡意套件,同時企圖略過操作核准及沙箱限制。研究人員在隔離環境重現攻擊,超過90%的測試成功誘使Codex執行攻擊指令。研究人員也針對Anthropic Claude Code進行測試,發現惡意CLAUDE.md指引檔可能誘使代理修改API連線設定,造成OAuth權杖外洩,約50%的測試成功修改相關設定。
Forever Security建議企業避免在下載資料夾等不可信任的位置啟動AI代理,並檢查AGENTS.md、CLAUDE.md等指引檔的來源與內容,同時監控代理設定是否出現非預期變更,以及代理是否執行異常命令。若發現權杖可能外洩,也應進一步調查並撤銷或輪替相關權杖。
#Forever Security#OpenAI Codex#Claude Code#function-color#AGENTS.md#CLAUDE.md#Model Context Protocol