Skip to content

Menu

WorksComputer Science

From Expected Harmfulness to Likelihood: A Probabilistic Reformulation of Jailbreaking LLM Agents

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_bq2vvuga. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

When the harmfulness of an LLM agent's output can be quantified, a natural jailbreaking objective is to maximize expected harmfulness over admissible input modifications. An alternative approach constructs or selects harmful target outputs and modifies the input to increase their likelihood. We establish a precise connection between these two approaches through a probabilistic reformulation. Specifically, we show that the gradient of the logarithm of expected harmfulness with respect to the input equals the expected input gradient of the model's log-likelihood under a harmfulness reweighted output distribution. This identity provides a unified interpretation of expected harmfulness and target likelihood optimization. Building on this connection, we propose OPUR, a sampling distribution designed to generate highly harmful target outputs and use the resulting samples to guide likelihood-based input optimization. Experiments demonstrate the effectiveness of the resulting method in jailbreaking LLM agents.

INTRODUCTION

For LLM agents, attackers seek to bypass safety alignment mechanisms and induce harmful responses or malicious actions, a class of attacks commonly referred to as jailbreaks. Prior studies have shown that carefully crafted adversarial prompts or suffixes can effectively steer agents toward attacker-specified behaviors. Existing attacks typically follow a direct strategy: specifying a harmful target in advance and optimizing the likelihood that the model produces it [45, 21, 5, 23, 43]. In other words, given a fixed input and adversarial suffix, the attacker attempts to increase the probability of a particular harmful response. An alternative, more distributional perspective is to maximize expected harmfulness. Rather than focusing on a single output, it weighs all possible model responses by both their probability of occurrence and their degree of harmfulness, thereby characterizing the overall harmfulness induced by an adversarial input over the output distribution [12, 6].

In this paper, we revisit this problem from a probabilistic perspective. As illustrated in Figure 1, we introduce a harmfulness-weighted response distribution π\pi that jointly reflects how likely a response is under the model and how harmful that response is. Intuitively, π\pi characterizes the region an attacker would ideally like the model to enter: responses that are not only harmful, but also likely to be generated. From this perspective, target likelihood and expected harmfulness are no longer isolated objectives, but can be understood through the same response distribution. Because the response space is discrete and combinatorial, π\pi is difficult to represent or sample from directly, motivating a practical surrogate for adversarial optimization.

Overview of the probabilistic view of jailbreak optimization

Figure 1. Overview of our probabilistic view of jailbreak optimization. Given an adversarial input, the model induces a response distribution pdis(y)=pθ(y∣x,s)p_{\mathrm{dis}}(y) = p_{\theta}(y \mid x, s), while the harmfulness function induces a preference pvic(y)∝ψ(y)p_{\mathrm{vic}}(y) \propto\psi(y). Considering either view alone may favor responses that are likely but insufficiently harmful, or harmful but unlikely. Their normalized product defines the reweighted distribution π\pi, which emphasizes responses that are simultaneously likely under the model and harmful under the attack objective. Since exact sampling from π\pi may be unavailable in practice, its high-probability regions can be represented by constructed surrogate targets and optimized through their likelihood. As optimization proceeds, model probability mass is progressively shifted toward harmful outputs, providing a unified interpretation of expected harmfulness maximization and target-likelihood optimization.

Guided by this probabilistic formulation, we propose OPUR, which constructs a practical surrogate distribution for π\pi from model-generated rollouts. OPUR considers multiple possible adversarial outcomes and prioritizes candidate directions that are both harmful and attainable under the model.

This makes the attack better suited to the stochastic nature of agent generation and helps uncover effective adversarial directions that deterministic optimization may overlook. As shown in Figure 2, in the calendar-query example, UDora remains focused on the original calendar task, whereas OPUR explores alternative feasible trajectories and identifies one that triggers the attacker-designated tool call. In this way, OPUR turns the probabilistic perspective into a practical jailbreak strategy for LLM agents.

An illustrative InjecAgent example comparing UDora and Opur

Figure 2. An illustrative InjecAgent example comparing UDora and Opur. The agent encounters attacker-controlled content while answering a calendar query. The two methods construct different surrogate contexts for adversarial optimization, resulting in different final tool-call outputs in this case. Position scores and candidate sets are schematic.

Our contributions are summarized as follows:

  • A unified probabilistic framework for jailbreak optimization. We establish a gradient-level reformulation between expected harmfulness and target likelihood under a harmfulness-reweighted output distribution, providing a unified interpretation of behavioral and likelihood-based attack objectives.

  • OPUR: a practical realization of the framework. Building on this probabilistic formulation, we propose OPUR, which approximates the theoretical distribution using model-generated rollouts and uses promising contexts to guide adversarial suffix optimization.

  • Higher ASR under stochastic generation. We evaluate OPUR across multiple benchmarks under stochastic decoding and show that the proposed formulation translates into consistently higher targeted attack success rates than existing optimization-based baselines.

PRELIMINAIRES

Let pθ(⋅∣x,s)p_\theta(\cdot\mid x, s) be the response distribution of a large language model, where θ\theta is the parameters of the LLM, xx is the input and ss is the adversarial suffix inside of xx.

Jailbreaking Based on Expected Harmfulness

Let ψ(y)≥0\psi(y) \ge0 represents the harmfulness of the response yy. Given input xx, a natural way to find an adversarial suffix ss is to maximize the expectation of the harmfulness:

s∗=arg⁡max⁡s EY∼pθ(⋅∣x,s)[ψ(Y)],(1)s^* = \underset{s}{\arg\max}\ \mathbb{E}_{Y \sim p_\theta(\cdot\mid x,s)}[\psi(Y)], \tag*{(1)}

Geisler et al. [12] suggested to apply REINFORCE (Williams, [33]) on Equation (1). In particular, by applying the log-derivative trick, the gradient of the expected harmfulness can be expressed as an expectation over responses sampled from the LLM, as formalized in Theorem 1.

Theorem 1 (REINFORCE Gradient for Expected Harmfulness). Assume that pθ(y∣x,s)p_\theta(y \mid x, s) is differentiable with respect to ss, its support does not depend on ss, ψ(y)\psi(y) does not explicitly depend on ss, and differentiation and expectation can be interchanged. Then

∇sEY∼pθ(⋅∣x,s)[ψ(Y)]=EY∼pθ(⋅∣x,s)[ψ(Y)∇slog⁡pθ(Y∣x,s)].(2)\nabla_s \mathbb{E}_{Y \sim p_\theta(\cdot\mid x,s)}[\psi(Y)] = \mathbb{E}_{Y \sim p_\theta(\cdot\mid x,s)}[\psi(Y)\nabla_s \log p_\theta(Y \mid x,s)]. \tag*{(2)}

However, at the early stage of optimization, when the adversarial suffix ss is still poorly formed, the response distribution pθ(⋅∣x,s)p_\theta(\cdot\mid x, s) is unlikely to generate harmful responses. In other words, ψ(y)≈0\psi(y) \approx0 for almost all y∼pθ(⋅∣x,s)y \sim p_\theta(\cdot\mid x, s), resulting in little to no informative gradient signal for updating ss. Geisler et al. [12] explicitly acknowledges this limitation and introduces several heuristic rules to construct harmful responses as substitutes for samples from pθ(⋅∣x,s)p_\theta(\cdot\mid x, s). Proof is shown in Proof A.

Likelihood-based Jailbreaking

Given a harmful response yharmy_{\mathrm{harm}}, a principled way is to maximize the likelihood of the yharmy_{\mathrm{harm}} by tuning the suffix ss (Zou et al., [45]):

s∗=arg⁡max⁡s log⁡pθ(yharm∣x,s).(3)s^* = \underset{s}{\arg\max}\ \log p_\theta(y_{\mathrm{harm}} \mid x, s). \tag*{(3)}

Since the adversarial suffix ss consists of discrete tokens, however, this gradient cannot be directly applied through a standard continuous update. Zou et al. [45] addresses this issue by using the gradient to identify promising token substitutions and then performing greedy coordinate-wise updates.

Probabilistic Adversarial Attack

Zhang et al. [40, 41] introduced the probabilistic adversarial attack framework, in which the adversarial distribution is defined as

padv(xadv∣xori,ytar)∝pvic(xadv∣ytar)pdis(xadv∣xori),(4)p_{\mathrm{adv}}(x_{\mathrm{adv}} \mid x_{\mathrm{ori}}, y_{\mathrm{tar}}) \propto p_{\mathrm{vic}}(x_{\mathrm{adv}} \mid y_{\mathrm{tar}})p_{\mathrm{dis}}(x_{\mathrm{adv}} \mid x_{\mathrm{ori}}), \tag*{(4)}

where

pvic(xadv∣ytar)∝exp⁡(−cf(xadv,ytar)),pdis(xadv∣xori)∝exp⁡(−D(xori,xadv)).\begin{aligned} p_{\mathrm{vic}}(x_{\mathrm{adv}} \mid y_{\mathrm{tar}}) &\propto\exp(-c f(x_{\mathrm{adv}}, y_{\mathrm{tar}})),\\ p_{\mathrm{dis}}(x_{\mathrm{adv}} \mid x_{\mathrm{ori}}) &\propto\exp(-D(x_{\mathrm{ori}}, x_{\mathrm{adv}})). \end{aligned}

Here, pvicp_{\mathrm{vic}} assigns higher probability to samples that more strongly satisfy the adversarial objective, while pdisp_{\mathrm{dis}} favors samples that remain close to the original input under the distance measure DD. Their product therefore defines a distribution over adversarial examples that explicitly balances attack effectiveness against deviation from the original input.

Unifying Expected Harmfulness and Likelihood-based Jailbreaking

We now connect the expected-harmfulness objective in § 2.1 with the likelihood-based objective in § 2.2. Define the harmfulness-reweighted response distribution

π(y∣x,s)=pθ(y∣x,s)ψ(y)EY∼pθ(⋅∣x,s)[ψ(Y)](5)\pi(y \mid x,s) = \frac{p_\theta(y \mid x,s)\psi(y)}{\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)]} \tag*{(5)}

assuming EY∼pθ(⋅∣x,s)[ψ(Y)]>0\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] > 0. This distribution assigns high probability to responses that are both likely under the current model and highly harmful.

If the target response in likelihood-based jailbreaking is sampled from π\pi, the corresponding expected likelihood objective is

max⁡sEYharm∼π[log⁡pθ(Yharm∣x,s)].\max_s \mathbb{E}_{Y_{\mathrm{harm}}\sim\pi}[\log p_\theta(Y_{\mathrm{harm}}\mid x,s)].

At a fixed ss, its gradient is

EYharm∼π[∇slog⁡pθ(Yharm∣x,s)],\mathbb{E}_{Y_{\mathrm{harm}}\sim\pi}[\nabla_s \log p_\theta(Y_{\mathrm{harm}}\mid x,s)],

which, by Theorem 2, is exactly the gradient of the log expected harmfulness.

Theorem 2 (Equivalence between Expected Harmfulness and Likelihood Gradients). Assuming differentiation and expectation can be interchanged, the gradient of the log expected harmfulness can be expressed as the expected log-likelihood gradient under the harmfulness-reweighted response distribution π\pi:

∇slog⁡EY∼pθ(⋅∣x,s)[ψ(Y)]=EY∼π[∇slog⁡pθ(Y∣x,s)](6)\nabla_s \log\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] = \mathbb{E}_{Y\sim\pi}[\nabla_s \log p_\theta(Y\mid x,s)] \tag*{(6)}

Theorem 2 shows that, at a fixed ss, maximizing expected harmfulness induces the same update direction as increasing the likelihood of responses drawn from the harmfulness-reweighted distribution π\pi. Therefore, expected-harmfulness optimization can be viewed locally as likelihood-based optimization with adaptively constructed harmful targets. Proof is shown in Proof A.

By normalizing the identity in Theorem 1 by the expected harmfulness, we obtain

∇slog⁡EY∼pθ(⋅∣x,s)[ψ(Y)]=EY∼pθ(⋅∣x,s)[ψ(Y)EY′∼pθ(⋅∣x,s)[ψ(Y′)]∇slog⁡pθ(Y∣x,s)].(7)\nabla_s \log\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] = \mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}\left[\frac{\psi(Y)}{\mathbb{E}_{Y'\sim p_\theta(\cdot\mid x,s)}[\psi(Y')]} \nabla_s \log p_\theta(Y\mid x,s)\right]. \tag*{(7)}

Comparing Equations (6) and (7), both formulations lead to likelihood-gradient updates, but under different sampling distributions. Geisler et al. [12] estimates the gradient using samples from pθ(⋅∣x,s)p_\theta(\cdot\mid x,s), whereas ours takes the expectation under the harmfulness-reweighted distribution π\pi. By concentrating probability mass on harmful responses, π\pi avoids the early-stage regime where model samples are almost entirely benign and provide little useful gradient signal, yielding a more principled sampling distribution for likelihood-based jailbreak optimization.

The distribution π\pi also has the same product form as the probabilistic adversarial attack in § 2.3:

π(y∣x,s)∝pθ(y∣x,s)⏟pdis(y)ψ(y)⏟∝pvic(y).(8)\pi(y\mid x,s) \propto\underbrace{p_\theta(y\mid x,s)}_{p_{\mathrm{dis}}(y)} \underbrace{\psi(y)}_{\propto p_{\mathrm{vic}}(y)}. \tag*{(8)}

As illustrated in Figure 1, π\pi emphasizes responses that are both likely under the current model and highly harmful, suggesting them as likelihood targets for local suffix updates. Since direct sampling from π\pi is difficult when harmful responses are rare, the remaining challenge is to construct useful surrogate targets, which we address in the next section using stochastic agent rollouts.

OPUR

This section introduces OPUR, which builds on the harmfulness-reweighted distribution π\pi. OPUR constructs rollout-derived surrogate targets to represent its high-probability harmful regions. It combines bootstrap-style exploration and probabilistic position selection to obtain targets that are both plausible under the current model and useful for likelihood-based suffix optimization. We next motivate this design and present the attack algorithm.

Algorithm 1 OPUR

  1. Input: LLM M\mathcal{M}, prompt xx, target aa, suffix ss, maximum positions ℓ\ell, rollouts KoptK_{\mathrm{opt}}

  2. while budget remains do

  3. {(zk,Pk)}k=1Kopt←Rollout⁡(M,x,s)\{(z_k,P_k)\}_{k=1}^{K_{\mathrm{opt}}} \leftarrow\operatorname{Rollout}(\mathcal{M},x,s) ▷ Stochastic rollouts

  4. break if ⋁k=1KoptSucc⁡(zk,a)\bigvee_{k=1}^{K_{\mathrm{opt}}}\operatorname{Succ}(z_k,a)

  5. C⋆←∅C^\star\leftarrow\varnothing

  6. for k=1,…,Koptk=1,\ldots,K_{\mathrm{opt}} do

  7. Compute rk,j(a)r_{k,j}(a) for each eligible position jj using (zk,Pk)(z_k,P_k); Ck←∅C_k\leftarrow\varnothing

  8. repeat

  9. Sample JJ (∣J∣≤ℓ|J|\leq\ell, non-overlapping) from Softmax⁡({rk,j(a)}j/τ)\operatorname{Softmax}(\{r_{k,j}(a)\}_j/\tau) ▷ Probabilistic position sampling

  10. Obtain zk,J⋆z^\star_{k,J} by replacing the spans at JJ in zkz_k with aa

  11. Ck←Ck∪{zk,J⋆}C_k\leftarrow C_k\cup\{z^\star_{k,J}\}

  12. until enough distinct position sets are collected or the sampling budget is exhausted

  13. Evaluate LU(s;c)\mathcal{L}_U(s;c) for each c∈Ckc\in C_k

  14. Ck⋆←C_k^\star\leftarrow lowest-probe-loss contexts in CkC_k

  15. C⋆←C⋆∪Ck⋆C^\star\leftarrow C^\star\cup C_k^\star ▷ Probe screening

  16. end for

  17. g←Mean⁡c∈C⋆∇onehot(s)LCE(s;c)g\leftarrow\operatorname{Mean}_{c\in C^\star}\nabla_{\mathrm{onehot}(s)}\mathcal{L}_{\mathrm{CE}}(s;c) ▷ Cross-rollout optimization

  18. Generate V\mathcal{V} by gradient-guided token substitutions using gg

  19. L‾U(v)←Mean⁡c∈C⋆LU(v;c)\overline{\mathcal{L}}_U(v)\leftarrow\operatorname{Mean}_{c\in C^\star}\mathcal{L}_U(v;c), for each v∈Vv\in\mathcal{V}

  20. s←arg⁡min⁡v∈VL‾U(v)s\leftarrow\arg\min_{v\in\mathcal{V}}\overline{\mathcal{L}}_U(v)

  21. end while

  22. Output: ss

Motivation

Our attack constructs surrogate optimization contexts from the agent’s own trajectories. Since stochastic decoding can yield different trajectories and positional scores for the same input, deterministic top-position selection may overfit to a single rollout. OPUR instead probabilistically explores multiple non-overlapping position sets and filters low-quality surrogate contexts before suffix optimization, balancing candidate diversity with optimization reliability.

Attack Algorithm

Notation. We denote by M\mathcal{M} the victim LLM agent, by xx the agent prompt, by oo an environmental observation, and by ss the adversarial suffix, which is appended to xx in the malicious-instruction setting and to oo in the malicious-environment setting. Given the attacked input, M\mathcal{M} produces a stochastic rollout z=(z1,…,zn)z=(z_1,\ldots,z_n) with token distributions P=(p1,…,pn)P=(p_1,\ldots,p_n). Let aa denote the target segment and rj(a;z,P)r_j(a;z,P) the insertion score of an eligible span jj. A sampled set JJ contains at most ℓ\ell non-overlapping spans, whose replacement with aa yields a surrogate context zJ⋆z^\star_J. We use CkC_k for the surrogate contexts sampled from rollout kk, C⋆C^\star for those retained after probe screening across rollouts, LU\mathcal{L}_U for screening and candidate evaluation, LCE\mathcal{L}_{\mathrm{CE}} for suffix-gradient computation, and V\mathcal{V} for the resulting suffix candidates.

Attack Algorithm. As we demonstrated in Algorithm 1, our probabilistic adversarial attack algorithm have 4 main steps.

Step 1: Stochastic rollout generation. At each optimization step, we query the victim LLM KoptK_{\mathrm{opt}} times using the same attacked input and current suffix, obtaining stochastic responses and their token-level probability traces. Optimization terminates if every rollout meets the attack success criterion; otherwise, each rollout is used to identify candidate injection positions.

Step 2: Probabilistic position sampling. For each rollout, we score every eligible position jj using its generated tokens and probability trace. Let mk,jm_{k,j} be the number of consecutive target tokens matched by the model’s argmax predictions, pˉk,j\bar{p}_{k,j} their mean target-token probability up to and including the first mismatch or the last available token, and Lk,jL_{k,j} the target’s token length at position jj. The position score is

rk,j(a)=mk,j+pˉk,jLk,j+1.(9)r_{k,j}(a)=\frac{m_{k,j}+\bar{p}_{k,j}}{L_{k,j}+1}. \tag*{(9)}

Instead of always choosing the highest-scoring positions, we sample from a temperature-controlled distribution:

qτ(j∣zk,Pk)=exp⁡(rk,j(a)/τ)∑uexp⁡(rk,u(a)/τ).(10)q_{\tau}(j\mid z_k,\mathcal{P}_k)=\frac{\exp(r_{k,j}(a)/\tau)}{\sum_u \exp(r_{k,u}(a)/\tau)}. \tag*{(10)}

where the denominator includes only currently eligible positions. After each draw, the selected position and overlapping positions are removed. And the distribution is renormalized. Repeated sampling produces distinct sets JJ of at most ℓ\ell non-overlapping positions. Replacing their corresponding spans with aa yields surrogate contexts zk,J∗z^*_{k,J}, collected in CkC_k.

Step 3: Screen sampled contexts. Before computing suffix gradients, we evaluate the sampled contexts with the current suffix ss fixed. For a target span of length LL in context cc, let mcm_c and pˉc\bar{p}_c denote the consecutive argmax matches and mean target-token probability up to the first mismatch, now evaluated on cc. The surrogate loss from Zhang et al. [43] is

LU(s;c)=−mc+pˉcL+1.(11)\mathcal{L}_{\mathrm{U}}(s;c)=-\frac{m_c+\bar{p}_c}{L+1}. \tag*{(11)}

For multiple target spans, their losses are summed. We retain the lowest-loss contexts from each CkC_k in Ck∗C_k^* and combine them across rollouts into C∗C^*.

Step 4: Update the adversarial suffix. For each retained context, we compute the target-sequence cross-entropy gradient with respect to the one-hot representation of the current suffix. These gradients are averaged across contexts, allowing the update to account for multiple stochastic rollouts.

The aggregated gradient is used to generate suffix candidates through token substitutions. Each candidate is evaluated by its mean surrogate loss over the retained contexts. And the candidate with the lowest mean loss becomes the suffix for the next optimization step.

EXPERIMENT

In this section, we present the main results of our method OPUR on three datasets across two different attack scenarios. These results demonstrate the effectiveness of our proposed probabilistic adversarial attack framework for red-teaming LLM agents.

Datasets

Following the evaluation protocol of UDora [43], we evaluate our method on three LLM-agent benchmarks covering two complementary attack scenarios: malicious instructions and malicious environments. AgentHarm [2] is used for the malicious-instruction setting and evaluates whether agents can be induced to execute explicitly harmful multi-step tasks while retaining sufficient task-completion capability. InjecAgent [39] represents the malicious-environment setting through indirect prompt injections embedded in external observations, covering attacks such as direct harm and data stealing. WebShop [35] provides an interactive e-commerce environment with multi-step search and click actions, allowing us to evaluate whether adversarially manipulated observations can steer agents toward unintended target products.

Experiment Setting

Baselines. We compare against three representative optimization-based jailbreak attacks: GCG, REINFORCE-GCG, and UDora. GCG [45] performs gradient-guided discrete suffix optimization toward a predefined affirmative target. REINFORCE-GCG [12] retains the GCG search procedure but replaces the fixed target-likelihood objective with an adaptive semantic reward. We also evaluate the Sequential and Joint variants of UDora [43], which optimize perturbations over intermediate reasoning trajectories.

Base LLMs. We evaluate all methods on two open-source instruction-tuned models, Llama-3.1-8B-Instruct ([13]) and Ministral-8B-Instruct-2410 ([16]) architectures.

Metrics. We use Attack Success Rate (ASR) ([8]) as the primary metric for evaluating jailbreak effectiveness:

ASR=NsuccessNtotal×100%,(12)\mathrm{ASR} = \frac{N_{\mathrm{success}}}{N_{\mathrm{total}}} \times100\%, \tag*{(12)}

where NsuccessN_{\mathrm{success}} denotes the number of successfully attacked samples and NtotalN_{\mathrm{total}} denotes the total number of evaluation samples.

Experiment Setting.

All agents use ReAct prompting ([36]). For InjecAgent and WebShop, the search width, gradient top-kk, and optimization steps are set to 128, 32, and 500, respectively, while AgentHarm uses 256, 64, and 1000. All adversarial suffixes are initialized with 25 repeated x tokens. The injected target is the adversarial tool name for InjecAgent and AgentHarm and the target product ASIN for WebShop. For UDora, we set num_locations to 2 for the Sequential variant and 4 for the Joint variant, corresponding to their strongest greedy configurations. For Opur, each rollout samples four distinct injection-position sets (injection_num_samples=4) from the Softmax distribution and retains the two candidates with the lowest probe loss (injection_num_keep=2) for subsequent suffix optimization. We evaluate UDora Sequential, UDora Joint, and Opur with optimization rollout budget Kopt∈{1,2,3}K_{\mathrm{opt}} \in\{1, 2, 3\}. During optimization, each baseline follows its original stochastic rollout configuration, while final evaluation uses a single rollout (Keval=1K_{\mathrm{eval}} = 1) with temperature 0.7 and top-p=0.9p = 0.9.

Results

For the malicious-instruction scenario, Table 1 summarizes the results on AgentHarm, with a qualitative example shown in Figure 3. On Llama-3.1-8B-Instruct, Opur achieves an average ASR of 75.00%, outperforming the strongest UDora baseline by 13.07% and showing consistent gains across all prompt settings. On Ministral-8B-Instruct-2410, performance is already near saturation, where Opur achieves 99.43% ASR and matches the strongest UDora variants.

ModelMethodDetailed Prompt w/ HintDetailed Prompt w/o HintSimple Prompt w/ HintSimple Prompt w/o HintAvg. ASR
Llama-3.1-8B-InstructGCG38.64%38.64%40.91%31.82%37.50%
Llama-3.1-8B-InstructReinforce-GCG59.09%50.00%50.00%43.18%50.57%
Llama-3.1-8B-InstructUDora (Sequential)56.82%63.64%61.36%65.91%61.93%
Llama-3.1-8B-InstructUDora (Joint)59.09%56.82%63.64%65.91%61.36%
Llama-3.1-8B-InstructOpur (Ours)72.73%75.00%72.73%79.55%75.00%
Ministral-8B-Instruct-2410GCG93.18%79.55%93.18%90.19%89.20%
Ministral-8B-Instruct-2410Reinforce-GCG100.00%97.73%100.00%95.45%98.30%
Ministral-8B-Instruct-2410UDora (Sequential)100.00%100.00%100.00%97.73%99.43%
Ministral-8B-Instruct-2410UDora (Joint)100.00%100.00%100.00%97.73%99.43%
Ministral-8B-Instruct-2410Opur (Ours)100.00%97.73%100.00%100.00%99.43%

Table 1. Attack success rates (%) on AgentHarm under different attack categories. The best results for each model are highlighted in bold.

A real OPUR trajectory on AgentHarm

Figure 3. A real OPUR trajectory on AgentHarm. Two stochastic rollouts from the same user-side adversarial suffix produce a refusal and a response containing the target function query_bing_search. OPUR retains one training-only surrogate context from the refusal; for the other rollout, it samples four position sets via softmax and retains two using probe loss. The three retained contexts guide one suffix update. Both subsequent optimization rollouts hit the target, and evaluation of the final suffix also succeeds.

For InjecAgent, Table 2 summarizes the results, with a qualitative example shown in Figure 4. Opur achieves the highest average ASR on both models, reaching 49% on Llama-3.1-8B-Instruct and 40% on Ministral-8B-Instruct-2410, each improving over the strongest baseline by 2 percentage points. Although the gains are smaller than on AgentHarm, they remain consistent across both model families.

ModelMethodAttack CategoriesAvg. ASR
Llama-3.1-8B-InstructGCGDirect Harm26%34%30%
Llama-3.1-8B-InstructREINFORCE-GCG46%48%47%
Llama-3.1-8B-InstructUDora (Sequential)44%44%44%
Llama-3.1-8B-InstructUDora (Joint)36%56%46%
Llama-3.1-8B-InstructOpur (Ours)48%50%49%
Ministral-8B-Instruct-2410GCG32%30%31%
Ministral-8B-Instruct-2410REINFORCE-GCG44%32%38%
Ministral-8B-Instruct-2410UDora (Sequential)26%28%27%
Ministral-8B-Instruct-2410UDora (Joint)20%36%28%
Ministral-8B-Instruct-2410Opur (Ours)42%38%40%

Table 2. Attack success rates (%) on InjecAgent under different attack categories. The best results for each model are highlighted in bold.

A real OPUR trajectory on InjecAgent, showing an attacker-controlled SMS suffix causing the target action BankManagerTransferFunds to appear in optimization rollouts and final evaluation

Figure 4. A real OPUR trajectory on InjecAgent. The attacker-controlled SMS returned by TwilioGetReceivedSmsMessages carries the adversarial suffix. Two initial stochastic rollouts from this suffix both omit the target action BankManagerTransferFunds. For each rollout, OPUR samples 4 position sets via softmax and retains two using probe loss, providing four training-only surrogate contexts for a suffix update. After several updates, both optimization rollouts contain Action: BankManagerTransferFunds. In the final evaluation, the updated suffix generates the target action.

For WebShop, Table 3 reports the results, with a qualitative example shown in Figure 5. Opur achieves the highest average ASR on both models, reaching 26.67% on Llama-3.1-8B-Instruct and 36.67% on Ministral-8B-Instruct-2410, outperforming the strongest baseline by 8.34% on both models. It performs best on three of four attack categories on Llama and on all four categories on Ministral, demonstrating strong effectiveness in the WebShop malicious-environment setting.

ModelMethodAttack CategoriesAvg. ASR
Llama-3.1-8B-InstructGCGPrice Mismatch0.00%0.00%0.00%0.00%0.00%
Llama-3.1-8B-InstructREINFORCE-GCG26.67%0.00%0.00%0.00%6.67%
Llama-3.1-8B-InstructUDora (Sequential)6.67%40.00%13.33%13.33%18.33%
Llama-3.1-8B-InstructUDora (Joint)20.00%33.33%6.67%6.67%16.67%
Llama-3.1-8B-InstructOpur (Ours)13.33%40.00%33.33%20.00%26.67%
Ministral-8B-Instruct-2410GCG6.67%13.33%6.67%0.00%6.67%
Ministral-8B-Instruct-2410REINFORCE-GCG13.33%6.67%6.67%0.00%6.67%
Ministral-8B-Instruct-2410UDora (Sequential)26.67%40%33.33%13.33%28.33%
Ministral-8B-Instruct-2410UDora (Joint)13.33%26.67%33.33%6.67%20.00%
Ministral-8B-Instruct-2410Opur (Ours)33.33%53.33%40.00%20.00%36.67%

Table 3. Attack success rates (%) on WebShop under different attack categories. The best results for each model are highlighted in bold.

OPUR trajectory on WebShop showing an adversarial suffix redirecting an agent from RCA cables to a coffee product

Figure 5. A real OPUR trajectory on WebShop. The attacker appends an adversarial suffix to a coffee item’s search-result title, aiming to redirect an agent searching for RCA cables toward click[B08KRVH121]. Two initial stochastic rollouts click other items. For each rollout, OPUR samples four replacement-position sets via softmax and retains two training-only surrogate contexts using probe loss.The four retained contexts guide a suffix update. After further updates,both optimization rollouts contain the target click. In evaluation, the agent outputs click[B08KRVH121] despite stating that the item is not a heavy-duty RCA cable.

Ablation

We study the effect of the optimization rollout budget Kopt∈{1,2,3}K_{\mathrm{opt}} \in\{1, 2, 3\}, which controls how many stochastic rollouts contribute to each suffix update; corresponding UDora ablations are reported in Appendix § 13. As shown in Table 4, larger KoptK_{\mathrm{opt}} generally improves Opur, although the gains are not strictly monotonic across benchmarks. On Llama-3.1-8B-Instruct, ASR increases from 56.82% to 75.00% on AgentHarm and from 5.00% to 26.67% on WebShop, while InjecAgent improves from 46.00% to 49.00%. Similar gains are observed on Ministral for InjecAgent (30.00% →\rightarrow 40.00%) and WebShop (11.67% →\rightarrow 36.67%). We omit larger KoptK_{\mathrm{opt}} values for Ministral on AgentHarm because performance already saturates at 99.43% for Kopt=1K_{\mathrm{opt}} = 1.

ModelKoptK_{\mathrm{opt}}AgentHarmInjecAgentWebShop
Llama-3.1-8B-Instruct156.82%46.00%5.00%
Llama-3.1-8B-Instruct263.07%45.00%15.00%
Llama-3.1-8B-Instruct375.00%49.00%26.67%
Ministral-8B-Instruct-2410199.43%30.00%11.67%
Ministral-8B-Instruct-24102–34.00%16.67%
Ministral-8B-Instruct-24103–40.00%36.67%

Table 4. Ablation study on the optimization rollout budget KoptK_{\mathrm{opt}} for Opur. We report average attack success rates (%) on three benchmarks. “–” denotes configurations that are not evaluated because performance has already saturated.

Related Work

Adversarial Attacks on LLMs. LLM jailbreaks span gradient-based, gradient-free, and automated black-box search. Representative optimization-based methods include GCG [45], AutoDAN [21], BEAST [26], AdvPrompter [25], and COLD-Attack [15]. Black-box and automated strategies further include PAIR [5], TAP [23], DRA [20], MASTERKEY [10], LLM-Fuzzer [37], DeepInception [18], persuasive jailbreaks [38], and AutoDAN-Turbo [22]. While these works primarily advance how adversarial prompts are searched or constructed, we instead revisit the probabilistic objective underlying jailbreak optimization.

Jailbreak Objectives and Probabilistic Attacks. Recent work has revisited jailbreak objectives from target- and distribution-level perspectives. AdvPrefix selects model-dependent targets [44], REINFORCE optimizes adaptive semantic rewards [12], and AmpleGCG models diverse adversarial suffixes [19]. Other attacks explore adaptive search, black-box optimization, output-prefix forcing, trigger-level objectives, and iterative generation [1, 10, 17, 32, 29, 34] (Wang & Qi 2025). Sampling-aware and distribution-based attacks further exploit stochastic generation and output distributions [3, 11], while recent benchmarks highlight sensitivity to generation and evaluation protocols [4, 28, 8, 27]. In contrast, we derive a tractable likelihood-based objective directly from expected harmfulness.

Jailbreaking LLM Agents. LLM agents introduce broader attack surfaces through tools, memory, retrieval, and multi-step actions [14, 24]. InjecAgent [39], AgentDojo [9], Agent Security Bench [42], and AgentHarm [2] evaluate these vulnerabilities, while UDora [43], BadAgent [31], and AgentPoison [7] target agent reasoning, memory, or behavior. Unlike these agent-specific mechanisms, we focus on reformulating the objective used to optimize adversarial agent behaviour.

CONCLUSION

The security of LLM agents is fundamentally distributional: an attack does not merely seek a single harmful response, but attempts to shift the model’s behavioral distribution toward harmful outcomes. In this work, we reformulate expected harmfulness with likelihood through a harmfulness-reweighted response distribution, and instantiate this perspective with OPUR, which constructs a practical surrogate distribution from model-generated rollouts. Our experiments show that this probabilistic view leads to stronger targeted attacks under stochastic generation.

More broadly, our results suggest a different way to think about jailbreaks. Rather than treating harmful generations as isolated failures, they can be viewed as changes in how probability mass is distributed over possible agent behaviors. From this perspective, likelihood optimization becomes a practical interface between behavioral risk and adversarial optimization. We hope this view encourages future work to move beyond individual attack trajectories and toward understanding, evaluating, and ultimately controlling the full distribution of behaviors that LLM agents may exhibit.

Acknowledgments

The work presented in this paper has been supported by UKRI Future Leaders Fellowship (Grant MR/S035176/1) and funded by the European Union under the Horizon Europe project AIGGRE-GATE (AI-enhanced collective intelligence for resilient, ethical and user-centric awareness and decision making in CCAM applications, Grant Agreement No. 101202457). Views and opinions expressed are those of the author(s) only and do not necessarily reflect those of the European Union. Neither the European Union nor the granting authority can be held responsible for them.

AI Use Statement

In this work, we used generative AI tools to aid and polish the writing, including improving clarity, grammar, and presentation, and for retrieval and discovery purposes, such as identifying potentially relevant literature. All retrieved references and related-work suggestions were independently verified by the authors against the original sources before being included in the paper.

We did not use generative AI tools for research ideation or execution, drafting substantive sections of the paper, generating synthetic datasets, or proving mathematical claims. All technical arguments, mathematical derivations, experimental designs, implementations, analyses, and conclusions were developed and verified by the authors.

We have reviewed all AI-assisted content and take responsibility for the final content of this work, including any text, claims, or artifacts produced with the aid of generative AI.

Ethics Statement

This work investigates adversarial attacks against LLM agents and thus has potential dual-use implications. The proposed framework is intended to expose limitations of current agent safety mechanisms under stochastic generation and to facilitate more rigorous adversarial evaluation. However, techniques that improve attack effectiveness could also be misused to elicit unsafe behaviors from deployed agents.

We mitigate these risks by conducting all experiments in controlled research environments using established benchmarks, without targeting real users, accounts, or deployed services. This work does not involve human subjects or the collection of private user data. To support transparency and reproducibility, we make our code and benchmark configurations publicly available for research and safety evaluation purposes. The released artifacts are intended to facilitate independent verification, benchmarking, and the development of stronger defenses rather than real-world exploitation.

We believe that systematically identifying these vulnerabilities is important for developing stronger defenses and more reliable safety evaluations for LLM agents. By openly documenting the attack methodology and evaluation setting, we aim to help the research community better understand failure modes of current agent systems and improve their robustness. We encourage the use of the released methods, code, and benchmarks for responsible security research and the development of safer and more trustworthy AI systems.

Reproducibility Statement

We provide an anonymous implementation of our method, evaluation code, and experiment configurations at https://github.com/Hax1on/OPUR.git. The main paper specifies the attack formulation, datasets, baselines, model settings, optimization parameters, decoding configurations, and evaluation protocol used throughout our experiments. All experiments are conducted on publicly available benchmarks and model checkpoints. Together with the released code and configurations, these details are intended to support faithful reproduction of the reported results.

Proof of the Theorems

Theorem 1 (REINFORCE Gradient for Expected Harmfulness). Assume that pθ(y∣x,s)p_\theta(y \mid x,s) is differentiable with respect to ss, its support does not depend on ss, ψ(y)\psi(y) does not explicitly depend on ss, and differentiation and expectation can be interchanged. Then

∇sEY∼pθ(⋅∣x,s)[ψ(Y)]=EY∼pθ(⋅∣x,s)[ψ(Y)∇slog⁡pθ(Y∣x,s)].\nabla_s \mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] = \mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)\nabla_s \log p_\theta(Y\mid x,s)].

Proof.

∇sEY∼pθ(⋅∣x,s)[ψ(Y)]=∇s∫pθ(y∣x,s) ψ(y) dy=∫ψ(y) ∇spθ(y∣x,s) dy=∫pθ(y∣x,s) ψ(y) ∇slog⁡pθ(y∣x,s) dy=EY∼pθ(⋅∣x,s)[ψ(Y)∇slog⁡pθ(Y∣x,s)].\begin{aligned} \nabla_s\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] &= \nabla_s \int p_\theta(y\mid x,s)\,\psi(y)\,dy \\ &= \int\psi(y)\,\nabla_s p_\theta(y\mid x,s)\,dy \\ &= \int p_\theta(y\mid x,s)\,\psi(y)\,\nabla_s\log p_\theta(y\mid x,s)\,dy \\ &= \mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)\nabla_s\log p_\theta(Y\mid x,s)]. \end{aligned}

Theorem 2 (Equivalence between Expected Harmfulness and Likelihood Gradients). Assuming differentiation and expectation can be interchanged, the gradient of the log expected harmfulness can be expressed as the expected log-likelihood gradient under the harmfulness-reweighted response distribution π\pi:

∇slog⁡EY∼pθ(⋅∣x,s)[ψ(Y)]=EY∼π[∇slog⁡pθ(Y∣x,s)]\nabla_s \log\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(Y)] = \mathbb{E}_{Y\sim\pi}[\nabla_s\log p_\theta(Y\mid x,s)]

Proof.

∇slog⁡EY∼pθ(⋅∣x,s)[ψ(r)]=∇slog⁡∫pθ(y∣x,s)ψ(y) dy=∇s∫pθ(y∣x,s)ψ(y) dy∫pθ(y∣x,s)ψ(y) dy=∫ψ(y)∇spθ(y∣x,s) dy∫pθ(y∣x,s)ψ(y) dy=∫ψ(y)pθ(y∣x,s)∇slog⁡pθ(y∣x,s) dy∫pθ(y∣x,s)ψ(y) dy=∫π(y∣x,s)∇slog⁡pθ(y∣x,s) dy=EY∼π[∇slog⁡pθ(Y∣x,s)].\begin{aligned} \nabla_s\log\mathbb{E}_{Y\sim p_\theta(\cdot\mid x,s)}[\psi(r)] &= \nabla_s\log\int p_\theta(y\mid x,s)\psi(y)\,dy \\ &= \frac{\nabla_s\int p_\theta(y\mid x,s)\psi(y)\,dy}{\int p_\theta(y\mid x,s)\psi(y)\,dy} \\ &= \frac{\int\psi(y)\nabla_s p_\theta(y\mid x,s)\,dy}{\int p_\theta(y\mid x,s)\psi(y)\,dy} \\ &= \frac{\int\psi(y)p_\theta(y\mid x,s)\nabla_s\log p_\theta(y\mid x,s)\,dy}{\int p_\theta(y\mid x,s)\psi(y)\,dy} \\ &= \int\pi(y\mid x,s)\nabla_s\log p_\theta(y\mid x,s)\,dy \\ &= \mathbb{E}_{Y\sim\pi}[\nabla_s\log p_\theta(Y\mid x,s)]. \end{aligned}

Detail of Ablation

AgentHarm Ablation. As shown in Table 5, Opur consistently achieves the highest average ASR across all values of KoptK_{\mathrm{opt}}. Its average ASR increases from 56.82% at Kopt=1K_{\mathrm{opt}} = 1 to 63.07% at Kopt=2K_{\mathrm{opt}} = 2, and further to 75.00% at Kopt=3K_{\mathrm{opt}} = 3. In comparison, the strongest UDora baseline reaches only 61.93% at Kopt=3K_{\mathrm{opt}} = 3, leaving a 13.07 percentage-point gap. These results indicate that aggregating more stochastic optimization rollouts can substantially improve attack effectiveness, particularly when sufficient rollout diversity is available.

KoptK_{\mathrm{opt}}MethodDetailed Prompt w/ HintDetailed Prompt w/o HintSimple Prompt w/ HintSimple Prompt w/o HintAvg. ASR
1UDora (Sequential)59.09%50.00%50.00%43.18%50.57%
1UDora (Joint)43.18%38.64%47.73%50.00%44.89%
1Opur (Ours)56.82%56.82%59.09%59.09%56.82%
2UDora (Sequential)61.36%47.73%68.18%56.82%58.52%
2UDora (Joint)52.27%65.91%61.36%59.09%59.66%
2Opur (Ours)68.18%63.64%61.36%59.09%63.07%
3UDora (Sequential)56.82%63.64%61.36%65.91%61.93%
3UDora (Joint)59.09%56.82%63.64%65.91%61.36%
3Opur (Ours)72.73%75.00%72.73%79.55%75.00%

Table 5. Ablation study of KoptK_{\mathrm{opt}} on AgentHarm using Llama-3.1-8B-Instruct. We report attack success rates (%) under different attack categories.

InjecAgent Ablation. As shown in Table 6, Opur achieves the highest average ASR for all tested KoptK_{\mathrm{opt}} settings, with a tie at Kopt=1K_{\mathrm{opt}} = 1 on Llama-3.1-8B-Instruct. On Llama, the average ASR varies from 46.00% to 45.00% and then increases to 49.00% as KoptK_{\mathrm{opt}} grows from 1 to 3, indicating that the benefit is not strictly monotonic. In contrast, Ministral shows a clearer trend, improving from 30.00% to 34.00% and further to 40.00%. Overall, larger rollout aggregation provides the strongest performance at Kopt=3K_{\mathrm{opt}} = 3 on both models.

ModelKoptK_{\mathrm{opt}}MethodDirect HarmData StealingAvg. ASR
Llama-3.1-8B-Instruct1UDora (Sequential)44.00%44.00%44.00%
Llama-3.1-8B-Instruct1UDora (Joint)36.00%56.00%46.00%
Llama-3.1-8B-Instruct1Opur (Ours)38.00%54.00%46.00%
Llama-3.1-8B-Instruct2UDora (Sequential)32.00%48.00%40.00%
Llama-3.1-8B-Instruct2UDora (Joint)44.00%44.00%44.00%
Llama-3.1-8B-Instruct2Opur (Ours)32.00%58.00%45.00%
Llama-3.1-8B-Instruct3UDora (Sequential)30.00%48.00%39.00%
Llama-3.1-8B-Instruct3UDora (Joint)38.00%32.00%35.00%
Llama-3.1-8B-Instruct3Opur (Ours)48.00%50.00%49.00%
Ministral-8B-Instruct-24101UDora (Sequential)26.00%28.00%27.00%
Ministral-8B-Instruct-24101UDora (Joint)20.00%36.00%28.00%
Ministral-8B-Instruct-24101Opur (Ours)38.00%22.00%30.00%
Ministral-8B-Instruct-24102UDora (Sequential)36.00%18.00%27.00%
Ministral-8B-Instruct-24102UDora (Joint)30.00%16.00%23.00%
Ministral-8B-Instruct-24102Opur (Ours)38.00%30.00%34.00%
Ministral-8B-Instruct-24103UDora (Sequential)24.00%34.00%29.00%
Ministral-8B-Instruct-24103UDora (Joint)42.00%26.00%34.00%
Ministral-8B-Instruct-24103Opur (Ours)42.00%38.00%40.00%

Table 6. Ablation study of KoptK_{\mathrm{opt}} on InjecAgent under different attack categories. We report attack success rates (%).

WebShop Ablation. As shown in Table 7, increasing KoptK_{\mathrm{opt}} consistently improves the average ASR of Opur on both models. On Llama-3.1-8B-Instruct, the average ASR increases from 5.00% at Kopt=1K_{\mathrm{opt}} = 1 to 15.00% at Kopt=2K_{\mathrm{opt}} = 2 and further to 26.67% at Kopt=3K_{\mathrm{opt}} = 3. A similar trend is observed on Ministral-8B-Instruct-2410, where the ASR rises from 11.67% to 16.67% and finally to 36.67%. At Kopt=3K_{\mathrm{opt}} = 3, Opur also achieves the strongest average performance on both models, suggesting that broader rollout aggregation is particularly beneficial for the more complex WebShop interaction setting.

ModelKoptK_{\mathrm{opt}}MethodPrice MismatchAttribute MismatchCategory MismatchAll MismatchAvg. ASR
Llama-3.1-8B-Instruct1UDora (Sequential)13.33%13.33%6.67%0.00%8.33%
Llama-3.1-8B-Instruct1UDora (Joint)6.67%13.33%13.33%0.00%8.33%
Llama-3.1-8B-Instruct1Opur (Ours)0.00%6.67%13.33%0.00%5.00%
Llama-3.1-8B-Instruct2UDora (Sequential)6.67%26.67%13.33%6.67%11.67%
Llama-3.1-8B-Instruct2UDora (Joint)6.67%20.00%6.67%0.00%8.33%
Llama-3.1-8B-Instruct2Opur (Ours)6.67%13.33%20.00%13.33%15.00%
Llama-3.1-8B-Instruct3UDora (Sequential)6.67%40.00%13.33%13.33%18.33%
Llama-3.1-8B-Instruct3UDora (Joint)20.00%33.33%6.67%6.67%16.67%
Llama-3.1-8B-Instruct3Opur (Ours)13.33%40.00%33.33%20.00%26.67%
Ministral-8B-Instruct-24101UDora (Sequential)13.33%13.33%6.67%0.00%8.33%
Ministral-8B-Instruct-24101UDora (Joint)13.33%6.67%6.67%0.00%5.00%
Ministral-8B-Instruct-24101Opur (Ours)20.00%20.00%6.67%0.00%11.67%
Ministral-8B-Instruct-24102UDora (Sequential)13.33%20.00%6.67%13.33%13.33%
Ministral-8B-Instruct-24102UDora (Joint)20.00%13.33%26.67%6.67%18.33%
Ministral-8B-Instruct-24102Opur (Ours)13.33%26.67%20.00%6.67%16.67%
Ministral-8B-Instruct-24103UDora (Sequential)26.67%40.00%33.33%13.33%28.33%
Ministral-8B-Instruct-24103UDora (Joint)13.33%26.67%33.33%6.67%20.00%
Ministral-8B-Instruct-24103Opur (Ours)33.33%53.33%40.00%20.00%36.67%

Table 7. Ablation study of KoptK_{\mathrm{opt}} on WebShop under different attack categories. We report attack success rates (%).

OPUR ON REAL WORLD AGENT

This appendix section presents three examples corresponding to the three benchmarks used in the operation of OPUR.

Figure 3 shows a representative OPUR trajectory. Two stochastic rollouts produce surrogate contexts through probabilistic position sampling and probe-based screening, which jointly guide a suffix update and lead to successful subsequent attacks. Both rollouts use Softmax sampling; however, Rollout 1 has only one feasible interval, so the distribution degenerates to a single choice, whereas Rollout 2 has 300 intervals and supports sampling and filtering multiple position sets.

Figure 4 shows a representative OPUR trajectory under an attacker-controlled environment. Although neither initial rollout produces the target banking action, probabilistic position sampling and probe-based screening construct multiple surrogate contexts that jointly guide the adversarial suffix update. The updated suffix subsequently causes both optimization rollouts, as well as the final evaluation rollout, to generate the target BankManagerTransferFunds action, while all surrogate replacements remain training-only.

Figure 5 illustrates a representative OPUR trajectory on WebShop. The adversarial suffix is attached to an attacker-controlled product title in the search results, while neither initial stochastic rollout selects the target item. OPUR samples candidate replacement positions from both rollouts, retains promising surrogate contexts through probe-based screening, and aggregates them to update the shared suffix. After the update, both regenerated rollouts contain the target action click[B08KRVH121], and the same target click is observed during final evaluation. The surrogate replacements are used only for optimization and do not modify the agent’s actual generated responses.

References

  1. [1]Makysm Andriushchenko, Nicolas Flammarion, et al. Jailbreaking leading safety-aligned llms with simple adaptive attacks. In International Conference on Learning Representations, volume 2025, pp. 40116–40143, 2025a.arxiv.org/abs/2404.02151
  2. [2]Maksym Andriushchenko, Alexandra Souly, Mateusz Dziemian, Derek Duenas, Maxwell Lin, Justin Wang, Dan Hendrycks, Andy Zou, Zico Kolter, Matt Fredrikson, et al. Agent­harm: A benchmark for measuring harmfulness of llm agents. In International Conference on Learning Representations, volume 2025, pp. 79185–79220, 2025b.arxiv.org/abs/2410.09024
  3. [3]Tim Beyer, Yan Scholten, Leo Schwinn, and Stephan Günnemann. Sampling-aware adversarial attacks against large language models. In International Conference on Learning Representations, volume 2026, pp. 74637–74663, 2026.arxiv.org/abs/2507.04446
  4. [4]Patrick Chao, Edoardo Debenedetti, Alexander Robey, Maksym Andriushchenko, Francesco Croce, Vikash Sehwag, Edgar Dobriban, Nicolas Flammarion, George J Pappas, Florian Tramer, et al. Jailbreakbench: An open robustness benchmark for jailbreaking large language models. Advances in Neural Information Processing Systems, 37:55005–55029, 2024.arxiv.org/abs/2404.01318
  5. [5]Patrick Chao, Alexander Robey, Edgar Dobriban, Hamed Hassani, George J Pappas, and Eric Wong. Jailbreaking black box large language models in twenty queries. In 2025 IEEE Conference on Secure and Trustworthy Machine Learning (SaTML), pp. 23–42. IEEE, 2025.arxiv.org/abs/2310.08419
  6. [6]Yen-Shan Chen, Zhi Rui Tam, Cheng-Kuang Wu, and Yun-Nung Chen. Expected harm: Rethinking safety evaluation of (mis) aligned llms. arXiv preprint arXiv:2602.01600, 2026.arxiv.org/abs/2602.01600
  7. [7]Zhaorun Chen, Zhen Xiang, Chaowei Xiao, Dawn Song, and Bo Li. Agentpoison: Red-teaming llm agents via poisoning memory or knowledge bases. Advances in Neural Information Processing Systems, 37:130185–130213, 2024.arxiv.org/abs/2407.12784
  8. [8]Junjie Chu, Yugeng Liu, Ziqing Yang, Xinyue Shen, Michael Backes, and Yang Zhang. Jail-breaker: Comprehensive assessment of jailbreak attacks against llms. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 21538–21566, 2025.DOI
  9. [9]Edoardo Debenedetti, Jie Zhang, Mislav Balunovic, Luca Beurer-Kellner, Marc Fischer, and Florian Tramèr. Agentdojo: A dynamic environment to evaluate prompt injection attacks and defenses for llm agents. Advances in neural information processing systems, 37:82895–82920, 2024.arxiv.org/abs/2406.13352
  10. [10]Gelei Deng, Yi Liu, Yuekang Li, Kailong Wang, Ying Zhang, Zefeng Li, Haoyu Wang, Tianwei Zhang, and Yang Liu. Masterkey: Automated jailbreak across multiple large language model chatbots. arXiv preprint arXiv:2307.08715, 2023.DOI
  11. [11]Shuangjie Fu, Du Su, Xin Chen, Fei Sun, Huawei Shen, and Xueqi Cheng. Steering away from refusal: A black-box jailbreak method based on first-token distribution. In Findings of the Association for Computational Linguistics: ACL 2026, pp. 25969–25979, 2026.DOI
  12. [12]Simon Geisler, Tom Wollschläger, MHI Abdalla, Vincent Cohen-Addad, Johannes Gasteiger, and Stephan Günnemann. Conference adversarial attacks on large language models: An adaptive, distributional, and semantic objective. arXiv preprint arXiv:2502.17254, 2025.arxiv.org/abs/2502.17254
  13. [13]Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhari, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024.arxiv.org/abs/2407.21783
  14. [14]Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, and Mario Fritz. Not what you’ve signed up for: Compromising real-world llm-integrated applications with indirect prompt injection. In Proceedings of the 16th ACM workshop on artificial intelligence and security, pp. 79–90, 2023.arxiv.org/abs/2302.12173
  15. [15]Xingang Guo, Fangxu Yu, Huan Zhang, Jianhui Qin, and Bin Hu. Cold-attack: Jailbreaking llms with stealthiness and controllability. arXiv preprint arXiv:2402.08679, 2024.arxiv.org/abs/2402.08679
  16. [16]Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chap­lot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7b, 2023. URL https://arxiv.org/abs/2310.06825.
  17. [17]Weipeng Jiang, Zhenting Wang, Juan Zhai, Shiqing Ma, Zhengyu Zhao, and Chao Shen. An optimizable suffix is worth a thousand templates: Efficient black-box jailbreaking without affirmative phrases via llm as optimizer. In Findings of the Association for Computational Linguistics: NAACL 2025, pp. 5486–5498, 2025.arxiv.org/abs/2408.11313
  18. [18]Xuan Li, Zhanke Zhou, Jianing Zhu, Jiangchao Yao, Tongliang Liu, and Bo Han. Deepinception: Hypnotize large language model to be jailbreaker. arXiv preprint arXiv:2311.03191, 2023.arxiv.org/abs/2311.03191
  19. [19]Zeyi Liao and Huan Sun. Amplegcb: Learning a universal and transferable generative model of adversarial suffixes for jailbreaking both open and closed llms. arXiv preprint arXiv:2404.07921, 2024.
  20. [20]Tong Liu, Yingjie Zhang, Zhe Zhao, Yinpeng Dong, Guozhu Meng, and Kai Chen. Making them ask and answer: Jailbreaking large language models in few queries via disguise and reconstruction. In 33rd USENIX Security Symposium (USENIX Security 24), pp. 4711–4728, 2024a.
  21. [21]Xiaogeng Liu, Nan Xu, Muhao Chen, and Chaowei Xiao. Autodan: Generating stealthy jailbreak prompts on aligned large language models. In International Conference on Learning Representations, volume 2024, pp. 56174–56194, 2024b.
  22. [22]Xiaogeng Liu, Peiran Li, G Edward Suh, Yevgeniy Vorobeychik, Zhuoqing Mao, Somesh Jha, Patrick McDaniel, Huan Sun, Bo Li, and Chaowei Xiao. Autodan-turbo: A lifelong agent for strategy self-exploration to jailbreak llms. In International Conference on Learning Representations, volume 2025, pp. 10313–10360, 2025.
  23. [23]Anay Mehrotra, Manolis Zampetakis, Paul Kassianik, Blaine Nelson, Hyrum Anderson, Yaron Singer, and Amin Karbasi. Tree of attacks: Jailbreaking black-box llms automatically. Advances in Neural Information Processing Systems, 37:61065–61105, 2024.
  24. [24]Lingbo Mo, Zeyi Liao, Boyuan Zheng, Yu Su, Chaowei Xiao, and Huan Sun. A trembling house of cards? mapping adversarial attacks against language agents. arXiv preprint arXiv:2402.10196, 2024.
  25. [25]Anselm Paulus, Arman Zharmagambetov, Chuan Guo, Brandon Amos, and Yuandong Tian. Advprompter: Fast adaptive adversarial prompting for llms. arXiv preprint arXiv:2404.16873, 2024.
  26. [26]Vinu Sankar Sadasivan, Shoumik Saha, Gaurang Sriramanan, Priyatham Kattakinda, Atoosa Chegini, and Soheil Feizi. Fast adversarial attacks on language models in one gpu minute. arXiv preprint arXiv:2402.15570, 2024.
  27. [27]Yan Scholten, Stephan Günnemann, and Leo Schwinn. A probabilistic perspective on unlearning and alignment for large language models. In International Conference on Learning Representations, volume 2025, pp. 49420–49436, 2025.
  28. [28]Alexandra Souly, Qingyuan Lu, Dillon Bowen, Tu Trinh, Elvis Hsieh, Sana Pandey, Pieter Abbeel, Justin Svegliato, Scott Emmons, Olivia Watkins, et al. A strongrect for empty jailbreaks. Advances in Neural Information Processing Systems, 37:125416–125440, 2024.
  29. [29]Chung-En Sun, Xiaodong Liu, Weiwei Yang, Tsui-Wei Weng, Hao Cheng, Aidan San, Michel Galley, and Jianfeng Gao. Iterative self-tuning llms for enhanced jailbreaking capabilities. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pp. 5768–5786, 2025.arxiv.org/abs/2410.18469
  30. [31]Yifei Wang, Dizhan Xue, Shengjie Zhang, and Shengsheng Qian. Badagent: Inserting and activating backdoor attacks in llm agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9811–9827, 2024.
  31. [32]Yiwei Wang, Muhao Chen, Nanyun Peng, and Kai-Wei Chang. Vulnerability of large language models to output prefix jailbreaks: Impact of positions on safety. In Findings of the Association for Computational Linguistics: NAACL 2025, pp. 3939–3952, 2025.
  32. [33]Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3):229–256, 1992.
  33. [34]Suhuang Wu, Huimin Wang, Yutian Zhao, Xian Wu, Yefeng Zheng, Wei Li, Hui Li, and Rongrong Ji. Monte carlo tree search based prompt autogeneration for jailbreak attacks against llms. In Proceedings of the 31st International Conference on Computational Linguistics, pp. 1057–1068, 2025.
  34. [35]Shunyu Yao, Howard Chen, John Yang, and Karthik Narasimhan. Webshop: Towards scalable real-world web interaction with grounded language agents. Advances in Neural Information Processing Systems, 35:20744–20757, 2022a.arxiv.org/abs/2207.01206
  35. [36]Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022b.arxiv.org/abs/2210.03629
  36. [37]Jiahao Yu, Xingwei Lin, Zheng Yu, and Xinyu Xing. {LLM-Fuzzer}: Scaling assessment of large language model jailbreaks. In 33rd USENIX Security Symposium (USENIX Security 24), pp. 4657–4674, 2024.
  37. [38]Yi Zeng, Hongpeng Lin, Jingwen Zhang, Diyi Yang, Ruoxi Jia, and Weiyan Shi. How johnny can persuade llms to jailbreak them: Rethinking persuasion to challenge ai safety by humanizing llms. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 14322–14350, 2024.arxiv.org/abs/2401.06373
  38. [39]Qiusi Zhan, Zhixiang Liang, Zifan Ying, and Daniel Kang. Injecagent: Benchmarking indirect prompt injections in tool-integrated large language model agents. In Findings of the Association for Computational Linguistics: ACL 2024, pp. 10471–10506, 2024.arxiv.org/abs/2403.02691
  39. [40]Andi Zhang, Mingtian Zhang, and Damon Wischik. Constructing semantics-aware adversarial examples with a probabilistic perspective. Advances in Neural Information Processing Systems, 37: 136259–136285, 2024.arxiv.org/abs/2306.00353
  40. [41]Andi Zhang, Xuan Ding, Steven McDonagh, and Samuel Kaski. Concept-based adversarial attack: a probabilistic perspective. In International Conference on Learning Representations, volume 2026, pp. 73613–73646, 2026.arxiv.org/abs/2507.02965
  41. [42]Hanrong Zhang, Jingyuan Huang, Kai Mei, Yifei Yao, Zhenting Wang, Chenlu Zhan, Hongwei Wang, and Yongfeng Zhang. Agent security bench (asb): Formalizing and benchmarking attacks and defenses in llm-based agents. In International Conference on Learning Representations, volume 2025, pp. 35331–35366, 2025a.arxiv.org/abs/2410.02644
  42. [43]Jiawei Zhang, Shuang Yang, and Bo Li. Udora: A unified red teaming framework against llm agents by dynamically hijacking their own reasoning. arXiv preprint arXiv:2503.01908, 2025b.arxiv.org/abs/2503.01908
  43. [44]Sicheng Zhu, Brandon Amos, Yuandong Tian, Chuan Guo, and Ivan Evtimov. Advprefix: An objective for nuanced llm jailbreaks. Advances in Neural Information Processing Systems, 38: 89990–90014, 2026.arxiv.org/abs/2412.10321
  44. [45]Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial attacks on aligned language models. arXiv preprint arXiv:2307.15043, 2023.arxiv.org/abs/2307.15043

Machine contribution statement

This work lists 1 machine contributor.

  • generative AI tools · AI contributor

    Roles
    InvestigationWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How machine contributions are recorded

Paper details

Citation

Cite
Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Contents

Pick where to look, or just type