Skip to main content
Vulnerability Database/CVE-2026-113378

CVE-2026-113378: mcollina mcp-ripgrep RCE Vulnerability

CVE-2026-113378 is a command injection flaw in mcollina mcp-ripgrep that allows attackers to execute unauthorized OS commands. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113378 Overview

CVE-2026-113378 is an OS command injection vulnerability in mcollina mcp-ripgrep versions up to 0.4.0. The flaw resides in the Advanced Search Tool component implemented in src/index.ts. Manipulation of the fileType argument allows an attacker with local access and low privileges to inject arbitrary shell commands. The project applies an internal escapeShellArg function to sibling arguments but omits it for fileType, producing a [CWE-77] command injection oversight. A public exploit has been released, though the real-world existence of the issue remains disputed by some observers. The maintainer references documentation noting that the Model Context Protocol (MCP) server runs shell commands via ripgrep and warns users to validate input.

Critical Impact

Local attackers with low privileges can inject arbitrary OS commands through the fileType argument, executing code in the context of the user running the MCP server.

Affected Products

  • mcollina mcp-ripgrep versions up to and including 0.4.0
  • The src/index.ts Advanced Search Tool component
  • MCP server deployments exposing ripgrep functionality to local clients

Discovery Timeline

  • 2026-10-20 - CVE-2026-113378 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-113378

Vulnerability Analysis

The vulnerability exists in mcp-ripgrep, an MCP server that wraps the ripgrep command-line search utility. The Advanced Search Tool accepts several arguments and forwards them to a shell invocation of ripgrep. The project author implemented an escapeShellArg helper to sanitize arguments before interpolation into the shell string.

All sibling arguments pass through escapeShellArg, but the fileType parameter is excluded from this sanitization step. Any shell metacharacters supplied in fileType are interpreted by the underlying shell rather than treated as literal input. This allows an attacker to break out of the intended ripgrep invocation and run arbitrary commands.

Because MCP servers typically run with the privileges of the user hosting them, successful injection yields code execution in that user's context.

Root Cause

The root cause is inconsistent application of input sanitization. The escapeShellArg routine is correctly invoked on peer arguments inside src/index.ts but skipped for fileType. This classifies the issue under [CWE-77] (Improper Neutralization of Special Elements used in a Command). The maintainer notes that the project documentation warns users to exercise caution with input, but the inconsistency is an oversight rather than an intentional design.

Attack Vector

Exploitation requires local access and low-privileged authentication to the MCP interface. An attacker submits a crafted fileType value containing shell metacharacters such as command substitutions or chained commands. The MCP server interpolates the value into its shell command string and executes the injected payload. A proof of concept has been published publicly. See the GitHub Gist Exploit Overview and VulDB CVE-2026-113378 entries for technical details.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-113378

Indicators of Compromise

  • Child processes spawned by the Node.js runtime hosting mcp-ripgrep that are not rg or ripgrep (for example, sh, bash, curl, wget, nc).
  • MCP request logs containing shell metacharacters such as `, $(, ;, |, or && within the fileType field.
  • Unexpected outbound network connections initiated by the MCP server process.

Detection Strategies

  • Inspect MCP server request payloads for non-alphanumeric characters in the fileType argument, which should normally match a short allowlist (for example, js, py, md).
  • Enable process ancestry logging on hosts running mcp-ripgrep and alert when the server spawns shells or interpreters.
  • Review src/index.ts in deployed copies to confirm whether escapeShellArg is applied to fileType before invocation.

Monitoring Recommendations

  • Capture command-line arguments for all processes spawned by the MCP server and forward them to centralized logging.
  • Baseline normal ripgrep invocations and flag deviations in argument structure or spawned binary.
  • Monitor file integrity on src/index.ts and the mcp-ripgrep package directory to detect tampering.

How to Mitigate CVE-2026-113378

Immediate Actions Required

  • Audit deployments for mcp-ripgrep versions at or below 0.4.0 and restrict access to trusted local users only.
  • Avoid exposing the MCP server to untrusted clients, including shared workstations and multi-tenant developer environments.
  • Validate or allowlist the fileType argument at the client or proxy layer until an upstream fix is available.

Patch Information

No fixed version is referenced in the available CVE data at the time of publication. Monitor the upstream project at mcollina/mcp-ripgrep Security Considerations and the VulDB Vulnerability #422653 record for updates on a patched release.

Workarounds

  • Wrap or fork mcp-ripgrep to apply escapeShellArg to the fileType argument, or replace the shell invocation with an execFile-style call that passes arguments as an array rather than a string.
  • Restrict the account running the MCP server using least-privilege controls, filesystem sandboxing, or containerization to limit the blast radius of command injection.
  • Disable the Advanced Search Tool entry point if fileType filtering is not required for the deployment's workflow.
bash
# Configuration example: restrict fileType to a strict allowlist at a reverse proxy
# Only forward requests where fileType matches an alphanumeric token of 1-10 chars
if ! [[ "$fileType" =~ ^[a-zA-Z0-9]{1,10}$ ]]; then
  echo "rejected: invalid fileType" >&2
  exit 1
fi

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.