GHSA-w29m-45fc-22v9: AsyncSSH: SFTPServer Chroot Escape
AsyncSSH is a Python package which provides an asynchronous client and server implementation of the SSHv2 protocol on top of the Python asyncio framework. Prior to 2.24.1, SFTPServer.mappath() uses posixpath.normpath() on a client-supplied path and removes only one leading slash before passing the result to posixpath.join() with the configured chroot. An authenticated SFTP user can supply a path beginning with exactly two slash characters, causing POSIX normalization to preserve the double-leading-slash form and the subsequent join to treat the remaining pathname as absolute. This bypasses the SFTP chroot and permits reads and writes with the operating-system permissions of the account running the server, which may enable code execution depending on writable targets. This issue is fixed in version 2.24.1.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
AsyncSSHto a version that resolves this vulnerability.Fixed in 2.24.1
Event History
Frequently Asked Questions
Which deployments should be prioritized for remediation?
AsyncSSH SFTP servers running versions earlier than 2.24.1 with an SFTP chroot configured are affected. The risk is greatest where the operating-system account running the server can access or modify sensitive files.
What does an attacker need to exploit this issue?
An attacker needs to be an authenticated SFTP user. They can provide a path beginning with exactly two slash characters to escape the configured chroot.
What is the recommended fix?
Upgrade AsyncSSH to version 2.24.1, which fixes the path handling issue. Successful exploitation can permit reads and writes with the permissions of the account running the server.