pikit: A Composable Toolkit for Indirect Prompt Injection Research and Evaluation
Zonghao Ying, Xiangfan Wu, Bo Yang, Huiyu Wu, Xing Zheng, Huangsheng Cheng, Xiaorong Shi, Jing Guo
Abstract
Indirect prompt injection embeds malicious instructions within external content retrieved by LLM-based agents, altering target behavior without user authorization. We introduce pikit, a research toolkit designed to systematically evaluate these threats across three core dimensions: attacks (13 methods), channels (16 carriers across text and file modes), and defenses (9 prevention strategies and 3 offline detection baselines). Built on a decorator-based registry, pikit enables seamless extension of custom components without modifying core code, while a unified craft() API composes arbitrary attacks and channels in a single call. We evaluated the toolkit on the pi coding agent powered by an anonymized LLM in a production-like environment. Benchmarking 9 prevention strategies against high-risk attacks yields a 71.8\% relative reduction in attack success rate, with few\shot\warning and instruction\hierarchy providing the strongest protection. Offline detection baselines achieve perfect precision but low recall, demonstrating that heuristic detectors complement rather than replace prompt-level defenses. To ensure reproducibility, each run automatically logs full prompts, agent event traces, session transcripts, and verdict records. Our code is available at https://github.com/Tencent/AI-Infra-Guard/tree/main/Research/pikit.
Create a lesson
Related papers
Passing the Test You Trained On: Re-evaluating Prompt-Injection Detectors for LLM Agents
Shared title terminologycs.CRZhuowen Liu
CounterSteer: Suppressing Indirect Prompt Injection with Activation Steering
Shared title terminologycs.CRMark Russinovich
CoDeL: Co-Evolutionary Defense against Indirect Prompt Injection in LLM-based Agents
Shared title terminologycs.CRXiao Yang, Yangchen Ou, Yuhan Gao et al.
AETHON: Deterministic Pre-Inference Defense for LLM Prompt Injection
Shared title terminologycs.CRLeonardo Bruscagini de Lima, Jorge Valverde-Rebaza, Alexandre de Barros Barreto et al.
Aligning Tool Descriptions and Implementations to Detect Prompt Injections in LLM Agents
Shared title terminologycs.CRJohnny Song, Shih-Chieh Dai, Guanhong Tao
Where Do LLMs Decide to Break the Rules? Mechanistic Localization of Prompt Injection Compliance
Shared title terminologycs.CRRui Wen, Jiayang Liu, Zeyu Yang et al.