Summary
A path traversal vulnerability in the host-side SFTP server (sshfs_server) used by Canonical Multipass allows a malicious guest to bypass mount restrictions by abusing unsafe path validation logic.
When a local attacker with root privileges inside a guest VM injects crafted SFTP requests, they can trick the host root process into opening files outside the intended mount directory, enabling read access to arbitrary host files and a practical VM escape.
Affected context
This issue appears in environments running Canonical Multipass versions prior to 1.16.3 that use the sshfs-based file sharing mechanism between host and guest.
The vulnerable component is the host-side sshfs_server process, which runs with root privileges and exposes the host filesystem to guest instances through a constrained mount path.
The vulnerability is present when:
- The guest has an sshfs/SFTP-backed mount into the host.
- The host-side server relies on string prefix checks to enforce mount boundaries.
- Linux procfs access allows interaction with the sshfs_server stdin/stdout pipes from within the guest.
Exploit preconditions
- Attack surface: Host-side sshfs_server process handling SFTP frames for guest mounts.
- Required access: Root (or equivalent) privileges inside a guest VM, with the ability to access
/procentries corresponding to the sshfs_server process. - Trigger point: Injection of crafted SFTP requests (e.g., SSH_FXP_OPEN) directly into sshfs_server's stdin/stdout pipes, bypassing the usual FUSE layer and client-side path sanitation.
- Why exploitation is possible: The validate_path function implements containment checks using a simple string prefix comparison without:
- Verifying path separator boundaries, and
- Canonicalizing or normalizing dot-dot (
..) segments.
As a result, traversal sequences that superficially match the configured mount prefix can still resolve outside the intended directory when the host kernel performs real path resolution.
Why this happens
The core defect is an incorrect implementation of path containment checks in the sshfs_server validate_path function.
Instead of converting user-supplied paths to a canonical, normalized form and then confirming they reside under the intended mount root, the code performs a plain string prefix comparison against the configured base path.
Without validating path separators or resolving . and .. components, an attacker can craft a path that appears to match the allowed prefix as a raw string but escapes the directory when interpreted by the filesystem.
This pattern maps directly to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where untrusted path input is inadequately constrained, leading to unintended file system access.
Potential impact
- Guest-side attackers may read arbitrary files on the host filesystem that are accessible to the root user running sshfs_server.
- Sensitive host data (configuration files, credentials, SSH keys, tokens, logs) could be disclosed to a compromised guest.
- Isolation guarantees between the guest VM and the host may be violated, effectively enabling a guest-to-host escape channel.
- Host security monitoring data or hypervisor-related configuration may be exposed, potentially facilitating further post-compromise activity.
General mitigation guidance
Defensive strategies should focus on robust path handling, strict containment, and minimizing host-side privileges for file sharing components.
Pattern-based mitigations include:
- Canonical path normalization: Resolve incoming SFTP paths to their absolute, canonical form (e.g., via realpath-like logic) before any authorization check, and reject requests where normalization fails or introduces symlinks outside the allowed scope.
- Directory boundary enforcement: Implement containment checks based on filesystem semantics rather than raw string comparisons, ensuring that the resolved path remains a descendant of the configured mount directory.
- Strict handling of traversal patterns: Reject or sanitize requests containing
.., ambiguous separators, or mixed slashes, especially when crossing mount boundaries or chroot-like environments. - Least-privilege execution: Avoid running host-side file servers as root where possible; use dedicated service accounts, drop privileges after binding, and apply filesystem-level constraints (e.g., chroot, namespaces, or bind mounts) to enforce isolation.
- Hardened guest-host interfaces: Limit direct guest access to host process pipes and sensitive
/procentries, and constrain the channels through which guests can interact with host-side helper processes.
How teams detect issues like this
Effective detection typically combines code-centric analysis with runtime validation:
- Static analysis: Search for path validation logic that:
- Uses naive string prefix checks (e.g., starts_with) for containment.
- Operates on user-controlled paths without explicit normalization or canonicalization.
- Fails to handle
..,.and symbolic links before enforcing access control. - Code review cues: During manual review, pay attention to components:
- Bridging host and guest filesystems.
- Running with elevated privileges while processing paths from less-trusted contexts.
- Implementing custom path validation instead of relying on mature library primitives.
- Policy and linting rules: Add repository-wide rules that flag:
- Direct string operations for directory enforcement.
- Custom validate_path-style utilities that do not call canonicalization helpers.
- Runtime and integration tests: Create tests that attempt SFTP or file operations with paths containing traversal sequences and verify that such requests are rejected and logged.
Automated SAST tools and security-oriented linters can be configured to highlight unsafe path handling patterns early in development.

