/

CVE-2026-45555

Severity:

HIGH RISK

(7.8)

Code Injection / Untrusted Plugin Loading in Roslyn

CVE-2026-45555

Deferred

Vulnerability type

Category:

Code Injection / Untrusted Plugin Loading

CWE:

CWE-94

Impact:

Arbitrary Code Execution in MCP Server Process

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Roslyn CodeLens MCP Server automatically loads and executes all DiagnosticAnalyzer assemblies referenced by a target .NET solution when running the get_diagnostics tool.

If an attacker can get a victim to open a malicious .csproj that references an attacker-controlled analyzer DLL, they may achieve arbitrary code execution within the MCP server process under the server's OS privileges.

Affected context

This vulnerability affects environments where Roslyn CodeLens MCP Server is used to provide semantic code intelligence over .NET solutions.

The issue arises specifically in the get_diagnostics MCP tool, which by default (includeAnalyzers=true) loads all DiagnosticAnalyzer assemblies referenced by the opened solution.

Installations are at risk when users open or analyze .csproj or solution files from locations that might be attacker-controlled or untrusted, such as cloned repositories, shared folders, or downloaded sample projects.

Exploit preconditions

  • Attack surface: The MCP server process that hosts Roslyn CodeLens and runs get_diagnostics against user-specified .NET solutions or projects.
  • Required access: Ability to supply or modify a .csproj or solution file that the victim will open in the MCP server context, plus the ability to host or provide the referenced analyzer DLL.
  • Trigger point: Invocation of the get_diagnostics tool against the malicious solution or project, with the default includeAnalyzers setting (true) or any configuration that permits analyzer loading.
  • Why exploitation is possible: The server implicitly trusts and loads all referenced DiagnosticAnalyzer assemblies without an allowlist, signature validation, sandboxing, or interactive user confirmation, allowing arbitrary managed code to run.

Why this happens

The core issue is untrusted plugin loading: DiagnosticAnalyzer assemblies referenced by the target solution are treated as benign extensions and executed with full privileges of the MCP server process.

This maps to CWE-94 (Improper Control of Generation of Code) because untrusted, attacker-supplied code is effectively loaded and executed without constraints, turning a diagnostics feature into a code execution channel.

The get_diagnostics tool conflates "project configuration" with "trusted execution environment," failing to enforce a trust boundary or apply validation around dynamically loaded analyzer assemblies.

Potential impact

  • Attackers may execute arbitrary .NET code within the MCP server process.
  • Compromise of the developer's workstation or server account running the MCP server.
  • Access to source code, configuration files, and sensitive data reachable by the MCP server process.
  • Installation of persistent backdoors or further tooling under the server's OS privileges.
  • Lateral movement within the development or CI environment using the MCP server as an initial foothold.

General mitigation guidance

Effective mitigation focuses on treating analyzer assemblies as untrusted code unless explicitly validated:

  • Introduce an explicit allowlist or policy that restricts which DiagnosticAnalyzer assemblies can be loaded, based on origin, path, or publisher identity.
  • Add strong validation of analyzers, such as code signing enforcement or trusted repository checks, before loading them into the MCP server process.
  • Make analyzer loading opt-in rather than default, surfacing clear prompts or configuration flags before executing third-party analyzers.
  • Consider process isolation or sandboxing for analyzer execution, limiting available privileges and filesystem or network access.
  • Encourage users to only run diagnostics on solutions from trusted sources, especially in shared or multi-tenant environments.

How teams detect issues like this

Detection and assurance can be improved with a combination of static policy checks and runtime monitoring:

  • Implement static analysis or build-time rules that flag dynamic assembly loading in the MCP server, especially APIs that load analyzers or plugins without validation.
  • During code review, treat any code that loads DiagnosticAnalyzer or other plugin assemblies as a security-sensitive boundary, mandating explicit trust and validation logic.
  • Add auditing or logging around analyzer loading: log the paths, hashes, and origins of all loaded analyzer assemblies and alert on unexpected or unapproved entries.
  • Use host-based monitoring to detect anomalous behavior from the MCP server process, such as unexpected file access, process creation, or outbound network connections.

Sources

SourceLink
github.comgithub.com/MarcelRoozekrans/roslyn-codelens-mcp/security/advisories/GHSA-552p-8f74-6x7q

Frequently asked

questions

It depends on how the MCP server is exposed. The core issue is local to the process that opens and analyzes the solution; however, if an attacker can deliver a malicious project (for example via a repository or shared directory) that a remote MCP instance analyzes, they can trigger code execution in that remote environment.

An attacker needs the ability to cause the victim to open or analyze a .NET solution or .csproj file that references an attacker-controlled DiagnosticAnalyzer assembly. This might be as simple as convincing a user to open a cloned repository, downloaded sample, or shared project that includes the malicious analyzer reference.

The safest fix pattern is to treat analyzer assemblies as untrusted by default: require explicit trust decisions (allowlists or signatures) before loading analyzers, and where possible run them in a restricted or isolated execution environment rather than the main MCP server process.

Design extension and plugin mechanisms with clear trust boundaries: avoid automatic execution of code from project metadata, require explicit opt-in for third-party code, apply strong validation (such as signing and policy checks), and adopt secure defaults that minimize implicit code execution based on user-supplied projects or configuration.

Find out what's already
exploitable in your codebase.