GHSA-3CP6-M69F-V2CJ
Unrestricted screen-recording filtergraphs allow host file overwrite, SSRF, and conditional code execution
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.94.2 | appium-mcp · -2 d desde divulgación | |
| Divulgación | Publicada | GHSA-3CP6-M69F-V2CJ divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Unrestricted screen-recording filtergraphs allow host file overwrite, SSRF, and conditional code execution
Summary
`appium_screen_recording` exposes the iOS `videoFilters` and `videoScale` fields directly to an MCP client. Appium MCP performs no validation before forwarding either value to Appium XCUITest. XCUITest then places the value in FFmpeg's `-vf` argument. This avoids shell parsing, but it does not make the FFmpeg filtergraph language safe: filters can open URLs and write to attacker-selected host paths.
A connected MCP client, including an AI agent influenced by untrusted app content, can therefore cause FFmpeg on the Appium host to:
- create or overwrite an arbitrary path writable by the Appium process using `metadata=...:file=...`; and
- initiate requests to internal or loopback services using URL-capable filters such as `movie` or `subtitles`; and
- inject valid subsequent lines into line-oriented files, enabling conditional code execution through shell startup files or persistent access through SSH authorization files when the relevant host feature is used.
`videoScale` is a second route to the same filtergraph parser because XCUITest constructs `scale=<videoScale>`. A comma terminates the intended scale filter and starts another filter. Removing only `videoFilters` does not fix the issue.
Product and affected versions
- Repository: `appium/appium-mcp`
- Package: `appium-mcp` (npm)
- Introduced by: `a04c1d235326a4e934b2920434ee82818109b364` (`feat(interactions): implement screen recording (#228)`)
- First affected release: `v1.36.0`
- Confirmed affected: `v1.94.0`, commit `541dbd62cfbed9a86ea283a8f2ecd8edabecb497`
- Suggested affected range: `>= 1.36.0, <= 1.94.0`
- Platform precondition: an active iOS/XCUITest session and FFmpeg installed on the Appium host
Data flow
In `src/tools/interactions/screen-recording.ts`, both inputs are unrestricted strings:
videoFilters: z.string().optional()
videoScale: z.string().optional()They are copied unchanged into `IOSRecordingOptions` and passed to `startRecordingScreen()`.
In `appium-xcuitest-driver/lib/commands/recordscreen.ts`, XCUITest constructs:
args.push('-vf', videoFilters || `${scaleFilterHWAccel || 'scale'}=${videoScale}`)Using an argv array prevents shell metacharacter injection, but the argument is deliberately interpreted as a complete FFmpeg filtergraph.
Safe reproduction
Testing was limited to an isolated local environment. No third-party system or sensitive file was accessed.
MCP-to-driver proof
The attached Jest research test registers the real `appium_screen_recording` MCP tool and verifies that both payloads reach `startRecordingScreen()` unchanged:
videoFilters = movie='http\://127.0.0.1\:18765/marker.mp4'
videoScale = 32:32,subtitles='http\://127.0.0.1\:18765/marker.srt'Result: `2 passed`.
Host file creation and overwrite
With a synthetic color input and FFmpeg 7.0.2, the filter passed through `videoScale` was equivalent to:
scale=32:32,metadata=mode=add:key=proof:value=APPIUM_MCP_FILTER_WRITE_7319,metadata=mode=print:file='/tmp/appium_mcp_metadata_write_proof.txt'Observed file:
frame:0 pts:0 pts_time:0
proof=APPIUM_MCP_FILTER_WRITE_7319Repeating the test against a pre-existing sentinel file removed the original contents and replaced them with attacker-influenced output, proving overwrite rather than create-only behavior. A separate harmless test placed an actual newline in the metadata value; FFmpeg emitted the text after that newline as an independently attacker-controlled line. The output begins with FFmpeg's frame/metadata lines, so this is not byte-for-byte arbitrary file content, but it is sufficient to inject attacker-selected subsequent lines into parsers that ignore malformed or unrelated leading lines.
Two safe parser/activation controls confirmed that this is security-relevant content control:
- A generated ED25519 public key was placed after the fixed FFmpeg lines in a temporary `authorized_keys`-shaped file. `ssh-keygen -l -f` successfully parsed and reported the injected key.
- A harmless `touch <temporary-marker>` line was placed after the fixed lines in a temporary Bash startup file. Starting an isolated interactive Bash process with only that file created the marker (`CONDITIONAL_SHELL_EXECUTION TRUE`). The temporary directory and generated test key were then deleted.
No real SSH configuration, user startup file, or persistent host setting was modified.
Real XCUITest ScreenRecorder integration
The attached integration harness instantiated the installed `appium-xcuitest-driver` 12.10.0 `ScreenRecorder` class itself, supplied a local synthetic MJPEG stream in place of a device stream, and provided the same malicious `videoFilters` option. The real class built and launched its FFmpeg subprocess, encoded a valid MP4, and created the proof file:
REAL_XCUITEST_SCREENRECORDER_WRITE trueThis closes the downstream boundary without reimplementing the vulnerable command construction. All media, output, and proof files were kept in a random temporary directory and automatically deleted.
Loopback request
A local HTTP listener was bound to `127.0.0.1:18765`. Both a direct `videoFilters` graph and the `videoScale` filter-chain route caused FFmpeg to request the marker resource. The listener observed HTTP 200 GET requests. This is blind SSRF: the MCP response does not directly return the fetched body.
The attached local-only PoC reproduces both effects in a temporary directory and deletes its files automatically.
Impact
The file-write primitive crosses from the constrained MCP tool interface into the Appium host filesystem. It can overwrite any path writable by the Appium/FFmpeg process, potentially corrupting application configuration, developer files, build artifacts, or service state. Because attacker-controlled new lines remain valid after FFmpeg's fixed prefix, overwriting a shell startup file causes attacker-selected commands to execute the next time that shell starts. Likewise, an SSH public key remains valid after the prefix in an `authorized_keys` file. These are conditional code-execution/persistent-access paths: they require the target path to be writable and the corresponding shell or SSH feature to be used.
The network primitive can reach loopback and internal services from the Appium host and can trigger state-changing unauthenticated HTTP endpoints. It is blind in the demonstrated MCP flow.
The issue is particularly relevant to MCP because tool calls may be generated by a model after processing untrusted content from the application under test. Appium MCP's previously published security advisory GHSA-pchr-rp2x-w3vw recognizes this prompt-injection-to-tool-call threat model.
Suggested classification
- Primary: CWE-73, External Control of File Name or Path
- Secondary: CWE-918, Server-Side Request Forgery
- Related: CWE-20, Improper Input Validation
Suggested CVSS v3.1, following the project's existing local MCP/prompt-injection threat-model convention:
`CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H` — 7.5 High
This follows the project's existing local MCP/prompt-injection scoring convention and accounts for the demonstrated conditional shell-startup execution path. It does not characterize the issue as unauthenticated network RCE.
Recommended remediation
Do not expose an unrestricted FFmpeg filtergraph string to MCP callers. Remove `videoFilters` from the MCP schema. Validate `videoScale` as exactly two bounded dimensions separated by one colon; allow only positive integers and, if compatibility requires them, the documented `-1`/`-2` scale sentinels.
A denylist is insufficient because FFmpeg has many file- and URL-capable filters and multiple escaping forms. Validation must occur before forwarding to Appium.
Defense in depth:
- run Appium/FFmpeg as a dedicated low-privilege user;
- restrict its writable filesystem to a per-recording directory;
- block unnecessary outbound and internal-network access; and
- add regression tests for commas, semicolons, quotes, URL schemes, `metadata=...:file=`, `movie`, and `subtitles` in both fields.
Fix validation
A prototype removes `videoFilters` from the MCP schema and restricts `videoScale` to bounded dimensions. Results:
- security and related tests: 13/13 passed;
- full project suite: 456/456 passed;
- TypeScript build: passed.
Validation limitations
The MCP data flow was exercised through the real registered tool with the driver call observed at its boundary. The downstream path was independently exercised through the real XCUITest `ScreenRecorder`, real FFmpeg 7.0.2, and a synthetic local MJPEG stream. A physical iOS device was not available; the harness replaced only the device's MJPEG source and retained the production XCUITest command construction and subprocess execution.
AI-assistance disclosure
AI-assisted tooling was used for source review, construction of isolated proofs, and drafting. The reporter reviewed the evidence, performed the local tests, and takes responsibility for the submission.
appium-mcp-ffmpeg-filtergraph-poc.zip https://github.com/user-attachments/files/32218246/appium-mcp-ffmpeg-filtergraph-poc.zip
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.94.2 | -2 d | 1.99.3 no afectada |
1.94.2Arsenal 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-3cp6-m69f-v2cjLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
