CVE-2026-47708 in stata-mcpinfo

Summary

by MITRE • 07/22/2026

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.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 07/22/2026

The MCP-for-Stata vulnerability represents a critical command injection flaw that undermines the security boundaries of a Stata integration system designed for agent-based workflows. This vulnerability exists within the `stata_do` API and CLI components where the `log_file_name` parameter undergoes insufficient input validation, allowing attackers to manipulate the execution flow through direct interpolation into Stata command strings. The affected system fails to implement proper sanitization mechanisms for user-supplied parameters, creating a pathway for arbitrary code execution within the Stata environment.

The technical nature of this vulnerability aligns with CWE-74, known as "Improper Neutralization of Special Elements in Output Used by a Downstream Component," and more specifically manifests as CWE-94, "Improper Control of Generation of Code ('Code Injection')." The flaw occurs because the `GuardValidator` component focuses exclusively on inspecting the do-file content rather than validating the `log_file_name` parameter itself, creating a false sense of security. This validation gap enables attackers to inject malicious Stata commands by exploiting special characters such as quotes, newlines, and command separators that are interpreted by the Stata interpreter.

The operational impact of this vulnerability extends beyond simple code injection, as it provides attackers with access to potentially dangerous Stata commands that can compromise system integrity and data confidentiality. Commands like `shell`, `python`, and `erase` present particular risks since they can execute external processes, leverage Python integration capabilities, or delete files within the system. The vulnerability affects not only the local Stata environment but also potentially exposes underlying system resources and data processing capabilities to unauthorized manipulation, especially when the MCP server operates with elevated privileges.

The security implications of this flaw demonstrate how inadequate input validation in API endpoints can create persistent attack vectors for lateral movement and privilege escalation. Attackers can leverage this vulnerability to execute arbitrary commands within the Stata environment without proper authentication or authorization, potentially leading to data exfiltration, system compromise, or disruption of analytical workflows. The vulnerability's presence in versions prior to 1.17.3 indicates a failure in secure coding practices and inadequate security testing of integration points.

Mitigation strategies should focus on implementing proper input sanitization and validation for all user-supplied parameters before they are interpolated into command strings. The patch introduced in version 1.17.3 addresses the core issue by ensuring that the `log_file_name` parameter undergoes comprehensive validation to prevent injection of special characters and command separators. Organizations should also implement principle of least privilege configurations, restrict external process execution capabilities, and consider additional layers of input validation beyond content inspection. Compliance with security standards such as those outlined in the OWASP Top Ten and NIST cybersecurity frameworks should be maintained through proper secure coding practices and thorough testing procedures that include dynamic analysis and penetration testing to identify similar injection vulnerabilities in other components.

The vulnerability serves as a reminder of the importance of validating all inputs at multiple levels within integrated systems, particularly when dealing with command execution environments. The absence of parameter validation in the `GuardValidator` component highlights the need for comprehensive security architectures that consider both content and parameter-level validation. Organizations implementing similar integration frameworks should conduct regular security assessments to identify and remediate such injection vulnerabilities before they can be exploited by malicious actors.

Responsible

GitHub M

Reservation

05/19/2026

Disclosure

07/22/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!