Severity:

HIGH RISK

(7.3)

Command Injection in dvladimirov MCP GitSearchRequest

CVE-2026-7211

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-74, CWE-77

Impact:

Remote Code Execution via Command Injection

Severity:

HIGH RISK

(7.3)

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

dvladimirov MCP up to version 0.1.0 contains a command injection vulnerability in the GitSearchRequest handler of the Git Search API, where user-controlled repo_url or pattern values are passed into shell commands.

A remote attacker who can invoke this API with crafted input may execute arbitrary OS commands with the privileges of the MCP server process.

Affected context

The vulnerability occurs in the Git Search API implementation of dvladimirov MCP, specifically in the GitSearchRequest function in mcp_server.py.

It manifests when the server uses user-supplied repo_url or pattern values to build command-line invocations (e.g., git or search utilities), and those values are concatenated or interpolated into shell commands without robust sanitization.

Environments that expose this API over a network or through chained tools (such as agents or plugins) are affected when they allow untrusted or semi-trusted users to reach the Git search functionality.

Exploit preconditions

  • Attack surface: Network-exposed or tool-integrated Git Search API endpoint that processes GitSearchRequest.
  • Required access: Ability to send a GitSearchRequest containing controlled repo_url and/or pattern parameters (e.g., via HTTP, MCP client, or integrated tool).
  • Trigger point: The server constructs and executes system commands using these parameters, typically via a shell or shell-like interface.
  • Why exploitation is possible: User-controlled strings are injected directly into command lines without strict argument separation, escaping, or allowlisting, allowing an attacker to break out of expected parameters and introduce additional commands or shell metacharacters.

Why this happens

The core issue is an unsafe pattern of building OS command strings from untrusted input, mapping to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

Instead of treating repo_url and pattern as opaque arguments, the code likely concatenates them into a shell command, relying on the shell to parse the complete string.

Without strict neutralization or the use of non-shell invocation APIs, attackers can insert metacharacters such as ;, &&, |, or backticks to inject additional commands or alter the command structure.

The related CWE-74 aspect reflects that user-controlled data is being incorporated into command-line contexts without appropriate validation, encoding, or contextual escaping.

Potential impact

  • Execution of arbitrary system commands with the privileges of the MCP server process
  • Unauthorized access to source code repositories or local files
  • Exfiltration of sensitive data such as credentials, SSH keys, or configuration secrets
  • Destruction or tampering with local repositories and application data
  • Establishment of a foothold for further lateral movement in the hosting environment

General mitigation guidance

Effective mitigation focuses on eliminating direct shell interpretation of user-controlled input and strictly controlling how external commands are invoked:

  • Prefer APIs that bypass the shell entirely (e.g., direct library calls or subprocess invocation with argument arrays and shell=False-style patterns).
  • Treat repo_url and pattern as data-only arguments: avoid string concatenation or interpolation into command strings.
  • Apply rigorous validation and allowlisting for structured parameters such as repository URLs, branch names, and search patterns (e.g., restrict to expected formats and characters).
  • Enforce least-privilege execution for the MCP server so that, if a command is abused, its impact is limited.
  • Where possible, isolate VCS and search operations in a constrained environment (e.g., containers, sandboxes, or dedicated service accounts with restricted permissions).

How teams detect issues like this

Detection often combines code-level review with runtime monitoring:

  • Static analysis: Configure rules to flag uses of shell execution APIs (e.g., generic shell invocation functions) where any part of the command string is influenced by external input such as repo_url or pattern.
  • Code review signals: Look for string concatenation or formatting used to build command lines, especially in request handlers or API endpoints handling user parameters.
  • Policy enforcement: Introduce development policies and pre-commit hooks disallowing shell-based command construction in server-side components without explicit security review.
  • Runtime monitoring: Use process auditing to detect unusual child processes spawned by the MCP server, anomalous arguments, or command patterns indicative of injection attempts.
  • Automated security testing tools and fuzzers can be pointed at the Git Search API to identify unexpected command execution paths.

Sources

SourceLink
github.comgithub.com/dvladimirov/MCP/
github.comgithub.com/dvladimirov/MCP/issues/2
vuldb.comvuldb.com/submit/802083
vuldb.comvuldb.com/vuln/359807
vuldb.comvuldb.com/vuln/359807/cti

Frequently asked

questions

Yes. If the Git Search API is reachable over a network or via integrated tools that handle untrusted input, a remote attacker can exploit the issue by sending crafted GitSearchRequest payloads.

The attacker needs the ability to invoke the GitSearchRequest functionality with crafted repo_url or pattern values. This might be direct network access to the MCP server or indirect access through a client, agent, or plugin that forwards user input.

Refactor the GitSearchRequest implementation to avoid shell-based command construction. Use library APIs or safe process invocation with explicit argument lists, combined with strict validation and allowlisting of all user-controlled parameters.

Adopt secure coding guidelines that forbid passing untrusted input into shell commands, enforce code review checks around external process execution, and integrate static analysis to automatically flag unsafe command construction patterns during development and CI.

Find out what's already
exploitable in your codebase.