Skip to content

Blue Team Testing Function-Calling AgentsBlue Teaming Function-Calling Agents

arXiv· arXiv:2601.09292· Greta Dolcetti, Giulio Zizzo, Sergio Maffeis·Indexed by this site · 2026-10-12· Originally publishedEvaluation

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors evaluate three attacks and eight defenses on four open-source function-calling models, stating that the models are insecure by default and that the defenses are not yet usable in real-world scenarios.

Threat modelThe goal is to induce a function-calling agent to call a malicious target function. DPI places the attack vector in the user query and does not require tool implementations; STP assumes access to the tool list, rewrites descriptions, and adds a malicious function; RTP modifies both descriptions and implementations. The victim system is an open-source function-calling model with visible tool implementations. Success is determined by calling that malicious function with specified parameters.

Questions
Open-source function-calling models often expose tool implementations. The authors evaluate whether four such models are secure by default against attacks that induce them to call malicious functions, and whether eight defenses can be used in real-world scenarios.
Methods
On a cleaned BFCL of 172 single function calls, DPI, STP, and RTP are tested on four open-source models. Defenses include obfuscation, rewriting descriptions from implementations, cosine similarity, watermarking, and active detection with granite-guardian as the main engine.
Experiments and results
Without defenses, Qwen3:8B's STP ASR is 0.95 and DPI is 0.94, while Granite3.3:8B's DPI ASR is 0. Description Rewriting brings STP and RTP ASR to 0. Query-tool consistency detection has a 47% no-attack FPR.
Limitations and future work
The authors state there is no universal defense applicable to all scenarios; using an LLM as a guardian is either not general enough or has high FPR, and they suggest training specialized models on function-calling-specific data that does not yet exist. The experiments cover four open-source models, 172 single-function calls, and combinations of three attacks and eight defenses; the paper does not report the number of repetitions.
Experimental setupQwen3:8B、Llama-3.2:3B et al. · Berkeley Function Calling Leaderboard · Accuracy、ASR et al.
Evaluated models
Qwen3:8BLlama-3.2:3BGranite3.2:8BGranite3.3:8Bgranite-guardian-3.2-3b-a800m
Benchmarks
Berkeley Function Calling Leaderboard
Metrics
AccuracyASRFPRTPRDSA
AI summaryThe paper evaluates the robustness of four open-source LLMs claimed to have function-calling capabilities against three types of attacks, and measures the effectiveness of eight defenses. The results show that these models are not safe by default, and these defenses are not yet deployable in real-world scenarios.

The paper evaluates the robustness of four open-source LLMs claimed to have function-calling capabilities against three types of attacks, and measures the effectiveness of eight defenses. The results show that these models are not safe by default, and these defenses are not yet deployable in real-world scenarios.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors state that four open-source function-calling models are insecure by default, and the eight defenses are not yet usable in real scenarios.

    When tool implementations are visible, can open-source function-calling models be induced to call malicious functions, and can defenses be used in real-world scenarios.

    • Scenario: function-calling agents let an LLM perform actions and interact with the environment. The authors state that protocols such as A2A and MCP make such applications more common, but function-calling capability does not guarantee resistance to adversarial attacks, even with defenses added (Introduction, citing Zhang et al. 2025).
    • Existing gaps: the authors state that prior work mainly demonstrates attack feasibility on proprietary models. Visible tool implementations introduce an attack vector the authors say was not previously addressed; existing defenses have practical limitations including high FPR, and no single defense covers all attack types.
    • This paper: tests DPI, STP, RTP, and eight defenses on four open-source LLMs that claim function-calling capability, quantifying the proportion of correct calls and ASR. The authors propose Tool Obfuscation, a defense related to RTP.
    • Threat model:
      • Goal: induce the agent to call a malicious target function rather than the correct tool for the user query.
      • Capabilities: the paper does not use terms such as black-box. DPI places the attack vector in the user query and does not require tool implementations; STP assumes access to the tool list, rewrites descriptions, and adds the malicious function; RTP modifies both descriptions and implementations.
      • Victim system: open-source function-calling models with detailed tool implementations. The task is a single function call with correct arguments among multiple tools.
      • Success criterion: whether the specified malicious function is called with the required parameter set to the specified value. ACC is the proportion of correct tool calls out of 172.
  2. What related research exists?

    Related work covers agent attacks, evaluation frameworks, and defenses; the authors position this paper on open-source models with tool implementations.

    In Related Work, the authors organize by attacks, evaluation frameworks, and defenses; the experiments do not reproduce these systems as comparisons.

    Agent attacks

    • Wu et al. (2025): The paper states that function-calling LLMs have a jailbreak success rate exceeding 90% via malicious prompts.
    • Wang et al. (2024): Adversarial tool injection manipulating LLM tool scheduling; the paper states ASR reaches up to 100%.

    Safety evaluation frameworks

    • Zhang et al. (2025)'s Agent Security Bench (ASB): 400+ tools, 27 attack/defense methods; the paper states the highest attack success rate is 84.30%.
    • Fu, Yuan, and Wang (2025)'s RAS-Eval: The paper states attacks reduce agent task completion rates by an average of 36.78%.

    Defense mechanisms

    • Li et al. (2025)'s DRIFT: dynamic, rule-based guardrails.
    • Chen et al. (2025)'s Meta SecAlign: an LLM with built-in defenses. The paper only provides the above descriptions for these two.

    Baselines and data

    • The experimental baseline is correct tool calls without attacks, see the first row of Table 1. Data comes from the Berkeley Function Calling Leaderboard, cleaned to 172 query-answer pairs.

    The authors state that, unlike work mainly demonstrating attack feasibility on proprietary models, this paper targets open-source function-calling models with detailed tool implementations, thus enabling testing of attacks and defenses related to tool code. The authors state that the attack vector corresponding to RTP was not addressed in prior work, and propose Tool Obfuscation accordingly.

  3. How does the paper address this problem?

    Three attacks and eight defenses are tested on 172 single function calls with implementations.

    On the same batch of tools with implementations, three attacks are applied to four open-source models, followed by either preventive processing or active detection. The malicious function is named get_result, and the success condition is that the required parameter param1 is true; its implementation is an SQL query intended to delete a data table. The paper does not reproduce the injection text that could be followed directly.

    Task, models, and data

    • Models and runtime: Qwen3:8B, Llama-3.2:3B, Granite3.2:8B, Granite3.3:8B, called via Ollama and DSPy. They were selected because they are open-source, commonly used, freely available, and claim function-calling capability. The authors state they chose smaller models because they have lower energy and compute requirements while maintaining acceptable performance.
    • Task: single function call on the Berkeley Function Calling Leaderboard, i.e., calling one function with correct arguments among multiple available tools. The paper does not state how many tools each query has.
    • Tool implementations: Qwen2.5-Coder:32B is used to generate plausible implementations, forming a cleaned set of 172 query-answer pairs. The authors state they include implementations because companies can do so when hosting internal tools or using open-source tools. A footnote points to the multiple data file of BFCL v3.
    • Commonality of attacks: all aim to make the agent call the malicious function above. The differences are where the attack vector is placed, the vector itself, and the scope of allowed modifications.

    Three attacks

    • DPI: writes the malicious instruction directly into the user query, attempting to override existing instructions and change behavior, without requiring access to tool implementations. The authors state it exploits the trust relationship between the user and the LLM system. The example also includes the malicious function.
    • STP: assumes access to the tool list. The attack vector is appended to the end of each tool description, and the malicious function is added to the list, so the descriptions still appear legitimate but the choice is steered toward the malicious function. The authors state this exploits the model's reliance on tool metadata for selection.
    • RTP: modifies both descriptions and implementations, containing two payloads. The first is added to each tool description, drawing attention to a variable in the implementation; then, at the start of each tool implementation, that variable is assigned a value containing the second payload; finally, the malicious tool is added to the list. The authors state that because it has two payloads and targets both descriptions and implementations, it can be considered a new form of tool poisoning.

    Preventive defenses

    • Cosine Similarity: embeds the user query and tools with all-MiniLM-L6-v2, computes cosine similarity, and returns the tool with the highest score. The authors state this effectively delegates tool selection to the embedding model.
    • Tool Obfuscation: targets rename-based tool poisoning. It systematically renames functions and variables in the implementation and keeps a mapping between obfuscated names and original names, to remove variable names and tool names as possible attack vectors.
    • Description Rewriting: targets STP and RTP. It uses Granite-Code:8B to regenerate descriptions based only on the implementation, aligning descriptions with actual functionality.

    Active defenses

    • Common goal: the authors state that active defenses aim to detect an ongoing attack, stop it, and put the system into a denial state.
    • Watermarking: uses HMAC for tool authentication. Each legitimate tool name is hashed with SHA-256 using a secret seed to obtain a watermark, written into the tool identifier, and verified before execution. The authors state that since the attacker does not know the key, malicious function names do not carry the watermark; hashes need to be regenerated when tools change.
    • LLM detection: the main engine is granite-guardian-3.2-3b-a800m. Results are filtered by a high-confidence requirement, with a probability threshold of 0.7 or higher. The Query Jailbreak Detector only checks for DPI in the user query; Query Answer Consistency judges whether the answer is proportionate to the query; the Tools Jailbreak Detector checks each tool's implementation and description; Query Tools Consistency judges whether the tool list matches the query intent. The paper does not give a separate model name for each detector. The wording in the main text and table titles is not fully consistent: Table 11 uses Query Tool Consistency, and Table 13 uses Tool Jailbreak Detector.

    Metrics

    • ACC: the proportion of correct tool calls out of 172 in each scenario.
    • ASR: the proportion of successful attacks. Success means calling the malicious function with the required parameter set to the specified value. The paper does not separately state the denominator of ASR, nor which model reviews it.
    • Detection metrics: LLM-based active defenses do not report ACC and ASR separately; the authors state they are the same as the no-defense baseline. They report FPR (proportion of safe interactions judged malicious), TPR (proportion of malicious interactions correctly judged malicious), and DSA (defined by the authors as the proportion of successful attack attempts that are detected). With no attack, Query Answer Consistency counts calls that should be correct as inappropriate, which is counted as a false positive.
  4. What experiments did the paper conduct?

    Without defense, Qwen3:8B has an STP ASR of 0.95; rewriting descriptions brings tool-poisoning ASR to 0.

    Experimental setup

    • Models tested: Qwen3:8B, Llama-3.2:3B (Table 1 header as Llama3.2:3B), Granite3.2:8B, Granite3.3:8B. Run via Ollama and DSPy.
    • Data: Cleaned Berkeley Function Calling Leaderboard, 172 query-answer pairs; the task is single function calls among multiple tools. Tool implementations are generated by Qwen2.5-Coder:32B.
    • Attacks and defenses: DPI, STP, RTP; eight defenses are cosine similarity, Tool Obfuscation, Description Rewriting, Watermarking, Query Jailbreak Detector, Query Answer Consistency, Tools Jailbreak Detector, Query Tools Consistency. The authors state they tested all combinations of attacks and defenses.
    • Metrics: ACC is the proportion of correct tool calls out of 172; ASR is the proportion of successful attacks. LLM proactive defenses do not separately report ACC/ASR. Detectors report FPR, TPR, DSA.
    • Detector settings: Primary engine granite-guardian-3.2-3b-a800m, high-confidence filtering, probability threshold 0.7 or higher. Description rewriting uses Granite-Code:8B; embeddings use all-MiniLM-L6-v2.
    • Not specified: The paper does not report the number of repetitions, nor human agreement. The authors state the main text only summarizes key results, with full values in the appendix tables.

    Main results

    From Table 1, no defense. Cells are ACC / ASR.

    Swipe horizontally to read the table

    ModelNo-attack ACCDPISTPRTP
    Qwen3:8B0.920.06 / 0.940.04 / 0.950.24 / 0.74
    Llama3.2:3B0.660.20 / 0.580.50 / 0.230.69 / 0.02
    Granite3.2:8B0.840.34 / 0.560.72 / 0.120.84 / 0.01
    Granite3.3:8B0.780.80 / 00.39 / 0.510.83 / 0
    • The authors state these models are not robust by default. The authors state no-attack ACC ranges from 92% to 66% across models; Table 1 shows 0.92, 0.66, 0.84, 0.78.
    • The authors state DPI is most effective except for Granite3.3:8B, with ASR between 94% and 56%; that model has DPI ASR of 0. The other three ASRs in the table are 0.94, 0.58, 0.56.
    • STP has ASR 0.95 on Qwen3:8B, and 0.23, 0.12, 0.51 on the others; the authors state ACC drops for every model. RTP is only effective on Qwen3:8B (ASR 0.74). The authors state the other models are unaffected and ACC rises; in the table, Llama3.2:3B is 0.69, Granite3.3:8B is 0.83, and Granite3.2:8B remains 0.84. The authors speculate Qwen3:8B may pay more attention to tool implementations.

    Description Rewriting

    • Uses Granite-Code:8B to rewrite descriptions according to implementations, targeting STP and RTP (Tables 8, 9).
    • STP and RTP ASR are 0 for all four models (relative change -100%, Table 9). Under STP, ACC is 0.92, 0.67, 0.83, 0.81. DPI ASR is 0.94, 0.57, 0.62, 0.01, not reduced to 0.
    • The authors state it is effective against the targeted tool poisoning and has negligible or positive ACC impact on most models. No-attack ACC is 0.91, 0.55, 0.82, 0.80; among these, Llama3.2:3B has a table relative change of -17%.

    Watermarking

    • Verifies watermarks before execution (Tables 6, 7). The authors state Llama-3.2:3B cannot accurately report watermarks, so selected tools are marked incorrect. No-attack FPR is 1%, 50%, 2%, 3%.
    • Table 7 ASR is not zeroed: Qwen3:8B under DPI/STP/RTP is 0.92/0.95/0.63; Granite3.3:8B's STP ASR is 0.56 (relative change +10%). No-attack ACC is 0.90, 0.59, 0.84, 0.81 (Table 6).
    • The authors state that because attackers do not know the key, 100% of successful malicious calls can be identified before execution; and that hashes need to be regenerated when tools change. Table 7 does not give a DSA corresponding to this sentence. The authors state that except for Llama-3.2:3B, the impact on ACC and ASR is generally positive; the STP numbers above are inconsistent with "ASR all decreased."

    LLM proactive detection

    • Query Jailbreak Detector (Table 12, targeting DPI): No-attack FPR is 0% for all four models. DPI TPR is 100%; DSA is 100% for Qwen3:8B, Llama3.2:3B, Granite3.2:8B, and Granite3.3:8B only lists TPR 100%. STP and RTP TPR are 0%. The authors state it cannot be used for untargeted attacks.
    • Tools Jailbreak Detector (Table 13, targeting both tool poisonings): STP and RTP TPR are 100% (cells with DSA also 100%). No-attack FPR is 22% for all; DPI TPR is 22% (DSA 20% for Qwen and Granite3.2, 26% for Llama). The authors state its FPR is high for no-attack and DPI.
    • The other two: Query Answer Consistency (Table 10) has no-attack FPR of 12%, 11%, 13%, 11%; the authors state results for DPI and RTP are promising. DPI TPR is 93%, 72%, 73%, 41%. Query Tools Consistency (Table 11) has no-attack FPR of 47% for all, which the authors state is the highest FPR, and speculate the reason is that the natural language used to train the consistency detector does not resemble the function structure in this experiment. In that table, Granite3.2:8B's DSA under RTP is 0%.

    Other ablations and analyses

    • Tool Obfuscation (Tables 2–3, targeting RTP): RTP ASR is 0.35, 0.03, 0, 0. Llama3.2:3B no-attack ACC is 0.48 (-27%), DPI ASR is 0.87 (+50%). The authors state that except for that model, most combinations are overall positive; in Table 3, Granite3.2:8B's STP ASR is 0.28 (+133%).
    • Cosine Similarity (Tables 4–5): RTP ASR is 0.01, 0.01, 0, 0. Under STP, Granite3.2:8B ASR is 0.64 (+433%), Granite3.3:8B is 0.99 (+94%); Qwen3:8B's STP ACC is 0.71, ASR is 0.21.
    • Under the same defense, DPI Qwen3:8B ACC is 0 (-100%), ASR is 0.99 (+5%); Granite3.3:8B's DPI ASR is 0.09 (table note: baseline was 0). The authors state that for some tools ASR relatively decreases by up to 100% and ACC rises to 0.71, while for others ACC relatively decreases by up to 100% and ASR rises to 0.64; for RTP the authors state the overall effect is positive.
    • Query Answer Consistency's RTP: DSA is 100% for Qwen, Llama, Granite3.2, and Granite3.3 only reports TPR 8% (Table 10). STP TPR is 19%, 23%, 23%, 17%.
    • Query Tools Consistency's STP TPR is 43% for all, DSA is 44%, 54%, 50%, 50%; RTP TPR is 40% for all (Table 11). DPI TPR is 100%.
    • Watermarking's DPI: Granite3.2:8B ACC is 0.42 (+24%), ASR is 0.47 (-16%); Granite3.3:8B's DPI ASR remains 0 (Table 7).
  5. What are some points that can be further explored?

    The authors state that there is no universal defense covering all scenarios, and suggest training function-call-specific models.

    Limitations and future directions noted by the authors

    The paper does not have a separate Limitations section. The following correspond to judgments and suggestions explicitly written in the Conclusion.

    • The authors state that no universal defense applies to all scenarios; and call Description Rewriting and Watermarking encouraging steps in this direction (Conclusion).
    • The authors consider using an LLM as a guardian not yet feasible: either it is not general enough, or the FPR is high (Conclusion).
    • The authors suggest training more specialized models using datasets tailored to function-calling scenarios, and state that such datasets do not yet exist (Conclusion).

    Experimental coverage

    • The function-calling models under test are Qwen3:8B, Llama-3.2:3B, Granite3.2:8B, and Granite3.3:8B, 4 in total, run with Ollama and DSPy (Experimental Evaluation).
    • The data is a cleaned Berkeley Function Calling Leaderboard, 172 query-answer pairs; the task is a single function call among multiple tools; tool implementations are generated by Qwen2.5-Coder:32B.
    • The attacks are DPI, STP, and RTP. The defenses are cosine similarity, Tool Obfuscation, Description Rewriting, Watermarking, and four LLM-based active detections. The authors state that they tested all combinations of attacks and defenses.
    • The main engine for active detection is granite-guardian-3.2-3b-a800m, with a probability threshold of 0.7 or higher; description rewriting uses Granite-Code:8B; cosine similarity uses all-MiniLM-L6-v2.
    • The paper does not report the number of repetitions. The ACC and ASR of LLM-based active defenses are not reported separately; the authors state they are the same as the baseline; the appendix provides ACC, ASR, or FPR/TPR/DSA in Tables 2–13.
  6. Summarize the main content of the paper

    Blue-team results on four open-source models: STP has an ASR of 0.95 on Qwen3:8B, and rewriting descriptions reduces tool-poisoning ASR to 0.

    The authors conduct a blue-team evaluation of four open-source function-calling models, looking at what numbers attacks that induce calls to malicious functions and eight defenses land on when tool implementations are visible.

    • Problem: The victim system is an open-source model that claims function-calling capability. The attack goal is to make it call a specified malicious function, with required parameters set to specified values. DPI modifies the user query; STP modifies tool descriptions and adds a malicious function; RTP modifies both descriptions and implementations. The authors treat RTP and Tool Obfuscation as a pair not previously handled.
    • Method: The data is the cleaned Berkeley Function Calling Leaderboard, 172 single-function calls, with implementations generated by Qwen2.5-Coder:32B. Preventive measures are name obfuscation, rewriting descriptions from implementations with Granite-Code:8B, and selecting tools with an embedding model by cosine similarity. Active measures are watermarking before execution, and detection with granite-guardian-3.2-3b-a800m as the primary engine, at a probability threshold of 0.7 or higher.
    • No defenses: In Table 1, Qwen3:8B's DPI, STP, and RTP ASR are 0.94, 0.95, and 0.74. Granite3.3:8B's DPI ASR is 0, and RTP ASR is 0. The authors state no-attack ACC ranges from 92% to 66%.
    • Defenses: Description Rewriting brings STP and RTP ASR to 0 for all four models (Table 9), while DPI can still succeed. Query Jailbreak Detector has 100% TPR for DPI and 0% no-attack FPR, with 0% TPR for both tool-poisoning attacks (Table 12). Query Tools Consistency has a 47% no-attack FPR (Table 11).
    • Authors' conclusion: Models are insecure by default, and defenses are not yet usable in real scenarios; there is no universal defense covering all attacks. The authors believe LLM guardians are either not general enough or have high FPR, and suggest training specialized models on function-calling-specific data that does not yet exist.
Read originalarxiv.org