CVE-2026-47708

MCP-for-Stata: Command injection via log_file_name parameter in Stata command wrapper

Published Jul 21, 2026 CVSS 4.0 · 9.3 Critical EPSS < 1% KEV · Not listed
Description
MCP-for-Stata is an MCP server for Stata to integrate Stata into an agent. Prior to version 1.17.3, the `log_file_name` parameter in the `stata_do` API and CLI is directly interpolated into a Stata command string without sanitization. The security guard (`GuardValidator`) only scans the do-file content but does not validate this parameter. An attacker can inject arbitrary Stata commands (including `shell`, `python`, `erase`, etc.) by crafting a malicious `log_file_name` containing quotes, newlines, or Stata command separators. Version 1.17.3 contains a patch for the issue.

Analysis

AI-generated

Technical impact

MCP‑for‑Stata is a server that integrates Stata into an agent. Prior to version 1.17.3, the log_file_name parameter in the stata_do API and CLI is directly interpolated into a Stata command string without sanitization. The security guard GuardValidator only scans the do‑file content but does not validate this parameter. An attacker can inject arbitrary Stata commands—including shell, python, erase, and others—by crafting a malicious log_file_name containing quotes, newlines, or Stata command separators. The injected commands are executed by the server, giving the attacker the ability to run arbitrary system commands on the host and compromise confidentiality, integrity, and availability. The issue is fixed in version 1.17.3 with input validation for log_file_name.

Affected Systems

The vulnerability affects all installations of SepineTam’s MCP‑for‑Stata prior to version 1.17.3. Any instance that accepts external log_file_name input—whether through the public API or the command‑line interface—remains susceptible. The patch was introduced in version 1.17.3, which validates and sanitizes the log_file_name parameter.

Risk and Exploitability

The CVSS score of 9.3 classifies this as a critical vulnerability, while the EPSS score of less than 1% indicates a low current exploitation probability. The vulnerability is not listed in the CISA KEV catalog. The attack vector is inferred to be remote if the MCP server is reachable from an untrusted network; a local attacker with access to the agent could also exploit the flaw by invoking the CLI with a crafted log_file_name. Successful exploitation requires the attacker to supply a malicious log_file_name value through the vulnerable interface; the server then executes the embedded Stata commands without validation, allowing arbitrary system command execution.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade MCP‑for‑Stata to version 1.17.3 or later, which incorporates input validation for log_file_name.
  • Deploy a filter that sanitizes or escapes quotes, newlines, and Stata command separators within the log_file_name parameter before it is used in command construction.
  • Limit access to the stata_do API and command‑line interface to trusted users only, and run the MCP server with the least privilege necessary to perform its functions.

Generated by OpenCVE AI on July 30, 2026 at 16:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-4p62-hqp5-g644 MCP-for-Stata: Command injection via log_file_name parameter in Stata command wrapper
History
Type Values Removed Values Added
First Time appeared Sepinetam
Sepinetam stata-mcp
Vendors & Products Sepinetam
Sepinetam stata-mcp
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description MCP-for-Stata is an MCP server for Stata to integrate Stata into an agent. Prior to version 1.17.3, the `log_file_name` parameter in the `stata_do` API and CLI is directly interpolated into a Stata command string without sanitization. The security guard (`GuardValidator`) only scans the do-file content but does not validate this parameter. An attacker can inject arbitrary Stata commands (including `shell`, `python`, `erase`, etc.) by crafting a malicious `log_file_name` containing quotes, newlines, or Stata command separators. Version 1.17.3 contains a patch for the issue.
Title MCP-for-Stata: Command injection via log_file_name parameter in Stata command wrapper
Weaknesses CWE-77
References
Metrics cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-77

    Improper Neutralization of Special Elements used in a Command ('Command Injection')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 22, 2026, 3:10 PM
Reserved
May 19, 2026, 9:29 PM
Status
Deferred
Published
Jul 21, 2026, 9:16 PM
Modified
Oct 24, 2026, 7:10 PM