When Agents Go Rogue: Activation-Based Detection of Malicious Behaviors in Multi-Agent Systems

Haowen Xu, Xue Tan, Lei Ma, Zhihao Zhang, Chao Wang, Qingze Wang, Ping Chen, Jun Dai, Xiaoyan Sun

Large Language Model (LLM)-based Multi-Agent Systems (MAS) enable complex, collaborative problem-solving by assigning specialized roles to different agents. However, security in these systems is a "team sport"—a single compromised agent can derail an entire workflow.

Traditional MAS defenses rely on two increasingly fragile assumptions: that attacks are semantically obvious (e.g., explicit jailbreaks) and that agents interact in predictable, synchronous rounds. In reality, modern attacks use benign-looking language to stealthily disrupt reasoning, and real-world MAS are often asynchronous and messy. Furthermore, when traditional defenses detect a rogue agent, they typically isolate it. In specialized workflows, removing a critical agent often causes the entire task to collapse.

To address these vulnerabilities, researchers introduce AcMAS, an activation-based security framework that shifts the defense layer from surface-level text outputs to the internal "engine" of the LLM.

The AcMAS Framework

AcMAS detects and mitigates malicious behavior by monitoring internal neural activations rather than relying on explicit interaction graphs or semantic filtering. The framework operates through four key steps:

  1. Activation Extraction: For every response an agent generates, AcMAS extracts the hidden representation from the final layer of the LLM. This serves as a "fingerprint" of the agent's internal reasoning process.
  2. Normal Behavior Characterization: Using a small set of benign execution traces, the system builds a "normal prototype"—a centroid in the high-dimensional activation space.
  3. Divergence-Based Detection: AcMAS calculates the cosine distance between an agent's current activation and the normal prototype. If the divergence exceeds a set threshold, the agent is flagged as compromised.
  4. Restorative Latent Intervention: Instead of isolating the compromised agent, AcMAS employs activation steering. It mathematically adjusts the rogue activation, pushing it back toward the normal manifold. This "heals" the agent's reasoning on the fly, allowing it to continue contributing to the task without spreading the infection.

Experimental Setup

The researchers evaluated AcMAS across five benchmark settings covering three major attack families:

  • Stealthy Prompt Injection (S-PI): Evaluated on CSQA and GSM8K, where attacks mimic benign linguistic styles but inject malicious intent.
  • Tool Manipulation Attack (TA): Evaluated on the InjecAgent dataset, where agents are tricked into injecting misleading tool outputs.
  • Memory Poisoning Attack (MA): Evaluated on PoisonRAG and HotPotQA, where incorrect facts are injected into an agent's long-term memory.

Key Findings and Results

  • Detection Superiority: Because AcMAS monitors internal states rather than global interaction graphs, it is highly robust to asynchronous delays. In asynchronous settings, AcMAS achieved an F1 score of 0.93, vastly outperforming state-of-the-art graph-based baselines (0.38). In synchronous settings, it improved F1 by +0.22 (0.94 vs. 0.72).
  • Task Preservation: By healing rather than isolating agents, AcMAS maintained a 97% task completion rate. In contrast, isolation-based defenses saw completion rates drop to 83% on average, and as low as 66% on complex multi-hop tasks.
  • Efficiency: The detection process adds negligible overhead (only 0.22% of total inference time). The restorative steering step adds about 12.4% overhead, but only when an attack is actively detected.
  • Generalization: The framework proved effective across diverse open-source backbones, including LLaMA3-8B, Qwen3-30B, and DeepSeek-V3, and scaled gracefully from 8 to 80 agents.

Limitations and Future Directions

While highly effective, AcMAS requires access to internal model activations. This makes it ideal for locally deployed or open-weight models but currently unusable for "black-box" API-only models like GPT-4 or Claude.

Additionally, the "normal prototype" is sensitive to the specific task domain. While AcMAS can adapt to a new domain with as few as 50–100 benign traces, developing a universal or zero-shot prototype remains a goal for future research. Finally, defending against adaptive "boiling frog" attacks—where sophisticated adversaries slowly shift activation distributions to avoid triggering thresholds—remains an open challenge in MAS security.

Summary updated

BibTeX
@inproceedings{xu2026when,
  author = {Haowen Xu and Xue Tan and Lei Ma and Zhihao Zhang and Chao Wang and Qingze Wang and Ping Chen and Jun Dai and Xiaoyan Sun},
  title = {{When Agents Go Rogue: Activation-Based Detection of Malicious Behaviors in Multi-Agent Systems}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=BnduUW8izq},
}
Figure