CVE-2025-52573: iOS Simulator MCP Command Injection allowed via exec API
6
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
ios-simulator-mcp | npm | < 1.3.3 | 1.3.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability exists because the application uses the Node.js child_process.exec
function (via the execAsync
promisified wrapper) to execute shell commands. Several tool handlers exposed by the MCP server construct these commands by directly concatenating untrusted user input (e.g., udid
, duration
, text
, file paths) into the command string. This is a classic command injection vulnerability.
An attacker can provide malicious input containing shell metacharacters (e.g., ;
, &&
, |
, $()
) as arguments to these tools. When the command string is passed to the shell for execution, the injected characters are interpreted as command separators or substitutions, allowing the attacker to execute arbitrary commands on the host system where the MCP server is running.
The patch addresses this vulnerability comprehensively by:
- Replacing all calls to
execAsync
with a newrun
helper function that usesexecFile
with theshell: false
option. This ensures that arguments are passed directly to the executable without being interpreted by a shell. - Passing all command arguments as an array, which is the secure practice for
execFile
andspawn
. - Adding the
--
argument in command calls to explicitly tell the command-line tool that no more options will follow, and subsequent arguments are positional, preventing misinterpretation of user input that might start with a hyphen. - Introducing strict input validation using regular expressions for parameters like
udid
,duration
, andtext
to limit the attack surface.
The identified vulnerable functions are the anonymous async handlers for each tool (ui_tap
, ui_type
, etc.) because they are the entry points that receive the malicious input and perform the unsafe command construction and execution.