Stop obsessing over prompts: reasoning hijacking and constraint tightening for red-teaming LLM agentsStop Fixating on Prompts: Reasoning Hijacking and Constraint Tightening for Red-Teaming LLM Agents
JailAgent does not modify user prompts and hijacks reasoning and retrieval; the authors state that ALL is higher than the three baseline groups, but there are counterexamples in cell-by-cell ASR.
The memory store is white-box, allowing a small number of malicious instances to be injected; the core LLM cannot be accessed directly, so a local logprob model approximates its distribution via same-prompt input estimation. The goal is to manipulate the reward R(s), causing the agent to perform unintended actions while still obtaining correct results.
- After LLM agents are used for video, clinical, and question-answering tasks, memory, planning, and tool calling expand the attack surface. The authors state that existing red teaming mostly modifies user prompts, adapts poorly when data or targets change, deviates from the original intent, and is more easily detected by defenses.
- JailAgent does not modify the original prompt. First, it selects high-contribution triggers using syntactic grouping and log-probability and stepwise KL; then it synthesizes paired data on the fly, fine-tunes a scoring head on a frozen encoder to rerank candidates; finally, it tightens trigger embeddings with four losses and injects malicious instances into the memory store.
- Across 3 agent types, 7 LLM cores, and 8 datasets, the authors state JailAgent's ALL is higher than three baselines, TCPS is lower, and task metrics are closer to non-attack; individual ASR cells are higher for baselines.
- The authors note that reliance on a shadow model may degrade under full black-box conditions; real-time adaptation incurs additional overhead; validation is mainly on predefined tasks and standardized environments. The experiments report ASR and TCPS across 3 types of agents and 8 datasets; the shadow model name, the ASR-L review model, and the number of repetitions are not reported in the paper.
- Evaluated models
- GPT-3.5-turboGPT-4oGPT-5Llama-3.1-70BClaude-3.5-haikuGemini-3.0-proERNIE-3.5
- Benchmarks
- VideoAgentReAct-UALAEHRAgentEgoSchemaNExT-QAHotpotQAStrategyQAMMLUMIMIC-IIIeICUTREQS
- Metrics
- ASR-RASR-LASR-HACCEMSRCRALLTCPS
The paper proposes the JailAgent framework, which conducts red-team attacks by implicitly manipulating the reasoning trajectory and memory retrieval of LLM agents, without modifying user prompts at all. The framework consists of three stages: trigger extraction, reasoning hijacking, and constraint tightening, relying on precise trigger identification, real-time adaptive mechanisms, and an optimized objective function. The authors claim it performs outstandingly in cross-model, cross-scenario settings. The paper notes that existing red-team methods mostly rely on modifying user prompts, lack adaptability to new data, and may affect the agent's own performance.
Paper analysis
What problem does this paper attempt to solve?
Existing red teaming mostly modifies user prompts; JailAgent does not modify prompts and instead hijacks reasoning traces and memory retrieval.
Existing agent red teaming mostly modifies user prompts, adapts poorly when data or targets change, and alters the agent's original behavior.
- Scenario: The authors state that LLM agents are already used for video analysis, clinical decision-making, and question answering, and can reason, plan, call tools, and use long-term memory. Once deployed in high-risk, high-value scenarios, the attack surface is larger than that of a standalone LLM, including memory attacks, planning manipulation, tool misuse, and long-horizon task hijacking.
- Existing shortcomings: The authors state that existing methods lack cross-domain adaptability and degrade when encountering new scenarios or switching target agents; explicit prompt rewriting also makes outputs deviate from the user's original intent, and the behavior is more easily detected by defenses.
- Premise of the approach: Without modifying the original user input, a shadow model reproduces the target model's decision preferences, then implicitly manipulates reasoning traces and memory retrieval.
- Proposed object: They propose JailAgent, whose three stages are Trigger Extraction, Reasoning Hijacking, and Constraint Tightening.
- Threat model:
- Goal: Manipulate the reward function R(s), alter decisions and execute unintended actions, while still obtaining final correct results (Section 2.2).
- Knowledge: The memory store is white-box; the core LLM cannot be accessed directly. A locally controllable model with logprob access approximates the core LLM distribution via same-prompt input estimation (Section 2.1). The paper does not give the model's name.
- Capability: A small number of malicious instances can be injected. The paper does not state the number of injected instances.
- Target: An LLM-based agent with a memory store and reasoning process. The specific systems are given in the experiments section.
What related research exists?
Related work is divided into agent architectures and two types of red teaming; the experimental baselines are PAIR, AgentPoison, BadChain, and Non-attack.
The paper discusses two threads—architecture and red teaming—in the introduction and Appendix A, and gives experimental baselines in Appendix D.3.
Agent architectures
- ReAct (Yao et al., 2023): Alternates between generating language reasoning traces and task actions, and gathers information from the external environment.
- Domain systems: Appendix A.1 also describes RAM-EHR, FinCon, DriveLM, ShowUI, PwnGPT, BioMedSearch, SoccerAgent, as well as DriveDreamer, AppAgent, and ELLMER, covering medical records, finance, driving, interfaces, exploitation, biomedicine, soccer, and embodied scenarios.
- Selected in this paper: The authors use VideoAgent, ReAct-UALA, and EHRAgent in their experiments.
LLM red teaming
- GCG (Zou et al., 2023): Appends adversarial suffixes to prohibited queries and uses affirmative-answer targets with greedy search to induce harmful outputs.
- AutoDAN (Liu et al., 2023): Uses a hierarchical genetic algorithm to perform semantics-preserving rewriting, crossover, and mutation on jailbreak prompts.
- Rewriting and multimodality: ReNeLLM (Ding et al., 2024) frames attacks as prompt rewriting plus scenario nesting; JMLLM (Mao et al., 2024) perturbs text, images, and audio. The appendix describes this group mainly descriptively.
Agent red teaming
- Memory and triggers: AgentPoison (Chen et al., 2024) poisons long-term memory or knowledge bases so that malicious content is retrieved under specific conditions, while normal queries are unaffected. The introduction groups Chen et al., 2024 with Zhang et al., 2025a and Hu et al., 2025 under architecture and memory analysis.
- Behavior and propagation: NetSafe (Yu et al., 2025b) examines misinformation propagation from a topological perspective; Zhang et al., 2025a exploits internal instability to induce loops or over-execution; FITD (Nakash et al., 2025) issues harmless tasks first and then performs indirect injection.
- Automated red teaming: AutoRedTeamer (Zhou et al., 2025) uses dual agents to mine and combine attacks. The introduction also mentions Guo et al., 2024 and Challita and Parrend, 2025, which focus on behavioral dynamics and automated red-teaming systems.
Baselines and datasets
- Baseline methods: PAIR (Chao et al., 2025) has an attacker LLM iteratively generate jailbreak prompts; AgentPoison optimizes covert triggers and injects them into the knowledge base; BadChain (Xiang et al., 2024) inserts malicious reasoning steps into examples; Non-attack is the agent's original performance.
- Benchmarks/datasets: VideoAgent uses EgoSchema and NExT-QA; ReAct-UALA uses HotpotQA, StrategyQA, and MMLU; EHRAgent uses MIMIC-III, eICU, and TREQS.
The authors state that existing methods remain mainly oriented toward specific tasks, static templates, or single-modality inputs, with limited applicability in complex chain-of-thought, multi-tool, and multimodal interactions; JailAgent, by contrast, does not modify the user's original prompt, learns decision preferences with a shadow model, and implicitly manipulates reasoning and retrieval.
How does the paper address this problem?
JailAgent operates in three stages—trigger extraction, reasoning hijacking, and constraint tightening—without modifying the user's original prompt throughout.
JailAgent does not modify user prompts, first finds high-contribution triggers, then uses a quickly fine-tunable Reranker to hijack candidate reasoning, and tightens trigger embeddings with four losses before injecting into the memory store.
Problem Setting
- Comparison target: The authors frame LLM jailbreaking as maximizing the probability of attacker-specified output; agent jailbreaking manipulates rewards. The goal is
π∗exp=argmaxπexp𝔼[∑t=0∞γtR(st)] i.e., select a non-expected policy under discounted reward expectation, while still obtaining the final correct result.
- Approximation: The attacker cannot directly read the core LLM, uses a local logprob model to estimate input probabilities for the same prompt. Shadow model name not given.
Trigger Extraction
- Grouping: User input is split into subwords via BERT WordPiece, then mapped back to subword indices using character positions. spaCy dependency parsing extracts noun phrases and verb phrases, yielding phrase-level subword groups G.
- Coarse-to-fine: First mask at group level, then token-level masking within high-scoring groups. Importance comes from log-probability drop ΔL and approximate stepwise KL over top-k candidates; both normalized and weighted by α, β. Table 6: α=0.5, β=0.5, top_k_groups=2, top_k_trigger=4. KL's k and ε not given.
- Encoder: Appendix D.4 states trigger contribution estimation uses bert-base-uncased.
Reasoning Hijacking
- Data factory: To avoid manual annotation, synthesize triples (context, poisoned positive, benign negative) on the fly from the current prompt. Positives are auto-generated from high-contribution triggers, negatives from benign content in the original memory store. Appendix B describes poison key-value construction, not expanded here. Table 6: 30 contexts per anchor, 4 positives, 12 negatives.
- Reranker: Frozen all-MiniLM-L6-v2 encodes context and candidates, a two-layer MLP scoring head outputs a scalar. Pairwise ranking loss makes positive scores higher than negatives. Only the scoring head is fine-tuned, optimizer AdamW. Table 6: 6 epochs, batch 8, learning rate 2e-5.
- Inference: Custom LLM API generates candidates, takes the highest-scoring one. Table 6: 10 candidates, max_tokens 500, temperature 0.9. The API's model name not given.
Constraint Tightening
- Four losses: High-contribution triggers are fed into BERT, embeddings L2-normalized. Particularity pushes away from benign cluster center; Clustering makes trigger tokens close to the mean; Separability increases poisoned index hits and lowers benign false hits; Margin requires similarity to poisoned entries at least δ higher than any benign entry, otherwise hinge penalty.
- Joint objective: Appendix C weights the four losses as
Ltotal(E)=λparLpar(E)+λcluLclu(E)+λsepLsep(E)+λmarLmar(E) Values of λ and δ not given. Table 6: clustering number 3, retrieval top-k 3. Figure 1 notes memory retrieval uses faiss.
Success Criteria
- Three ASRs: ASR-R checks whether retrieval is perturbed and retrieves poisoned data; ASR-L is LLM review reading execution logs to judge whether the predetermined perturbation action was executed after task completion; ASR-H is human review of logs. Review model name not given. Specific evaluation protocol in question 4.
What experiments did the paper conduct?
On reported backbones, the authors state JailAgent's ALL is higher than baselines, but there are counterexamples in cell-level ASR.
Experimental Setup
- Agents: VideoAgent (long video understanding), ReAct-UALA (reasoning and action), EHRAgent (electronic health record reasoning).
- Backbone LLMs: In tables: GPT-3.5-turbo, GPT-4o, GPT-5, Llama-3.1-70B, Claude-3.5-haiku, Gemini-3.0-pro. ERNIE-3.5 appears only in Table 1. Figures write LLama-3.1, tables write Llama-3.1-70B.
- Datasets: Table 7 Examples: EgoSchema 500, NExT-QA 570, HotpotQA 500, StrategyQA 229, MMLU 570, MIMIC-III 580, eICU 580, TREQS 978. The paper does not state whether every example enters the attack evaluation.
- Baselines: Non-attack, PAIR, AgentPoison, BadChain.
- Metrics: ASR-R is the proportion of retrievals that are perturbed and retrieve poisoned data; ASR-L is LLM review of logs; ASR-H is human review. ACC, EM, SR are original task metrics for VideoAgent, ReAct-UALA, EHRAgent respectively; CR is continuous completion with no interruption or error in output. ALL is the weighted average of five metrics over three datasets, weights not specified in the paper.
- Criteria and repetition: ASR-H has at least five experts per instance, disagreements resolved by discussion or majority vote. The paper does not report agreement values, ASR-L review model, number of repetitions, or number of queries. Hyperparameters in Table 6. Text says LLM review metric is ASR-L, Figure 3 labels it ASR-M.
Main Results
The table below lists only JailAgent's ALL. ReAct-UALA from Table 1, EHRAgent from Table 2, VideoAgent from Table 8.
Swipe horizontally to read the table
Backbone ReAct ALL EHR ALL Video ALL GPT-3.5-turbo 57.183 62.057 61.366 GPT-4o 61.739 70.112 63.849 GPT-5 63.080 66.753 66.346 Llama-3.1-70B 49.546 61.291 61.057 Claude-3.5-haiku 58.460 69.336 63.815 Gemini-3.0-pro 63.341 68.466 68.606 ERNIE-3.5 40.662 not reported not reported - ALL: The authors state that on all datasets and LLMs, JailAgent's weighted ALL is higher than other baselines. The ALL columns in the three tables are consistent. For GPT-4o, ReAct: JailAgent 61.739, AgentPoison 58.276, BadChain 55.704, PAIR 45.759; EHR: 70.112, 66.708, 63.555, 54.379; Video: 63.849, 61.034, 57.568, 52.648.
- Relative differences given by authors: On ReAct-UALA MMLU, GPT-5, relative to AgentPoison, ASR-R/L/H improve by 21.97%, 23.69%, 20.58%. Table 1 absolute values: JailAgent 70.18, 66.84, 65.79; AgentPoison 57.54, 54.04, 54.56. On EHRAgent eICU, Claude-3.5-haiku, relative improvements 9.04%, 12.56%, 12.02%; Table 2 absolutes: 95.69, 91.21, 90.00 vs 87.76, 81.03, 80.34. These are relative percentages, not percentage points.
- Counterexamples and unevenness: Not every cell has higher ASR. In Table 2, GPT-4o, TREQS: AgentPoison ASR-R 72.80, JailAgent 71.88; Claude-3.5-haiku, MIMIC-III: AgentPoison ASR-R 70.52, JailAgent 70.34. For JailAgent itself, Table 1 GPT-4o on StrategyQA ASR-R 73.80, on HotpotQA 36.20. The paper does not explain this difference.
Task Metrics and Time
- Original tasks: The authors state that relative to Non-attack, JailAgent's EM and CR are close, other baselines drop more. Table 1 GPT-4o, StrategyQA: Non-attack EM/CR 81.22/90.83, JailAgent 80.35/90.39, PAIR 74.24/82.97. Not every cell is that close: same table Gemini-3.0-pro, StrategyQA EM from 85.59 to 82.97.
- Video tasks: The authors state that on GPT-4o, NExT-QA, JailAgent's ACC relative drop is 1.6%, PAIR 21.3%, BadChain 10.4%. Table 8 absolute ACC: Non-attack 67.54, JailAgent 66.49, PAIR 53.16, BadChain 60.53. Same cell AgentPoison 67.89, higher than Non-attack.
- TCPS: Table 5 in seconds. StrategyQA: PAIR/AgentPoison/BadChain/JailAgent 342.20/92.38/74.62/52.29; MIMIC-III 384.56/103.28/89.83/63.45; EgoSchema 262.24/59.47/43.64/34.86. The authors state relative to PAIR reductions of 84.7%, 83.5%, 86.7%. The paper does not report number of queries.
Defense Settings
- What was tested: Appendix E.2 adds PPL Filter and RA-LLM. The authors state Llama-3.1-70B is the backbone for EHRAgent and VideoAgent; Table 9 lists ReAct-UALA (StrategyQA) and EHRAgent (MIMIC-III), no VideoAgent column. The ReAct column's backbone is not specified; its JailAgent numbers 54.59, 51.52, 48.91 match Table 1 Llama-3.1-70B row.
- Results: EHRAgent column JailAgent 63.97, 61.21, 58.97; with PPL 63.97, 60.34, 58.28; with RA-LLM 62.76, 58.45, 55.34. BadChain with RA-LLM 58.79, 55.86, 51.72. ReAct column with PPL 54.15, 52.40, 48.47; with RA-LLM 52.40, 50.22, 45.41.
- Authors' interpretation: The authors state that under PPL, attack success rate remains stable, RA-LLM reduces attack effectiveness; under the same setting, JailAgent still higher than BadChain. In the table, "same setting" corresponds to both with RA-LLM in three columns.
Case and Embedding Plots
- Case: Figure 2 compares a case on VideoAgent where both AgentPoison and JailAgent are judged ASR success, correct option is option 0. The authors state JailAgent uses tools not present in frames to disrupt whole reasoning, AgentPoison mainly exaggerates a tool in one wrong option, perturbation more local. Specific reasoning text not repeated.
- Embedding plots: Figure 4 legend: Benign Embedding, Poison Embedding, Trigger Embedding, left to right: no joint optimization, Lpar+Lclu, Lsep+Lmar, full joint optimization. The authors state without optimization triggers are not separable, after full optimization triggers are mapped to a distinct and compact region. Text transcription shows scale roughly from -4 to 6, axis names not given; whether clusters are separated cannot be confirmed from text.
Other Ablations and Analyses
- Table 3, GPT-4o, StrategyQA: removing ΔL gives ASR-R/H 58.08/50.66, full JailAgent 73.80/62.88.
- Same cell removing Lmar: ASR-R/H 60.26/49.78; removing Lclu 69.43/57.64. The authors state removing ΔL and Lmar causes larger drops, removing Lclu has smaller impact. No statistical tests in the paper.
- Table 3 writes EHR and Video task columns as EM; numbers match Table 2 SR and Table 8 ACC, no separate explanation. In the table, Lspe differs from Separability Loss Lsep in text.
- Table 4 does not specify backbone. Its Full row matches JailAgent row for GPT-4o in Tables 1/2/8. After removing 80% of Candidate, StrategyQA ASR-L/H 59.39/56.33, Full 65.07/62.88.
- Same table Data Factory removing 80%: StrategyQA ASR-R/L/H 58.52/51.97/48.03, EM 69.43. The authors state reducing Data Factory lowers all three ASRs and original task metrics.
- Table 3, Llama-3.1-70B, StrategyQA: removing ΔL gives ASR-R 40.17, full behavior 54.59.
What are some points that can be further explored?
The authors note the method relies on shadow models, has additional computational overhead, and is mainly validated on predefined tasks.
Limitations and Future Directions Noted by Authors
- Shadow models: Trigger identification and optimization rely on shadow models, may degrade on fully black-box agents (Limitations).
- Computational overhead: Real-time adaptive mechanism adds computational cost; the authors state it still has time advantage over current methods, but may introduce latency in large-scale real-time systems (Limitations).
- Scope: Effectiveness mainly validated on predefined tasks and standardized evaluation environments; more complex, dynamic application scenarios need exploration (Limitations).
- Future directions: Improve adaptation cost, increase stability in fully black-box environments, and extend to more agent architectures (Limitations).
Experimental Coverage
- Backbones and agents: Backbones in result tables: GPT-3.5-turbo, GPT-4o, GPT-5, Llama-3.1-70B, Claude-3.5-haiku, Gemini-3.0-pro; ERNIE-3.5 only in Table 1. Agents: VideoAgent, ReAct-UALA, EHRAgent.
- Data scale: 8 datasets, Table 7 Examples from StrategyQA 229 to TREQS 978.
- Baselines and defenses: Baselines: Non-attack, PAIR, AgentPoison, BadChain. Defense experiments: PPL Filter and RA-LLM, Table 9 columns ReAct-UALA/StrategyQA and EHRAgent/MIMIC-III.
- Human evaluation: ASR-H requires at least five experts per instance, disagreements resolved by discussion or majority vote. Agreement values not reported.
- Unspecified settings: The paper does not report shadow model names, ASR-L review model, number of repetitions, ALL weights, number of injections, or number of queries; time reported as TCPS (Table 5).
Summarize the main content of the paper
JailAgent does not modify prompts and uses three stages to manipulate reasoning and retrieval; the authors state that ALL is higher and time cost is lower, but there are counterexamples in cell-by-cell ASR.
JailAgent is an LLM agent red-teaming framework that does not modify the user's original prompt.
- Problem: The authors believe prompt-modification methods are hard to transfer across scenarios, deviate from original intent, and make behavior easier for defenses to detect. The attacker has white-box access to the memory store, can inject a small number of malicious instances, but cannot directly access the core LLM.
- Method: A local logprob model approximates the core LLM. Trigger extraction uses syntactic grouping, log-probability drops, and stepwise KL; reasoning hijacking synthesizes paired data on the fly from the current prompt and fine-tunes a scoring head on a frozen encoder; constraint tightening jointly optimizes four losses for specificity, compactness, separability, and margin, then injects malicious instances into memory.
- ALL: In Tables 1, 2, 8, for all reported backbones, JailAgent's weighted ALL is higher than PAIR, AgentPoison, and BadChain. For example, EHRAgent, GPT-4o: 70.112 (Table 2), VideoAgent, Gemini-3.0-pro: 68.606 (Table 8), ReAct-UALA, ERNIE-3.5: 40.662 (Table 1), still higher than baselines in the same table.
- ASR: On eICU, Claude-3.5-haiku, JailAgent ASR-R 95.69%, ASR-H 90.00% (Table 2); eICU, GPT-4o ASR-H 91.38%. Not every cell is higher, e.g., TREQS, GPT-4o: AgentPoison ASR-R 72.80, JailAgent 71.88.
- Utility and time: The authors state original task metrics are close to non-attack. Table 5 JailAgent TCPS 52.29, 63.45, 34.86 seconds, lower than three baselines in the same table. The authors state relative to PAIR reductions of 84.7%, 83.5%, 86.7%.
- Authors' conclusion: The authors state the method is stable and stealthy across models and scenarios, with lower computational cost. Limitations state it relies on shadow models, may degrade in fully black-box settings, and is mainly validated on predefined tasks and standardized environments.