Hardening MCP tool servers removes all static analysis pitfalls and drops risk score to zero
Applying the authors' recommended hardening eliminates all Tier-1 findings and reduces the framework risk score from 10.0 to 0.0
Security & privacy arXiv 23 Apr 2026 Benchmark Prototype evidence
Published as “MCP Pitfall Lab: Exposing Developer Pitfalls in MCP Tool Server Security under Multi-Vector Attacks”
Why it matters
Developers can automatically detect and remediate common MCP tool-server security flaws with minimal code changes, reducing measurable risk to zero.
Summary
Applying recommended hardening eliminates all Tier-1 findings (29→0) and reduces the framework risk score from 10.0 to 0.0 with only 27 added lines of code. The static analyzer attains perfect F1=1.0 on four statically checkable pitfall classes, and a preliminary 19-run email corpus shows agent narratives diverge from trace evidence in 63.2% of runs (100% of sink-action runs). The evidence is limited to a small corpus and does not cover multimodal attacks comprehensively.
What they found 3
- Hardening eliminates all Tier-1 static findings and drives the risk score to zero
“Applying recommended hardening eliminates all Tier-1 findings (29→0) and reduces the framework risk score (10.0→0.0) at a mean cost of 27 lines of code (LOC).”
- Static analyzer achieves perfect detection on four statically checkable pitfall classes
“In Tier-1 static analysis over six variants (36 binary labels), our analyzer achieves F1=1.0 on four statically checkable pitfall classes (P1/P2/P5/P6) and flags cross-tool forwarding and imageto-tool leakage (P3/P4) as trace/dataflow-dependent.”
- Agent narratives frequently diverge from protocol traces
“Finally, in a preliminary 19-run corpus from the emailsystem challenge (tool poisoning + puppet), agent narratives diverge from trace evidence in 63.2% of runs and 100% of sink-action runs, motivating trace-based auditing and regression testing.”
Caveats 4
- The Axis 3 corpus (19 runs) is sufficient to demonstrate systematic trace-narrative misalignment but does not comprehensively assess the full D1-D5 divergence taxonomy.
- The current evaluation prioritizes validating the framework’s core capabilities (static analysis accuracy, mitigation cost- effectiveness, divergence detection methodology) over exhaustive attack coverage.
- While the framework architecture supports multimodal inputs and records image-artifactto-tool-call linkage in protocol traces, the current evaluation does not include dedicated multimodal-specific analysis.
- Schema-level constraints (enum, pattern, maxLength) are identified by the static analyzer as an additional recommended step but are not yet applied to the hardened variants, representing a known remaining gap.
What’s new here 4
- Protocol-aware testing that records MCP discovery, calls, and results instead of relying on model self-report.
- A taxonomy of six developer pitfalls (P1-P6) with static analysis for four classes and trace-based validation for the others.
- Actionable hardening guidance that removes all Tier-1 findings at low implementation cost.
- Support for multimodal inputs (image attachments) and trace-grounded validation of image-to-tool injection chains.