Impact
The SSH_FXP_REALPATH handler in ssh_sftpd passes Canonicalize=false to relate_file_name/3 (ssh_sftpd.erl, line ~328), unlike every other SFTP operation handler which uses the default Canonicalize=true. This allows .. path components to bypass the is_within_root/2 check without resolution. The un-canonicalized path then enters resolve_symlinks/2, which processes .. by walking up the directory tree, making read_link() syscalls on arbitrary filesystem paths outside the configured root.
An authenticated SFTP client can exploit this by sending a REALPATH request with a crafted traversal path (e.g., /<valid_dir>/../../../etc/passwd). The response differs depending on whether the target path exists on the server filesystem:
- Path exists outside root →
SSH_FXP_NAME (success, path resolved, clipped by chroot_filename)
- Path does NOT exist →
SSH_FX_NO_SUCH_FILE (error, resolve_symlinks failed)
This creates a path-existence oracle that allows full filesystem structure enumeration. An authenticated SFTP user can confirm the existence of sensitive files (/etc/shadow, private keys, database files, config files), discover directories and services, map internal network structure via mounted shares, and perform reconnaissance for further attacks.
No file contents, credentials, or write access are obtainable through this issue alone.
Note that Erlang/OTP SFTP server configurations that do not use the root option allow remote file access anywhere on the system with absolute or relative file paths, which is a known property of the SFTP protocol. This cannot be considered a vulnerability in itself.
For a system to be vulnerable, the system designer must have configured the root option under the assumption that it provides complete filesystem path isolation. The oracle may reveal host directory structure, installed software, mount point names, or usernames. On its own this does not enable file access or modification, but it may assist further attacks if combined with other vulnerabilities.
Workarounds
- Use OS-level chroot to run the Erlang VM/SFTP server process in an isolated filesystem environment, eliminating reliance on the application-level root option
- Ensure that the SFTP server port on the machine running the Erlang/OTP SFTP server is not reachable from untrusted machines
- Ensure that no sensitive information (usernames, project names, mount topology) is inferrable from the existence or non-existence of paths on the host filesystem
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Mohamed Ali IBNAL HAJALI at Ericsson for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.
Impact
The
SSH_FXP_REALPATHhandler inssh_sftpdpassesCanonicalize=falsetorelate_file_name/3(ssh_sftpd.erl, line ~328), unlike every other SFTP operation handler which uses the defaultCanonicalize=true. This allows..path components to bypass theis_within_root/2check without resolution. The un-canonicalized path then entersresolve_symlinks/2, which processes..by walking up the directory tree, makingread_link()syscalls on arbitrary filesystem paths outside the configured root.An authenticated SFTP client can exploit this by sending a
REALPATHrequest with a crafted traversal path (e.g.,/<valid_dir>/../../../etc/passwd). The response differs depending on whether the target path exists on the server filesystem:SSH_FXP_NAME(success, path resolved, clipped by chroot_filename)SSH_FX_NO_SUCH_FILE(error, resolve_symlinks failed)This creates a path-existence oracle that allows full filesystem structure enumeration. An authenticated SFTP user can confirm the existence of sensitive files (
/etc/shadow, private keys, database files, config files), discover directories and services, map internal network structure via mounted shares, and perform reconnaissance for further attacks.No file contents, credentials, or write access are obtainable through this issue alone.
Note that Erlang/OTP SFTP server configurations that do not use the root option allow remote file access anywhere on the system with absolute or relative file paths, which is a known property of the SFTP protocol. This cannot be considered a vulnerability in itself.
For a system to be vulnerable, the system designer must have configured the root option under the assumption that it provides complete filesystem path isolation. The oracle may reveal host directory structure, installed software, mount point names, or usernames. On its own this does not enable file access or modification, but it may assist further attacks if combined with other vulnerabilities.
Workarounds
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Mohamed Ali IBNAL HAJALI at Ericsson for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.