Abstract: We present an experimental evaluation that assesses the robustness of four open source LLMs claiming function-calling capabilities against three different attacks, and we measure the effectiveness of eight different defences. Our results show how these models are not safe by default, and how the defences are not yet employable in real-world scenarios.
TL;DR
Function-calling LLMs are increasingly used as autonomous agents, but they are far from "secure by default." This paper demonstrates that open-source models are highly vulnerable to prompt injection and tool poisoning—including a novel "Renaming Tool Poisoning" attack—and reveals that current defense mechanisms often suffer from high false-positive rates that make them impractical for real-world deployment.
What Problem Does This Paper Address?
As Large Language Models (LLMs) evolve into "agents," they no longer just generate text; they interact with the world through function calling (e.g., querying a database or sending an email). While this adds immense utility, it creates a massive security surface.
The authors identify a critical gap: while much research focuses on "jailbreaking" proprietary models like GPT-4, there is less scrutiny on the robustness of smaller, open-source models (like Llama-3.2 or Granite) that companies are likely to host internally. Specifically, the paper explores how an attacker can trick an agent into executing a malicious function—such as a SQL injection that drops a user table—instead of the intended legitimate tool.
Methods and Datasets
The researchers conducted an extensive "Blue Team" evaluation by testing four representative open-source models (Qwen3:8B, Llama-3.2:3B, Granite3.2:8B, and Granite3.3:8B) against three types of attacks:
- Direct Prompt Injection (DPI): Embedding malicious instructions directly into the user query to override system prompts.
- Simple Tool Poisoning (STP): Modifying tool descriptions to mislead the agent into selecting a malicious tool.
- Renaming Tool Poisoning (RTP): A novel attack introduced in this paper that exploits the visibility of tool implementations. By renaming variables and functions within the code, attackers create confusion in the model’s tool-selection logic.
To counter these, they evaluated eight defenses, categorized into Preventive (e.g., Cosine Similarity, Tool Obfuscation, Description Rewriting) and Active (e.g., Watermarking, LLM-based Guardians).
The study utilized the Berkeley Function Calling Leaderboard (BFCL) as a foundation. To make the evaluation realistic, the authors generated plausible tool implementations using Qwen2.5-Coder:32B and created a sanitized dataset of 172 query-answer pairs where the agent must select the correct tool among multiple options, including the actual source code of the tools in the context.
Key Insights and Ideas
- Implementation Visibility is a Double-Edged Sword: Providing the agent with the source code of a tool helps it understand how to use it, but it also creates a new attack vector. The RTP attack proved that models can be "distracted" by variable names and internal logic, leading them to execute malicious code even if the tool's name seems neutral.
- The "Guardian" Tax: Using specialized "guardian" models to monitor agents (Active Defenses) is promising but expensive in terms of usability. Many of these defenses exhibited a high False Positive Rate (FPR)—sometimes as high as 47%—meaning they frequently block legitimate, safe requests.
- No Silver Bullet: A defense that works against prompt injection (DPI) might be completely useless against tool poisoning (STP). For instance, the Query Jailbreak Detector caught 100% of DPI attacks but failed to address any other attack types.
- Model-Specific Fragility: Robustness varies wildly between models. While Granite3.3:8B was remarkably resistant to Direct Prompt Injection, Qwen3:8B was highly susceptible.
Key Results
Baseline Vulnerability
Without defenses, all models were found to be insecure. DPI was the most effective attack overall, achieving success rates between 56% and 94% (excluding Granite3.3).
Effectiveness of Defenses
- Description Rewriting: Using an LLM to "clean" tool descriptions was one of the most effective preventive defenses, often reducing the success rate of tool poisoning attacks to 0%.
- Watermarking Success: The cryptographic watermarking of tool names detected 100% of successful malicious calls because the attacker cannot guess the secret HMAC key used to sign legitimate tools.
- The FPR Hurdle: Query Tools Consistency defenses, while catching many attacks, suffered from a 47% FPR, which would likely frustrate users in a production environment.
Limitations and Future Work
The authors acknowledge that their study focused on smaller models (<10B parameters). While these are more sustainable and accessible, larger models might exhibit different robustness profiles.
The primary takeaway for future work is the need for specialized, fine-tuned security models. Current general-purpose "guardian" models are either too lenient or too restrictive. The authors suggest that the next step in agentic security is creating models trained specifically on function-calling datasets to distinguish between complex, legitimate tool use and adversarial manipulation without sacrificing system performance.
Summary updated