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.
Published: 2026-07-21
Score: 9.3 Critical
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

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.

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

Remediation

No vendor fix or workaround currently provided.

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

Thu, 23 Jul 2026 11:30:00 +0000

Type Values Removed Values Added
First Time appeared Sepinetam
Sepinetam stata-mcp
Vendors & Products Sepinetam
Sepinetam stata-mcp

Wed, 22 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Tue, 21 Jul 2026 21:15:00 +0000

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'}


Subscriptions

Sepinetam Stata-mcp
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-22T15:10:36.426Z

Reserved: 2026-05-19T21:29:25.481Z

Link: CVE-2026-47708

cve-icon Vulnrichment

Updated: 2026-07-22T15:09:47.998Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-30T16:30:05Z

Weaknesses
  • CWE-77

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