Published
- 8 min read
By Allan D - Editor, AI Security Wire
Investigating a Malicious MCP Server: Agent Logs Miss It, Kernel Logs Catch It
Most teams that run LLM agents with MCP servers keep the agent’s own log and assume it is the incident record. A November 2026 lab study, Forensic Visibility of Malicious Model Context Protocol (MCP) Servers, tested that assumption and found it fails for the most direct attack. Across 420 attack runs and 105 benign controls, the agent log recorded the credential read in one of 120 successful code-based thefts. The kernel’s audit log recorded all 120. This article turns the paper’s findings into a collection and preservation plan. It is a single study by one author in one lab configuration, so the measurements are the author’s alone; where we recommend something beyond what the paper tested, we say so.
What the study measured
The author, Cesar R. Beltrán-Hernández of Universidad El Bosque, built a three-VM lab: a victim running a LangGraph agent, MCP servers and auditd; an attacker VM with an HTTP receiver that acted as an independent delivery oracle; and a forensic VM holding traces and a custody anchor. The agent summarized documents using one MCP tool, summarize_document, served by one of three builds:
- Build A (code-based exfiltration): the server’s code reads a synthetic credential file and posts it to the attacker. The model does nothing unusual beyond calling the tool.
- Build B (description poisoning): hidden instructions in the tool description tell the model to read the credential file and paste it into its answer. Nothing goes to the attacker.
- Benign build: the negative control.
Seven models were tested (three local via Ollama, four hosted OpenAI models), 30 repetitions per model and build. The paper is an arXiv preprint submitted to Forensic Science International: Digital Investigation; we found no peer-review record as of 4 December 2026 (arXiv abstract page checked). It also states its limits: one agent framework (LangGraph create_react_agent), one poisoning instruction, a summarization task, Linux, and stdio transport. The results describe this configuration and are not a ranking of models.
Overall, 223 of 420 attacks succeeded: 120 of 210 for Build A (each confirmed by an attacker receipt) and 103 of 210 for Build B (both credential values present in the final response).
Where the evidence lived
The table is built from the paper’s Table 4 (successful runs only).
| Indicator | Build A (120) | Build B (103) |
|---|---|---|
| Credential read recorded by the agent callback | 1 | 103 |
| Credential file open in auditd | 120 | 103 |
Kernel connect() to the attacker | 120 | N/A (no such channel) |
| Same PID opened the file and connected | 120 | N/A |
| Independent attacker receipt | 120 | N/A |
| Full credentials in the final response | 0 | 103 |
Three lessons follow.
- Code-based theft is nearly invisible at the agent layer. The server’s process reads the file itself, so the agent only sees an ordinary tool call. The paper’s single exception is one GPT-4o run. There the callback’s read matched an open by the filesystem server (a node process), while the theft itself was a separate open by the malicious server’s python process, which then connected out.
- Model-mediated disclosure is the reverse. The agent callback and kernel file watch both saw the read, but no network event exists. The conclusive evidence is the final response.
- Neither boundary suffices alone. Agent-only logging misses almost every Build A theft. Network-only monitoring misses Build B entirely.
What to collect
The paper’s own recommendation is to combine host kernel auditing of files and network with agent callbacks, and preserve both under an external tamper-evident anchor. The specifics below are our guidance except where marked as the study’s:
- Kernel file watch on credential files. The study used
-w <credentials path> -p r -k cred_access. Our advice: watch the files your agents and their MCP servers can reach, such as cloud CLI credentials. Note the paper’s caveat: anopenatrecord shows the file was opened, not which bytes were read. - Kernel network egress rule. The study used
-S connect,sendto,sendmsg -k net_egress. Aconnect()returningEINPROGRESSmarks a non-blocking attempt; it does not prove delivery. In the lab, delivery was confirmed by the attacker’s receiver, which a real investigation will not have (our inference), so look for corroboration in egress firewall, proxy or flow logs (our suggestion; the lab recorded no packet capture). - Correlate by process ID. In all 120 Build A runs, the PID that opened the credential file also attempted the connection. In our view, a file open and a connection from the same Python or Node process, not the agent’s own, is the signature to hunt for. Process IDs get reused (not covered by the paper), so pair them with timestamps.
- Agent callback log. Keep it, since it was the only source showing Build B’s induced tool call and the model’s decisions, but treat it as host-written and alterable (the paper’s point about the host under suspicion).
- Preserve the final response. For description poisoning it is the disclosure evidence. Our advice: store it with the run, not only in a trace system. The paper’s Jaeger trace only repeated the agent’s response and is not an independent sensor.
- Record the tool descriptors. The poisoned instruction lives in the descriptor text the client passes to the model. The paper notes the injection leaves no direct log, only its effect (the induced tool call). Capturing descriptors at connection time would give you the cause as well as the effect. This is our recommendation; the paper did not test it.
Preserving evidence against a compromised host
Agent logs come from the machine under suspicion. For a stronger adversary with root, the paper tested a custody scheme using established techniques: a SHA-256 hash chain linking records, the chain head anchored on a separate forensic host, and an Ed25519-signed receipt. It covered 531 artifacts from the campaign and verified successfully. Its tamper tests detected editing a line, deleting or reordering records, truncating the tail, rebuilding the chain after truncation (caught by the anchor) and forging the receipt (caught by the signature).
Limits the author states plainly: the scheme is tamper-evident, not tamper-proof; it protects only records anchored before a compromise; the signing key sat on the forensic host, so trust rests there; and in this proof of concept chaining was applied after the campaign was frozen, not live. Per-event anchoring, hardware key storage and RFC 3161 timestamping were left for future work. Per-run SHA-256 manifests alone, the paper notes, prove integrity only against digests the same host recorded.
If you adopt the idea, in our view the practical minimum is to ship audit and agent logs off-host continuously and anchor chain heads on a system the agent host cannot write to.
Pitfalls for investigators
- No kernel trace does not clear a server. If the model never calls the malicious tool, Build A’s code never runs. GPT-5.4-mini and GPT-5.5 completed no Build A theft, and mistral:7b never issued a real MCP call. In our reading, a server can be malicious and simply unused.
- No network event does not mean no theft. Build B sends nothing out yet exposes the credential in the answer.
- No agent-log read does not rule out theft. In Build A that log recorded only the tool call.
- Clocks. The victim and attacker clocks were not synchronized to sub-millisecond precision, so cross-host ordering of close events is approximate (the paper’s roughly 2.7 s window in one run, Case A).
- Evidence can attack the analyst. The paper cites Breitinger et al. (2026) on planting instructions in evidence to mislead an LLM-assisted investigator. If an LLM reads your collected artifacts, an integrity check proves the file is unchanged, not that its content is harmless.
- Different transports change the picture. The lab used stdio, where tool calls never cross the network. Remote MCP servers over HTTP or SSE would, and the paper leaves that surface to future work.
What the controls say about noise
All 105 benign runs fired no indicator (0/105, 95% Wilson interval up to 3.5%). In 15 of those runs, mistral:7b never invoked the tool, so 90 runs exercised it. The sensors stayed quiet in this lab’s benign operation, and the paper stresses this says nothing about other attack types. Our expectation, not tested in the study: a production host has more file and network activity, so plan to tune the watch rules.
How this fits our other coverage
The paper’s agent-versus-kernel gap is directionally consistent with Sysdig’s production telemetry, which we covered in Sysdig: AI agent logs miss 82% of credential file reads. The two measure different things (119 of 120 missed thefts in a lab versus a share of credential file reads missing from agent logs in one organization’s fleet), so we do not compare the figures or treat one as confirming the other. For the server-side risk, see Corelight’s work on pinning MCP releases.
What we could not verify
We read the paper’s HTML text and did not run or inspect the testbed code or data. All figures come from the paper itself; nothing here is independently reproduced. The paper’s author is a single academic, and the arXiv record shows a non-commercial, no-derivatives license on the text. The ATLAS and OWASP mappings in the paper are the author’s.
References
Frequently Asked Questions
- Why is the agent's own log not enough to investigate a malicious MCP server?
- In the study's code-based attack (Build A), the agent callback log recorded the credential read in only 1 of 120 successful runs, because the theft happened inside the server's own process. The kernel audit recorded the file open and the connection to the attacker in all 120. The agent log is also written on the host under suspicion, so it can be altered.
- What should I audit at the kernel level?
- The study used a Linux auditd watch on the credential file (-w <path> -p r -k cred_access) and a system-call rule on network egress (-S connect,sendto,sendmsg -k net_egress). Matching the process ID that opened the file with the process ID that attempted the connection tied the theft to one process in all 120 code-based runs.
- Does a clean kernel log mean the MCP server is safe?
- No. If the model never invokes the malicious tool, the malicious code never runs and leaves no kernel trace. In the study, the two GPT-5.x models completed no theft in the code-based build, so absence of evidence says nothing about the server itself.
- What if the leak happens inside the model's answer?
- In the poisoned-description attack (Build B), nothing is sent to the attacker. The credential appears in the final response, so that response must be preserved as evidence. The agent callback and the kernel file watch both recorded the credential read in all 103 successful runs, but only the response shows what was disclosed.