Manuscript Offprint

arXiv:2610.28966

Black-Box Red-Teaming of Multi-Agent Systems via Reinforcement Learning

Yuqi Jia, Hangsheng Zhang, Chenxi Liu, Junjie Liang, Xun Chen

Abstract

Large language model (LLM) agents are increasingly deployed in multi-agent systems (MAS) to accomplish complex tasks. Prior black-box red-teaming attacks mainly focus on single agents, but we find that these methods are far less effective in MAS, where multiple sub-agents may not directly interact with the user. Therefore, we introduce ReMAS, the first reinforcement learning-based red-teaming framework tailored to MASs, which fine-tunes attacker LLMs to generate effective adversarial prompts for system prompt extraction. The framework follows a two-step process: first, a rewrite stage refines base attack prompts to increase extraction success, and second, a template generation stage constructs attack templates that improve the likelihood of invoking specific sub-agents and thus revealing their system prompts. Extensive experiments show that our method substantially improves attack success rates compared to existing black-box attacks, with transferability across different backend LLMs and MAS structures. These results underscore the vulnerabilities of multi-agent systems and the importance of developing stronger defenses against adaptive black-box adversaries.

1 Introduction

Large language models (LLMs) are increasingly deployed in multi-agent systems (MASs) [5, 6, 9, 32, 2, 33, 17], due to their strong capabilities in tool use and problem solving. Compared to one single agent, MASs leverage the coordination of multiple specialized agents to tackle more diverse and challenging tasks [30], offering enhanced capability and modularity. However, this collaborative setting also introduces new security concerns. Reinforcement learning (RL) offers a natural way to improve agent behavior through interaction feedback and task-level rewards, but existing RL-based alignment methods are mostly developed for single-agent settings [27, 34, 16]. Interactions among agents create additional channels where adversarial instructions can propagate, exposing MASs to novel risks. For example, prompt injection attacks [23, 24, 19, 11, 29], where adversarial inputs coerce LLMs into overriding their original objectives, pose a significant but underexplored threat in MAS environments. Despite the growing deployment of MASs, their robustness against such attacks remains largely unexplored.

Existing black-box jailbreak and prompt injection attacks mainly target single LLMs [3, 20, 22, 18], while their effectiveness against MASs remains underexplored. A common MAS design adopts a vertical structure with a coordinator agent and multiple specialized sub-agents [6, 32, 2, 8]. In such systems, the coordinator agent selects the appropriate sub-agent and may rewrite the forwarded query to better match the sub-agent's functionality. This creates new challenges for attacks: an adversary must both manipulate the routing decision to reach the target sub-agent and survive the coordinator agent's rewriting process, which can weaken or remove adversarial intent. As a result, attacks effective against single-agent LLMs often fail in MASs.

To address the unique challenges of attacking MASs, we propose ReMAS (Red-teaming for Multi-Agent Systems), the first red-teaming framework tailored to MASs. ReMAS focuses on system prompt extraction. It builds on existing base attack prompts and learns, through interaction with the MAS, to generate adversarial inputs that reliably elicit hidden system prompts of sub-agents. The framework operates in two steps: i). Rewrite Attack Prompt and ii). Generate Attack Template. Step I trains an attacker policy LLM to transform a base attack prompt into a stronger variant capable of eliciting hidden system prompts from target sub-agents, using a strategy pool with randomized selection to ensure effective and diversity. Step II trains another attacker policy to produce a wrapping attack template that embeds the rewritten attack prompt in a form that bypasses the coordinator agent's routing and rewriting, ensuring the target sub-agent receives an input close to the rewritten attack prompt. Both policies are optimized using carefully designed rewards under the DAPO algorithm [34]. Unlike prior black-box methods that rely on iterative refinement during evaluation, ReMAS trains attacker policies end-to-end and executes them in a single-pass pipeline at test time, achieving high attack success while greatly improving efficiency.

We evaluate ReMAS using a set of base attack prompts sourced from industry and test it in simulated MAS environments spanning 10 different coordinator agents and 7 distinct sub-agent types. Results show that our RL-based framework consistently outperforms strong black-box baselines. In particular, ReMAS achieves routing success rates above 0.98, ensuring the coordinator agent reliably invokes the target sub-agent, while maintaining high ASRs close to 0.80 across sub-agent types. Ablation studies further validate the importance of the strategy pool with randomized selection, which prevents collapse onto a small set of strategies and significantly enhances both diversity and success. Moreover, ReMAS exhibits strong transferability, sustaining high effectiveness when evaluated on unseen MAS backend LLMs and alternative MAS structures such as Horizontal structures and Vertical Solver&Reviewer structure [5]. These results highlight the necessity of incorporating adversarial robustness into the design and deployment of MASs.

In summary, we make the following contributions:

  • We propose ReMAS, the first RL-based red-teaming framework for MASs that systematically investigates system prompt extraction attacks.

  • We propose an RL training method for attacker LLMs that leverages a strategy pool with randomized selection to improve both diversity and effectiveness.

  • We conduct extensive experiments across seven sub-agent types, multiple MAS backends, and different MAS structures to show the effectiveness of ReMAS.

References (29)