Severity:

HIGH RISK

(7.3)

OS Command Injection in mcp-server-semgrep MCP Interface

CVE-2026-7446

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution

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

VetCoders mcp-server-semgrep 1.0.0 contains an OS command injection vulnerability in the MCP Interface, where an attacker-controlled ID argument is incorporated into shell commands without proper sanitization.

A remote attacker who can influence this ID parameter can execute arbitrary system commands on the host running the MCP server, potentially leading to full compromise of the underlying environment.

Affected context

This vulnerability occurs in deployments using VetCoders mcp-server-semgrep 1.0.0 where the MCP Interface exposes functionality that processes an ID argument through functions such as analyze_results, filter_results, export_results, compare_results, scan_directory, and create_rule.

It is relevant in contexts where the server accepts IDs from clients or other services and passes them into command-line operations, scripts, or Semgrep invocations without robust validation or escaping.

The risk increases when the MCP server is reachable over a network and is configured to process IDs originating from untrusted or indirectly controlled sources.

Exploit preconditions

  • Attack surface: Network-accessible MCP interface for mcp-server-semgrep
  • Required access: Ability to send requests or structured messages that control the ID parameter processed by the vulnerable functions
  • Trigger point: Invocation of analyze_results, filter_results, export_results, compare_results, scan_directory, or create_rule with crafted ID values that are incorporated into shell commands
  • Why exploitation is possible: The implementation incorporates the ID argument into OS command strings or executes it through a shell without adequate input validation, quoting, or use of safe process-spawning APIs, allowing injection of additional commands or arguments

Why this happens

The root cause is improper handling of externally supplied data when constructing or executing system-level commands.

Instead of treating the ID value as data that must be strictly validated, normalized, and safely passed as an argument, the code likely interpolates it directly into a command string or uses a shell-based execution mechanism.

This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, and closely relates to CWE-77, where meta-characters (such as ;, &&, |, or backticks) are not stripped or neutralized.

As a result, the boundary between command logic and user data is blurred, enabling crafted IDs to alter command structure and behavior during runtime.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the mcp-server-semgrep process
  • Access to sensitive files, credentials, or configuration on the host
  • Lateral movement within the environment via installed tools or network access
  • Tampering with analysis results, rule sets, or scan outputs
  • Service disruption, including denial of service by resource exhaustion or destructive commands

General mitigation guidance

Mitigation typically focuses on enforcing a strict separation between command logic and user-controlled data.

Useful defensive patterns include:

  • Avoiding shell invocation entirely by using safe process-spawning APIs (e.g., spawn/execFile with argument arrays) that do not invoke a command shell
  • Implementing strict allowlists for expected ID formats (e.g., UUIDs, numeric identifiers) and rejecting any values that do not conform
  • Removing or encoding shell meta-characters and other dangerous tokens from inputs that may influence OS commands
  • Running the MCP server under a dedicated, least-privileged account with limited file system and network access
  • Isolating the service via containers or sandboxing so that a compromise of the process has constrained blast radius
  • Minimizing the scope of external tools and utilities available to the runtime environment

How teams detect issues like this

Detecting this class of vulnerability involves both code-level and operational monitoring approaches:

  • Static analysis: Configure linters or SAST tools to flag uses of shell-based execution APIs (e.g., child_process.exec/execSync) where arguments derive from external inputs, particularly fields like id or similar identifiers
  • Code review: During manual review, look for string concatenation or template literals that combine command strings with request parameters or untrusted data in the MCP Interface layer
  • Policy enforcement: Introduce internal guidelines that mandate parameterized process execution and disallow raw shell command construction in application code
  • Runtime monitoring: Use command auditing, system logs, and EDR solutions to detect unusual command patterns originating from the mcp-server-semgrep process, such as unexpected utilities or multi-command chains

Sources

SourceLink
github.comgithub.com/VetCoders/mcp-server-semgrep/
github.comgithub.com/VetCoders/mcp-server-semgrep/commit/141335da044e53c3f5b315e0386e01238405b771
github.comgithub.com/VetCoders/mcp-server-semgrep/issues/12
github.comgithub.com/VetCoders/mcp-server-semgrep/pull/15
github.comgithub.com/VetCoders/mcp-server-semgrep/releases/tag/v1.0.1
vuldb.comvuldb.com/submit/804100
vuldb.comvuldb.com/vuln/360187
vuldb.comvuldb.com/vuln/360187/cti

Frequently asked

questions

Yes, when the MCP Interface is network-accessible and processes IDs that can be influenced by remote clients or services, a remote attacker can exploit the command injection.

The attacker needs the ability to send requests or messages that control the ID parameter handled by the vulnerable functions; no direct OS-level access is required beyond application-level interaction.

The most robust fix is to eliminate shell-based command construction, use parameterized process execution APIs, and strictly validate and constrain all IDs to a safe, expected format before they reach any command boundary.

Establish coding standards that prohibit concatenating untrusted data into command strings, enforce use of safe process APIs, integrate static analysis rules for command injection, and incorporate security reviews for any code paths that interact with the operating system or external tools.

Find out what's already
exploitable in your codebase.