ShieldNet Catches Hidden AI Agent Attacks With 99.5% Accuracy
A new benchmark shows LLM agents are blind to malicious code hidden inside MCP tools, and a traffic-sniffing proxy catches the attacks at 0.995 F1.
Takeaways
- New threat class MCP Tool Trojans: malicious code hidden in MCP tool implementations, invisible to prompt-level defenses.
- MCPTrojanBench injects 29 MITRE ATT&CK techniques into 139 real MCP servers, producing 24,000+ validated trojaned tools.
- Existing MCP scanners and I/O guardrails detect almost none of these attacks in evaluation.
- ShieldNet uses a TLS MITM proxy, event extractor, and a Qwen3-0.6B post-trained classifier on network traces.
- Reaches 0.995 F1 with 0.8% false positives, 15x fewer false positives than GPT-6 Astra and Claude Opus 5.
- Live demo wires it into Claude Code; limitation: only catches trojans that actually produce network traffic.
Researchers have defined a supply-chain attack called MCP Tool Trojans. A compromised MCP server presents ordinary tool names, descriptions, inputs, and outputs while its implementation probes internal networks, exfiltrates data, or contacts attacker infrastructure when an agent invokes it. No malicious instruction needs to enter the model’s context, leaving interface-focused scanners and semantic guardrails with little evidence to inspect.
MCP allows AI applications to discover and invoke tools exposed by external servers. Those servers may run with access to application credentials, local files, private services, and outbound networks. Reviewing a tool’s manifest therefore reveals only part of its behavior; the server implementation remains a conventional third-party code dependency.
| Attack | Malicious component | Trigger | Useful evidence |
|---|---|---|---|
| MCP Tool Poisoning | Instructions embedded in descriptions or returned content | The model reads and follows the instructions | Tool text, prompts, and model outputs |
| MCP Tool Trojan | Code inside the server implementation | The host executes an invoked tool | Network, process, and filesystem activity |
From 139 Servers to 24,000 Trojaned Tools
The researchers built MCPTrojanBench by injecting 29 network-visible attacks derived from MITRE ATT&CK into 139 MCP servers collected from the official registry, community listings, and open-source projects. The resulting dataset contains more than 24,000 trojaned tool instances validated through captured network traffic.
The benchmark pipeline performs five steps:
- Collect benign MCP servers from public sources.
- Generate attack scripts for selected MITRE ATT&CK techniques.
- Locate tool implementations and insert the scripts without changing their exposed schemas.
- Use LLM-generated prompts to make an agent invoke each tool.
- Retain instances whose intended attack appears in captured traffic.
Traffic validation removes injections that never execute or fail to produce their intended behavior. It also means the benchmark evaluates detection after observable malicious network activity has occurred, rather than measuring whether every attempted implant can execute successfully.
ShieldNet Reads Execution Traffic
The proposed ShieldNet guardrail observes network activity generated during tool execution. Its architecture combines a TLS-intercepting proxy, an event extractor, and a post-trained classifier:
- Proxy: Routes agent traffic through a local interception layer and decrypts supported HTTPS connections.
- Event extractor: Converts traffic into structured records such as destinations, protocols, and payload shapes.
- Detector: Classifies sequences of events for signs of malicious behavior.
ShieldNet uses Qwen3-0.6B, a model with roughly 600 million parameters, post-trained on structured network-event sequences. During execution, it processes a sliding window of recent events, allowing detections to arrive while a tool call is active. A production system could connect those detections to alerts, connection termination, or agent shutdown policies.
High Scores on the Benchmark
ShieldNet achieved the following results on MCPTrojanBench:
| Measure | Reported result |
|---|---|
| Trace-level F1 | 0.995 |
| False-positive rate | 0.8% |
| False positives versus model baselines | Less than one-fifteenth as many |
| Generalization tests | Held-out servers and attack techniques |
Trace-level F1 measures one classification across a captured execution trace and combines precision with recall. The paper reports that ShieldNet generated less than one-fifteenth as many false positives as GPT-6 Astra and Claude Opus 5 when the models classified the same network traces.
Tests on servers and attack techniques excluded from training provide evidence that the detector learned patterns extending beyond memorized codebases. The evaluation still relies on injected attacks, so it does not establish performance against operators who deliberately shape malicious traffic to resemble permitted APIs.
The researchers also connected ShieldNet to Claude Code for a live demonstration. Claude Code invoked implanted MCP tools while the proxy intercepted traffic, extracted structured events, and displayed sliding-window classifications. The authors report low runtime overhead, though deployment reviews would still need concrete latency, throughput, memory, and saturation measurements.
Coverage Limits and Deployment Costs
A TLS interception proxy becomes sensitive infrastructure because it can inspect plaintext application traffic. Deployments must secure its configuration and logs, install a trusted local certificate authority where required, account for certificate pinning, and prevent MCP processes from bypassing the monitored route.
ShieldNet’s coverage is limited to behavior that produces observable traffic during the monitoring window. Important gaps include:
- Local file corruption, destructive commands, or persistence with no network activity.
- Delayed communication that begins after the monitored tool call ends.
- Traffic sent through an unmonitored interface, tunnel, or subprocess.
- Exfiltration through approved services whose traffic resembles normal API use.
- Encrypted or unsupported protocols the proxy cannot inspect.
The cited v2 paper does not state that the benchmark, detector code, or trained weights are publicly available. Reproduction therefore depends on a future release or an independent implementation of the described pipeline.
Controls Developers Can Apply Now
MCP deployments can reduce exposure by treating every external server as untrusted executable code and combining network monitoring with broader containment:
- Run servers in isolated containers or virtual machines.
- Grant narrowly scoped credentials, filesystem access, and network permissions.
- Deny outbound traffic by default and allowlist required destinations.
- Route permitted egress through a monitored gateway and block alternate paths.
- Pin server and dependency versions, verify provenance, and review implementation changes.
- Collect process, filesystem, and network telemetry for incident investigation.
ShieldNet supplies a network-level signal that prompt and manifest inspection cannot provide. Its benchmark results support that layer as a useful control for network-visible MCP attacks, while sandboxing, least privilege, code review, and host monitoring remain necessary for behavior outside the proxy’s view.