Summary
The Mobile Next @mobilenext/mobile-mcp server contained a path traversal vulnerability in the mobile_save_screenshot and mobile_start_screen_recording tools, where user-controlled paths were passed directly to filesystem write operations.
An attacker who can invoke these tools and control the saveTo or output parameters may be able to create or overwrite files outside the intended workspace, potentially impacting system integrity and confidentiality.
Affected context
This vulnerability affects environments using the Mobile Next MCP server where the mobile_save_screenshot or mobile_start_screen_recording tools are exposed to user or client input.
It is most relevant when:
- The MCP server trusts client-supplied parameters for file destinations
- The server process has write permissions to directories outside the designated workspace
- There are no additional layers restricting filesystem access (e.g., strict container sandboxes or chrooted environments)
Under these conditions, crafted path values can redirect screenshot or recording output into unintended locations on the server's filesystem.
Exploit preconditions
- Attack surface: The Mobile Next MCP server API or any integration that exposes
mobile_save_screenshotandmobile_start_screen_recording. - Required access: Ability to authenticate to or otherwise invoke the affected tools and control the
saveTooroutputparameters. - Trigger point: Supplying a crafted filesystem path (e.g., using relative traversal or absolute paths) when requesting a screenshot or starting a screen recording.
- Why exploitation is possible: The server passed the
saveToandoutputparameters directly to filesystem write operations without normalizing, constraining, or validating the paths against an allowed workspace root, enabling path traversal and arbitrary file write.
Why this happens
The underlying issue is improper restriction of user-supplied file paths, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and related to CWE-73: External Control of File Name or Path.
Instead of resolving and validating the target path against a fixed workspace directory, the implementation treated the saveTo and output parameters as trusted, forwarding them directly into file create/write operations.
This pattern allows attackers to escape the intended directory by using relative components or absolute paths, causing writes to arbitrary locations that the server process can access.
Potential impact
- Creation or overwriting of files outside the intended workspace directory
- Tampering with application configuration files that are writable by the server process
- Placement of malicious files or scripts in locations later interpreted or executed by other components
- Disruption of service by corrupting logs, state files, or other operational data
- Possible assistance in privilege escalation or lateral movement when combined with other vulnerabilities or misconfigurations
General mitigation guidance
Effective mitigation focuses on constraining and validating filesystem paths before any write operation:
- Normalize and resolve all user-supplied paths against a defined workspace root, rejecting any that escape this directory.
- Use allowlists of directories or file name patterns for where screenshots and recordings can be stored.
- Prefer constructing destination paths server-side from trusted base directories, using only sanitized file name fragments from user input.
- Run the MCP server under a dedicated, least-privileged account with minimal filesystem write rights.
- Consider using OS- or container-level sandboxing (e.g., chroot, containers, or restrictive volume mounts) to limit the blast radius of any filesystem misuse.
How teams detect issues like this
Organizations can detect and monitor for this vulnerability and similar patterns by:
- Applying static analysis rules that flag direct use of user-controlled path parameters in file APIs (e.g.,
fs.writeFile,fs.createWriteStream) without normalization or validation. - Reviewing code for patterns where request or tool parameters map directly to filesystem paths, especially in utility tools like screenshot or logging endpoints.
- Implementing security-focused code review checklists that include path traversal and externalized file path usage as mandatory review items.
- Monitoring runtime logs for unusual file write locations, especially outside expected workspace directories or containing traversal sequences, and raising alerts on suspicious path patterns.

