MCP Calculate Server Remote Code Execution Vulnerability
Vulnerability
A remote code execution vulnerability exists in MCP Calculate Server versions prior to 0.1.1. The issue arises from the use of eval() to process mathematical expressions without adequate input sanitization, allowing arbitrary Python code execution. This vulnerability is particularly concerning as it can be exploited through prompt injection techniques, bypassing the application's only layer of security.
Impact
Exploitation of this vulnerability allows for arbitrary code execution on the server where MCP Calculate Server is running, with the executed code inheriting the privileges of the application. This could lead to a complete compromise of the hosting machine.
Reproduction
The vulnerability can be reproduced by sending a mathematical expression that includes Python code, such as a request that asks the AI to perform an operation involving the 'sympy' or 'os' modules. The MCP server will evaluate the expression using eval(), executing the injected code in the process.
Remediation
Users are advised to update to MCP Calculate Server version 0.1.1 or later. For those using earlier versions, it is recommended to implement strict input validation and sanitization before passing user-controlled input to eval(). Consider using a whitelist of allowed mathematical operations and symbols or explore alternative methods for safe mathematical expression evaluation.
Vulnerability Rating
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.
