This paper introduces a new attack called package hallucination, where an attacker injects a malicious prompt into a shared rule file (like AGENTS.md) used by . When a developer downloads and uses that rule file, the agent is tricked into replacing a legitimate software dependency with an attacker-controlled package from PyPI. This can lead to data theft or other security breaches.
The authors propose PackHallu, an evolutionary framework that optimizes the malicious prompt without needing access to the victim agent. It works by using a local surrogate agent and refining prompts based on the agent's reasoning trajectory. Experiments across 8 agent frameworks and 13 LLMs show high success rates, and the attacks often transfer between different systems. The work reveals a serious security gap in the current ecosystem of shared coding rule files.