Package Hallucination Attacks on Coding Agents through Prompt Injection in Rule Files
To bridge this gap, we introduce the package hallucination attack, where an attacker injects malicious prompts into benign rule files to induce coding agents to replace legitimate dependencies with attacker-controlled packages.
Key points
- Modern agentic coding frameworks increasingly rely on community-shared rule files (e.g., AGENTS.md or .cursorrules) to guide autonomous code generation, yet the security risks of this pipeline remain underexplored.
- To obtain effective malicious prompts injected into rule files, we propose PackHallu, an evolutionary optimization framework that iteratively rewrites these injected prompts using trajectory-level feedback and LLM-guided mutations.
- Evaluations across multiple benchmarks, LLMs, and agent frameworks show that PackHallu achieves high attack success rates and strong transferability across diverse models and agent combinations.
- Our findings demonstrate that coding agents are vulnerable to package hallucination attacks, highlighting the urgent need for stronger security safeguards in autonomous coding systems.
Sources (1)
- [1]Package Hallucination Attacks on Coding Agents through Prompt Injection in Rule FilesarXiv (AI, ML, NLP, CV, robotics, multi-agent) · Oct 7, 12:59 AM
To bridge this gap, we introduce the package hallucination attack, where an attacker injects malicious prompts into benign rule files to induce coding agents to replace legitimate dependencies with attacker-controlled packages.
Modern agentic coding frameworks increasingly rely on community-shared rule files (e.g., AGENTS.md or .cursorrules) to guide autonomous code generation, yet the security risks of this pipeline remain underexplored.
Extractive summary: sentences quoted from the sources.
Before this
- Oct 6, 2026AdvSim2Real : Training Web Agents Against Adaptive Prompt Injection in a Web World Model
- Oct 6, 2026Secure Speculative Decoding for Large Language Models
- Oct 6, 2026RAG-PIBench: A Leakage-Aware Benchmark for Prompt-Injection Detection in Trustworthy RAG Systems
- Sep 30, 2026Gemini 4 Argon: our next era of frontier intelligence
- Jun 24, 2026Introducing computer use in Gemini 3.5 Flash
- Jun 16, 2026Securing the future of AI agents