acceptodds
Under review as a conference paper at ICLR 2027

CPI: Contextual Prompt Injection against MCP Server Scanners

Abstract

Large language model (LLM)-based Model Context Protocol (MCP) Server scanners increasingly analyze not only executable code but also repository-level context, such as README files, tool descriptions, and code comments. Because this context can be freely manipulated by MCP maintainers, it creates an overlooked attack surface where a malicious maintainer may influence scanner judgments through security claims. Building on this insight, we introduce Contextual Prompt Injection (CPI), a black-box attack that uses a scanner’s own findings to construct vulnerability-specific remediation narratives, claiming that reported issues have been fixed while leaving the relevant executable implementation unchanged. To enable realistic evaluation, we curate a dataset containing 372 real-world MCP Servers, including 45 with verified vulnerabilities. We evaluate CPI against three LLM-based MCP security scanners and existing benchmarks. Evaluation with manual verification shows that CPI suppresses at least one genuine vulnerability finding in more than half of baseline-positive repositories for each evaluated scanner. Such findings demonstrate that LLM-based scanners can prioritize attacker-controlled remediation claims over contradictory code evidence, highlighting the need to treat repository context as untrusted input and independently verify claimed fixes.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
Contextual Prompt Injection, Model Context Protocol (MCP), LLM-based Security Scanners, LLM Security, Vulnerability Detection

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_BEbpOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper examines whether attacker-controlled repository content can mislead LLM-based MCP scanners. The proposed attack, CPI, uses the scanner’s initial findings to write false claims that specific vulnerabilities have been fixed. These claims are then added to README files, tool descriptions, and code comments. The evaluation covers three scanners and 372 real-world MCP server repositories. The results suggest that the tested MCP scanners are vulnerable to CPI attacks.

Critical strengths
  1. The evaluation includes real-world MCP server repositories and a manually verified vulnerability subset, making the problem practically relevant and providing evidence beyond synthetic examples.
  2. The experiments cover three widely used MCP scanners and multiple injection surfaces, revealing susceptibility to attacker-controlled remediation claims under the evaluated configurations.
  3. The controlled ablations support the proposed mechanism: vulnerability-specific narratives outperform direct instructions and generic claims, and multi-context injection is strongest, while the implementation is left unchanged.
Critical weaknesses
  1. The novelty relative to closely related work is insufficiently established. Prior work [1-2] on LLM-based vulnerability detection and security code review has already examined non-executable adversarial comments and misleading security narratives. Although the paper studies MCP scanners as a new application setting, it does not clearly demonstrate substantial novelty in its attack surfaces compared with prior work.
  2. Important evaluation details are missing. The paper omits key evaluation details, including the backend models used by the MCP scanners. Moreover, without reporting the scanners’ false positive rates, it's difficult to assess their detection reliability and contextualize the reported attack effectiveness.
  3. The threat model assumes access to a detailed baseline report. CPI relies on the scanner's per-finding output to construct vulnerability-specific narratives. Limited-feedback or no-feedback settings, where the scanner returns only a coarse summary, are not evaluated, so the attack's dependence on detailed scanner output is unclear.

[1] Alibi: Adaptive Agentic Attacks on LLM-Based Vulnerability Detectors via Adversarial Code Comments

[2] SEVRA-BENCH: Social Engineering of Vulnerabilities in Review Agents

Questions for authors
  1. Evaluation Metrics. The evaluation uses BDR, PDR, and ASR, with PDR defined as the fraction of repositories for which all baseline target findings are retained after CPI injection. Under this definition, suppressing even one target finding in a repository with multiple baseline findings counts as a successful attack. However, I would also like to see a stricter success metric that counts an attack as successful only when the post-attack scan reports no vulnerabilities. This is particularly relevant to the authors’ threat model: a plausible user policy is to reject an MCP server whenever any vulnerability is detected, regardless of how many findings remain. Could the authors additionally report (1) the average number of vulnerability findings per repository before and after the attack, and (2) the number and proportion of baseline-positive repositories with zero vulnerability findings after CPI injection?

  2. Evaluated Models. Tencent A.I.G. supports configurable model backends, but the authors do not disclose which model was used in their evaluation. Could the authors specify the backend model and evaluate at least one SOTA model (e.g., gpt-6) within the same scanner workflow to assess whether their findings hold for scanners powered by SOTA models?

  3. Attack Under Limited Feedback. CPI uses the scanner's baseline findings to build its narratives. How does the attack's effectiveness degrade when the adversary receives only a pass/fail verdict or a coarse severity summary rather than per-finding details, and can you provide results in such a limited-feedback setting?

Reviewer_wazFOpenReview ↗
Rating
2
Confidence
3
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

The paper introduces Contextual Prompt Injection (CPI), a novel black-box attack targeting LLM-based MCP Server scanners. CPI uses a scanner’s baseline findings to generate false, vulnerability-specific remediation claims and injects them into README files, tool descriptions, and code comments without changing the vulnerable implementation. The authors evaluate the attack against three scanners using a curated dataset of 372 repositories, a manually verified subset of 45 repositories, and two existing benchmarks, MCPTox and MSB.

The paper addresses an interesting and timely security concern: LLM-based MCP Server scanners can be influenced by misleading natural-language claims about vulnerability remediation. However, the current evaluation is not sufficiently comprehensive, and several methodological details remain unclear, limiting confidence in the reported results and their reproducibility. Additional controls, more detailed experimental reporting, and a more extensive evaluation would substantially strengthen the paper.

Critical strengths
  1. The paper highlights an interesting and practically relevant attack surface, i.e., the natural-language context LLM-based scanners consume when evaluating MCP servers, which scanners have not accounted for, especially as registries increasingly rely on automated scanning tools.
  2. Limiting the attack to natural-language modifications while keeping the vulnerable implementation unchanged is a reasonable design choice because it helps distinguish the influence of misleading context from actual vulnerability remediation.
  3. The case study in Appendix A is compelling and offers useful insight into how injected remediation claims can influence the scanner’s reasoning.
Critical weaknesses
  1. Table 1 reports averages over three runs but does not include standard deviations or individual run results, making it difficult to assess the stability of the findings. The authors mention repeated experiments only for Table 1, while Tables 2 and 5 appear to report single-run results. As a result, the influence of LLM stochasticity on the reported attack effectiveness remains unclear. More importantly, the evaluation lacks null control. The authors do not report how often findings disappear when an unmodified repository is rescanned or when neutral text is added without an adversarial payload. Without such a control, it is difficult to determine how much of the observed suppression is attributable to CPI.
  2. The paper does not identify the LLMs used by the three scanners or provide their configurations beyond stating that internal settings were kept unchanged. Because vulnerability detection and susceptibility to prompt injection may depend substantially on the backend model, these details matter for interpreting the results. Ideally, the evaluation would also examine different scanner backends. In addition, all attacker-side LLM operations rely on DeepSeek-V4-Flash. Evaluating other model families, such as Mistral, Qwen, and GPT, including both open-source and closed-source models, would help establish CPI's generalizability.
  3. Several methodological details remain unclear, including how findings are matched before and after injection, how reclassified findings are handled, and how the implementation invariant is verified. The paper also lacks concrete payload-generation prompts and examples and does not sufficiently explain how CPI is adapted to MCPTox and MSB. For Snyk, the authors use a replay server that exposes only MCP metadata but do not explain the mechanism in detail or how the three injection surfaces are represented.
  4. Table 4 uses 100 randomly selected repositories that were previously flagged as vulnerable, which may introduce selection effects and inflate the observed ASR. Repeating the experiment on the 45 manually verified repositories would provide stronger evidence.
  5. The paper does not investigate why CPI fails on the remaining 23–48% of baseline-positive repositories or whether these failures display systematic patterns related to vulnerability type, scanner stage, or injection surface. It is also unclear whether successful suppression is consistent across repeated scans or largely stochastic.
  6. The evaluation lacks comparisons with simpler attack-generation baselines. While adapting related approaches such as FlashBoom and Bernstein et al. to MCP scanners may be challenging due to their different attack mechanisms, a useful baseline would be a standalone LLM or an agentic coding harness (e.g., Codex or Claude Code) given the scanner report and repository and asked to perform the full pipeline in a single step.
  7. The paper evaluates only a single prompt-level defense on A.I.G. Without variance estimates, it is unclear whether this difference shows a meaningful improvement.
Questions for authors
  1. How often do baseline findings disappear when the same unmodified repository is rescanned? Could the authors report CPI’s ASR alongside this null rate, including per-run results and variance for all experimental tables?
  2. Which LLMs and configurations do the three scanners use?
  3. What proportion of baseline findings in the full dataset are false positives, and how many of the suppressed findings correspond to genuine vulnerabilities? Also, what are the severity levels of the vulnerabilities identified, as well as those that were suppressed?
  4. How are baseline and post-injection findings matched, and what steps were taken to evaluate the accuracy of this matching procedure?
  5. Why does CPI fail on the remaining repositories? Are there identifiable patterns associated with particular vulnerability classes or scanners?
  6. How does CPI perform relative to other baseline/s when evaluated on the same repositories?
  7. Were the affected scanner vendors notified of the findings?
Reviewer_oUw7OpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

The paper studies LLM-based scanners for MCP servers (Tencent A.I.G., Cisco MCP Scanner, Snyk Agent Scan) and asks whether text the maintainer controls (README, tool description, code comments) can talk a scanner out of a real finding. The proposed attack, CPI, scans the repo once, takes the scanner's own report, and has an LLM write a "this was already fixed" narrative for each finding. That narrative is placed in the README, in the affected tool's description and in a comment near the vulnerable code, while the executable code is left untouched. The repo is then rescanned.

The authors also build a set of 372 MCP server repos (filtered from the first 1,000 MCPZoo entries with LLM-assisted screening), of which 45 have manually verified vulnerabilities. They report that after injection at least one baseline finding disappears in 52-77% of baseline-positive repos on the full set, 52-60% on the verified subset, and 50-87% on MCPTox and MSB. Ablations compare a direct instruction, a generic fix claim and a finding-specific narrative, compare the three injection surfaces, and test one prompt-level defense on A.I.G.

Critical strengths
  1. The question is a real one. Scanners that read README text and comments next to the code are being adopted, and nobody has checked what happens when the maintainer is the adversary. Treating this as a trust-boundary problem for the scanner, rather than for the agent that consumes the server, is useful. The paired design (same repo before and after, executable code frozen) is the right way to isolate the effect of context, and it is what makes the question worth taking seriously.

  2. The Appendix A trace is the most convincing part of the paper. The injected text points to path-validation functions that really exist in the repo, and the scanner generalizes them to a URL sink where they do nothing. That shows a concrete failure and not just a rate. The breadth (three scanners, two outside benchmarks, released code) also helps.

Critical weaknesses
  1. No control for scanner nondeterminism, and thin statistics. These scanners are agentic LLM pipelines, so rescanning an untouched repo will often return a different set of findings. The paper never reports how often. There is no rerun of unmodified repos and no neutral-text injection (an irrelevant paragraph of the same length in the README or a comment). Table 4 shows why this matters: a direct instruction to ignore the risk and a generic "issues were fixed" sentence, neither with finding-specific content, already give 43% and 42% ASR. So what can be attributed to CPI's specificity is about 13 pp, on 100 repos and apparently one run. The rates in Tables 2, 3 and 5 also look like single runs (they correspond to whole repo counts out of 372), with no variance. On the 45-repo subset there are only about 23 to 39 baseline-positive repos per scanner, so a rough binomial interval on ASR is +/- 16 to 20 pp, and the abstract's "more than half" (52.5% for Snyk) cannot be told apart from 50%. Without a no-op baseline I cannot say how much of the 52-77% is CPI and how much is noise.

  2. The metric is lenient and partly mislabeled. An attack counts as successful if any one baseline finding is lost, which is easy to hit by chance when a repo has several findings. BDR is defined as "at least one finding" but PDR as "all baseline findings retained", so the two are not on the same footing, and PDR is not really a detection rate: a repo where two of three real findings survive is counted as not detected. What matters for the stated adversary goal is whether the verdict changes (zero findings after injection) or what fraction of individual verified findings is dropped. Neither is reported. Matching findings across scans "by vulnerability semantics and code location" is also under-specified. Who does the matching (an LLM or a person), what is its error rate, and what happens when the same sink is re-reported under a different category or line? All of this feeds directly into ASR.

  3. The central claim, that scanners favor attacker claims over contradictory code evidence, is not supported uniformly. For Snyk Agent Scan, which has the highest ASR (77%), the authors expose only MCP-visible metadata through a replay server. If the scanner never sees the code there is no code evidence to override, README and comments are invisible to it, and CPI reduces to a tool-description injection, so its numbers are not comparable with the other two scanners. The paper also does not say which analyzers and backing models were active in Cisco MCP Scanner, or whether non-LLM analyzers were involved. On MCPTox the vulnerability is the poisoned description itself, so "implementation preserved" is hard to interpret when CPI edits the description field. For MSB, Cisco detects nothing, and the round numbers for the others (80/40, 100/32) suggest small samples, but sample sizes are not given for either benchmark, and neither benchmark was built as scanner ground truth. Finally, the mechanism ("contextual evidence laundering") rests on one A.I.G. trace. Early termination or distraction of a multi-agent audit is an equally plausible reading, and nothing in the experiments separates the two.

  4. Ground truth and dataset construction. The full-dataset numbers measure disappearance of scanner outputs, which the authors admit may include false positives (Appendix B), yet the abstract and introduction speak of suppressing genuine vulnerabilities. The verified subset is 45 of 372 repos and the verification protocol is not described: how many annotators, what criteria, what agreement, which vulnerability classes, and whether the verified findings were taken only from what the scanners had already reported (in which case the subset says nothing about misses). Curation relies on an LLM (DeepSeek-V4-Flash) with a final manual check, but the precision and recall of the filtering are not reported, and "first 1,000 MCPZoo entries" is an arbitrary cut. The same LLM also writes the payloads, with no human-written or second-LLM comparison, and the injected text itself is never shown in the paper.

  5. Missing baselines and a weak defense result. The related work cites attacks that already mislead LLM-based code auditors (Li et al., S&P 2025; Bernstein et al., NDSS 2026), but there is no empirical comparison, so the gain over existing manipulation is unknown and the contribution comes down to tailoring the claim to the scanner's own report. On the defense side, the evidence-prioritization prompt is tested on A.I.G. only and is presented as support for the failure mechanism. Table 4 says something different. ASR falls from 56 to 50, but BDR falls from 100 to 92 and PDR moves from 44 to 46. The ASR drop is mostly the shrinking denominator: the defended scanner keeps only 2 more repos (out of 100) under attack and loses 8 at baseline. Obvious defenses are not tried, such as scanning with README and comments stripped and merging the findings with a normal scan, or a verifier pass that must locate the claimed fix in code. There is also no attacker adapting to the defense. "Treat context as untrusted" is a reasonable recommendation, but here it is assumed more than it is tested.

Questions for authors
  1. What happens when unmodified repos are rescanned several times, and when a neutral paragraph of the same length is inserted? Please report finding churn and ASR for these controls, per scanner.
  2. How are baseline and post-injection findings matched (LLM or manual), and with what error rate? Can you report per-finding retention and the share of repos that end up with zero findings?
  3. For each scanner, which analyzers and models were enabled, and what does it actually see (source, README, comments, tool metadata)? Please split the results by what the scanner can observe, and explain how the Snyk results relate to the claim about overriding code evidence.
  4. How was the 45-repo subset verified (annotators, criteria, agreement, vulnerability classes, findings per repo), and were verified findings drawn only from scanner reports? What are the sample sizes for MCPTox and MSB?
  5. Were the confirmed vulnerabilities in the 45 servers reported to the maintainers, and were the scanner vendors told about the attack before submission?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.