Manuscript Offprint

arXiv:2610.41803

What Standard Evaluations Hide About Detectors of Hijacked LLM Agents: Rare Attacks, Unseen Tools and Benchmark Transfer

Mahmoud Abbasi, Juan M. Núñez V., Amin Shahraki

Mahmoud Abbasi, Member, IEEE, Juan M. Núñez V., and Amin Shahraki, Senior Member, IEEE

Abstract—Detectors can flag hijacked large language model (LLM) agents from the traces of the tools they call. In the eleven evaluations we audited, attacks or anomalies make up 16% to 86% of the test samples, no evaluation varies that share, and six report no test on data from a second benchmark or source. We ask what such evaluations hide. On the AgentDrift and AgentDojo benchmarks we test trained detectors that read tool identities, behavior, call sequences, step embeddings or text, and a released LLM action monitor, AlignmentCheck, with thresholds fixed on training data or set by the monitor's released decision rule. First, at a 2% attack rate a detector with an area under the receiver operating characteristic curve (AUROC) of 0.879 reaches a precision of 0.076, and the mix of negatives alone moves that precision between 0.039 and 0.117. Second, as tool coverage, the share of test tool calls whose tool was seen in training, falls, detector rankings cross near 50% coverage and reverse below it, because unseen tools map to inputs that training never reached. Dropout on tool inputs largely removes the reversal. Third, no detector trained on AgentDrift ranks AgentDojo traces better than chance (AUROC 0.47 to 0.52), including one that reaches 0.996 within AgentDojo. The monitor, trained on neither, reaches 0.930, but with its open backbone its released decision rule would still mostly raise false alerts at a 2% attack rate (precision 0.096). We turn these findings into a checklist for evaluating trace detectors.

Index Terms—Anomaly detection, class imbalance, distribution shift, evaluation methodology, intrusion detection, large language model agents, precision-recall analysis, prompt injection.

I. INTRODUCTION

Agents built on large language models (LLMs) carry out user tasks by calling tools such as mail clients, payment services, file systems and web browsers, and the output of each call returns to the model as context. Instructions planted in that output can redirect the agent toward an attacker's goal, a threat known as indirect prompt injection [1]. Benchmarks such as InjecAgent [2] and AgentDojo [3] show that such injections still succeed against current models at rates that cannot be ignored. A hijacked agent has to act through its tools, so the record of its tool calls is a natural place to look for evidence of compromise. Recent work proposes rule, automaton, graph, sequence and LLM-based detectors that score such traces [4]–[13].

How these detectors are evaluated matters as much as how they are built. In the eleven evaluations we audited (Table I),

test sets that mix both classes contain 16% to 86% attacks or anomalies, only four works report a threshold-free measure, none varies the attack share, and six report no cross-benchmark or within-target test. A security team that audits agent sessions meets different conditions. Successful hijacks are likely to be a small and unknown share of its sessions, and the tools, tasks and domains its agents meet change over time and between organizations.

Three consequences are known in general but have not been measured for these detectors. When attacks are rare, even a small false-positive rate yields alerts that are mostly false [14], and the receiver operating characteristic (ROC) hides this because, unlike precision, it does not depend on prevalence [15], [16]. Learned security detectors degrade under distribution shift and profit from biased splits [17]–[19]. And a model can learn a cue that separates the classes in one dataset without defining the behavior of interest [20]. Tool-call detectors face one further shift that is easy to measure, the share of test tool calls whose tool appeared in training, which we call tool coverage.

Parts of this picture have been examined. MCPShield [9] shows that random splits can inflate AUROC by up to 25.8 points relative to task-disjoint splits and traces the gap to metadata features, a one-hot tool name with an argument hash and the response length, that learn task-specific tool signatures. Agent-Sentry [6] adds a within-target control, TrajAD [11] holds out a domain, and Fomin [21] makes the leave-one-dataset-out case for classifiers of malicious prompts. No audited evaluation, however, measures detection at controlled attack prevalence, reports tool coverage for every split, holds out every test tool, or transfers from a synthetic benchmark to recorded agent runs.

We run these tests jointly on one set of detectors, with thresholds always fixed on training data, and ask three questions (Fig. 1).

• Q1, rare attacks. What does a high AUROC say about the alerts a detector raises when 1% to 10% of sessions are attacked?

• Q2, unseen tools. What happens to detector rankings and thresholds as the share of known tools falls, and why?

• Q3, a new benchmark. Does a detector trained on one benchmark keep its signal on another?

M. Abbasi (corresponding author, e-mail: mahmoudabbasi@usal.es) is with the University of Salamanca, 37007 Salamanca, Spain.

J. M. Núñez V. is with the AIR Institute, Salamanca, Spain.

A. Shahraki is with the Department of Informatics, University of Oslo, 0373 Oslo, Norway.

We study simple trained detectors on tool identity, behavior and call sequences, a reimplementation of a published step-embedding architecture, a content reference, and a released

LLM action monitor, AlignmentCheck [13], with an open and a commercial backbone. The answers are as follows.

  • At a 2% attack rate, the combined logistic regression has an AUROC of 0.879 but a precision of 0.076 at its training threshold, 12.2 false alerts for every true one, and the share of hard negatives alone moves this precision between 0.039 and 0.117 (Section IV).

  • Holding out worlds or tasks costs little, but holding out tools does not. Detector rankings cross near 50% tool coverage and reverse below it, because unseen tools map to inputs that training never reached, such as an untrained unknown-tool embedding. Dropout on tool inputs removes the GRU reversal and turns the other into a near tie. Training thresholds fail as well, and SE, a detector without untrained inputs, shows that a domain shift alone can move them (Section V).

  • No detector trained on AgentDrift ranks AgentDojo traces better than chance, not even one that is near perfect within AgentDojo, and within each benchmark surface content, such as generator templates or fixed attack strings, separates the classes. The released monitor, trained on neither, does transfer, but with its open backbone its released decision rule would still mostly raise false alerts at a 2% attack rate (Section VI).

We turn these findings into seven recommendations (Section VII). We do not propose a detector. Our claims concern our own detectors, one reimplementation and one released monitor prompt, not the published detectors of Table I as released.

References (44)