In-app reader
Product asyncssh (all versions through 2.23.0)
Related CVE-2019-6111 (same class in OpenSSH)
Fix AsyncSSH 2.23.1
A malicious SSH server can write arbitrary files on the asyncssh SCP client's filesystem by sending filenames containing ../ traversal sequences. The SCP receive path does not currently sanitize server-provided filenames. By chaining directory traversals via the D (directory) action, an attacker can escape any target directory and overwrite ~/.bashrc, ~/.ssh/rc, or ~/.ssh/authorized_keys, achieving code execution. This is the same vulnerability class as CVE-2019-6111. The mitigation applied in OpenSSH does not appear to have been adopted in asyncssh.
Steps to exploit:
Step 1 - Normal usage: Application calls await asyncssh.scp((conn, 'file'), '/home/user/downloads/'). This is the standard, documented API.
Step 2 - SCP protocol: asyncssh opens an SSH exec channel, runs scp -f file. The server controls the filename field:
C0644 100 ../pwned.txt\n (simple traversal)
D0755 0 ..\n (traverse up, repeat as needed)
C0644 47 .bashrc\n (write payload)
E\n
Step 3 - _parse_cd_args (scp.py:134-142) returns the filename verbatim:
def _parse_cd_args(args: bytes) -> Tuple[int, int, bytes]:
permissions, size, name = args.split(None, 2)
return int(permissions, 8), int(size), name # no sanitization
Discussion
Sign in to join the discussion.
Keep reading
Optional: create a free account to save items, track programs, and sync across web + app. Reading stays free.