CVE-2026-54591: AsyncSSH: SCP Path Traversal to Arbitrary File Write

Published Jul 8, 2026
·
Updated

| | | |---|---| | 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/authorizedkeys, 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 - parsecdargs (scp.py:134-142) returns the filename verbatim:

python def parsecdargs(args: bytes) -> Tuple[int, int, bytes]: permissions, size, name = args.split(None, 2) return int(permissions, 8), int(size), name # no sanitization

The returned name is not passed through basename() and is not checked for .. or / components.

Step 4 - recvfiles (scp.py:706-713) joins the unsanitized name:

python newdstpath = posixpath.join(dstpath, name)

With dstpath=b'/home/user/downloads/subdir' and name=b'../pwned.txt', this resolves to /home/user/downloads/pwned.txt, outside the target.

Step 5 - File write: recvfile opens the traversed path via self.fs.open(dstpath, 'wb') and writes attacker-controlled content. The resolved path is not checked against the target directory boundary.

Step 6 - RCE chains:

| Target | Execution trigger | Reliability | |---|---|---| | ~/.bashrc | Next terminal open | High | | ~/.profile | Next login | High | | ~/.ssh/rc | Next SSH connection (requires sshd) | High | | ~/.ssh/authorizedkeys | Attacker logs in with command= | Medium |

---

Reproduction:

Link to reproduction script: pathtraversalpoc.zip

bash docker build -t asyncssh-scp-traversal -f Dockerfile . docker run --rm asyncssh-scp-traversal

The attached pocscptraversal.py starts a malicious SSH server in-process using asyncssh's own API, then downloads from it via asyncssh.scp().

Expected Output:

<img width="1400" height="815" alt="image" src="https://github.com/user-attachments/assets/496745e4-d11d-4ed8-bddd-d15dd13d1751" />

Other sources

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.23.1, a malicious SSH server can write arbitrary files on the asyncssh SCP client's filesystem by sending filenames containing ../ traversal sequences because parsecdargs in scp.py returns server-provided names verbatim and recvfiles joins them to the destination path without enforcing the target directory boundary. This issue is fixed in version 2.23.1.

MITRE

Affected Software

2 affected componentsFixes available
pypi/asyncssh<=2.23.0
pip/asyncssh<=2.23.0
2.23.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/asyncssh to a version that resolves this vulnerability.

    Fixed in 2.23.1
  2. Upgrade

    Upgrade asyncssh to a version that resolves this vulnerability.

    Fixed in 2.23.1
  3. Compensating control

    Until patched, do not allow connections to untrusted/malicious SSH servers for asyncssh SCP clients (e.g., restrict SCP usage to known hosts and authenticated/verified servers), since a malicious SSH server can send SCP filenames containing ../ path traversal sequences to overwrite files on the client filesystem.

Event History

Jul 8, 2026
CVE Published
via MITRE·08:33 PM
Data Sourced
via MITRE·08:33 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:16 PM
DescriptionSeverityWeakness
Aug 26, 2026
Advisory Published
via GitHub·03:34 PM
Data Sourced
via GitHub·03:34 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-54591?

The severity of CVE-2026-54591 is rated as high with a score of 8.1.

2

How do I fix CVE-2026-54591?

To fix CVE-2026-54591, upgrade AsyncSSH to version 2.23.1 or later.

3

What type of vulnerability is CVE-2026-54591?

CVE-2026-54591 is categorized as a Path Traversal vulnerability.

4

What impact does CVE-2026-54591 have?

CVE-2026-54591 allows a malicious SSH server to write arbitrary files on the asyncssh SCP client's filesystem.

5

Which software is affected by CVE-2026-54591?

CVE-2026-54591 affects the AsyncSSH package available on PyPI.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203