TL;DR
When an LLM multi-agent system gets hacked into running a malicious tool, the culprit is rarely the agent that actually pulled the trigger—the poison usually started several hops upstream. Because preventative guardrails inevitably fail against clever attackers, this paper introduces MATracer, a digital forensics framework that reads post-incident logs to pinpoint the exact agent, internal module, and specific snippet of data where the attack began. It turns debugging a compromised AI swarm from a needle-in-a-haystack nightmare into a fast, three-second root-cause analysis.
What Problem Does This Paper Address?
Picture a team of specialized LLM agents—say, a planner, a researcher, and a code executor—passing messages to solve a complex financial query. While collaboration makes them capable, it also creates a massive security headache. An attacker can slip a malicious payload into an externally writable part of an upstream agent (like poisoning a single memory entry or a web search observation). That agent might then generate a totally benign-looking plan that nudges a downstream executor into calling a dangerous tool.
Right now, most AI security focuses on prevention—trying to block every prompt injection or poisoned memory before it executes. Yet adaptive attacks routinely bypass these shields. Once an attack succeeds, system administrators are left in the dark. Existing attribution tools either look at single LLM calls in isolation or identify non-adversarial bugs without digging into the specific poisoned data.
The authors ask a pragmatic, post-incident question: After an agent invokes the wrong tool, can we trace the failure all the way back to patient zero? They formalize this as three-level forensic localization: identifying (1) the compromised source agent, (2) the exploited module inside that agent (Input, Memory, Plan-of-Thought examples, or Tool Observations), and (3) the exact contaminated units (the specific memory pair, text span, or observation) carrying the payload.
Methods
To avoid needing access to proprietary model weights or internal attention states, MATracer operates in a pure black-box setting. It relies only on standard execution logs and log-likelihood scores from a lightweight, off-the-shelf "proxy" LLM (like Llama-3.1-8B) to play detective in a coarse-to-fine cascade:
- Query Screening & Stage 1 (Source Agent): First, an LLM-as-judge checks the obvious: did the user's initial query directly ask for the malicious tool? If not, MATracer traces the communication path leading to the bad tool call. Using the proxy LLM, it measures how likely the invoking agent would be to call that malicious tool given only each individual message along the path. Before the poison enters the chat, this likelihood is flat; the exact message where the probability spikes reveals the earliest contaminated message—and its sender is flagged as the source agent.
- Stage 2 (Compromised Module): Next, MATracer tests how much each of the source agent's modules increases the proxy likelihood of generating that contaminated message. Crucially, it uses a clever gap-comparison rule rather than naively picking the highest score. Why? Because if an agent's pre-generation Memory is poisoned, it might run a bad tool and record a contaminated Observation—making both modules look guilty! Comparing the score gaps between pre-generation modules (Memory, Plan-of-Thought) and runtime modules (Observations) cleanly separates root causes from downstream symptoms.
- Stage 3 (Contaminated Units): Finally, it zooms into the culprit module. For unordered items like retrieved memories or few-shot examples, it scores each item individually and uses $k$-means clustering to separate high-scoring poisoned entries from benign ones. For sequential tool observations, where an early bad output taints later ones, it scores cumulative prefixes and looks for the sharpest jump.
Datasets
Because no existing dataset tracks multi-hop attack propagation down to individual data units, the authors built MAFL-Bench (Multi-Agent Forensic Localization Benchmark).
- Unlike the Agent Security Benchmark (ASB)—which tests single agents and only records whether an attack succeeded—or Who&When—which tracks benign multi-agent errors—MAFL-Bench provides ground-truth labels at the agent, module, and unit levels for adversarial tool calls.
- It spans 21,200 annotated interaction logs across three domains (finance, system administration, academic research), four communication topologies (Chain, Tree, Random, and Multi-agent Debate), and 12 attack techniques covering direct/indirect prompt injections, memory poisoning, and Plan-of-Thought backdoors.
Key Insights and Ideas
- Symptoms mimic root causes inside an agent: A poisoned memory entry causes an agent to take bad actions, which then fills its observation log with suspicious text. Naive attribution blames the observation log; MATracer’s insight is to use the causal timing of modules to tell the spark apart from the smoke.
- Proxy models don't need to match the victim: You don't need white-box access to GPT-4o to audit a GPT-4o agent swarm. Measuring likelihood shifts on a small, local 7B–9B open-weights proxy model is enough to spot where an instruction hijacked the workflow.
- Forensics enables surgical cleanup: Instead of shutting down an entire system or wiping an agent's whole memory bank after an incident, unit-level localization lets you excise just the bad entries.
- Asking an LLM "whodunit?" flops: Simply feeding the full interaction log into GPT-4o and asking it to name the compromised agent, module, and unit in one go caps out at 50% accuracy—proving structured causal probing beats raw prompting.
Key Results
Tested across six benchmark configurations against 10 adapted baselines (spanning context attribution, RAG forensics, and agent debugging):
- High Precision Localization: MATracer achieves cumulative unit-level localization accuracy ($\text{ACC}_{\text{unit}}$) between 0.78 and 1.00 across all settings (0.88–1.00 on Finance-Chain), keeping false positive rates at or below 0.01 (0.02 under adaptive attacks). All 10 baselines fail badly on at least one attack category.
- Fast & Lightweight: It analyzes a full multi-agent log in 2 to 3 seconds using ~17.7 GB of VRAM—over 10x faster than RAGForensics.
- Actionable Remediation: Automatically deleting or neutralizing just the specific units flagged by MATracer drops the Attack Success Rate from near 1.00 down to $\le$ 0.15 in a single pass.
- Resilience: When attackers craft adaptive payloads specifically designed to fool MATracer, it still maintains 0.85–0.92 unit-level accuracy.
Limitations and Future Work
While the core MATracer pipeline assumes a single compromised source agent and full execution logs, the authors explore relaxing these constraints in their discussion:
- Multi-agent compromises require iteration: A single run of MATracer only catches the primary unit driving the bad tool call. If an attacker poisons multiple agents simultaneously, MATracer has to be run iteratively—removing the detected poison, re-executing the system, and running forensics again until clean. Developing single-pass, non-iterative multi-source attribution is a natural next step.
- Missing logs degrade fine-grained accuracy: If a system only logs partial contexts (e.g., withholding 30% of agent contexts), source agent accuracy holds up well (0.87), but exact unit-level accuracy dips to 0.75.
- System prompts are assumed safe: The threat model assumes the MAS provider's core system messages (
SYS) and communication graph structure remain uncompromised.
Summary updated