Tool-integrated large language model (LLM) agents enable functionalities such as accessing information, managing databases, and sending emails. Because many third-party tools come from untrusted online sources, attackers can exploit tool interactions to launch prompt injection attacks via tools, potentially causing harm through harmful code execution. In this work, we propose a defense that detects prompt injection attacks by comparing tool descriptions with summaries of their corresponding code. To evaluate our approach, we constructed a dataset of 503 tool examples, consisting of 377 prompt injected and 126 benign tools collected and adapted from open-source repositories and existing benchmarks. We evaluate our method across five LLMs and compared its performance against existing prompt injection defenses such as PromptArmor, DataSentinel, LLM-Based Detection, and Perplexity Filter. The experimental results show that our method achieves an overall detection accuracy of 93.8\%. This work highlights the potential benefits of implementing a description and implementation consistency verification as an additional security mechanism for LLM agents in a tool-integrated environment.
翻译:暂无翻译