CVE-2026-54591: Asyncssh Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-2wxc-x7rj-hg8f
CVSS 8.1
CWE-22
Published
Advisory Summary

CVE-2026-54591 is a HIGH (CVSS 8.1) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Asyncssh libraries in the PyPI ecosystem. The issue involves asyncssh has scp path traversal to arbitrary file write. Remediation is available by upgrading affected packages to version 2.23.1.

CVE-2026-54591 at a Glance

CVE Identifier CVE-2026-54591
GHSA Identifier GHSA-2wxc-x7rj-hg8f
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Asyncssh
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-54591

To remediate this vulnerability, upgrade all affected Asyncssh dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

asyncssh fixed: 2.23.1
pip install asyncssh>=2.23.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show asyncssh

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-54591, inspect your installed packages using pip:

pip show asyncssh

Analyze the terminal output to locate any version of Asyncssh in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.23.1), your application is affected.

Note: The pip show asyncssh command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Asyncssh, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

| | | |---|---| | 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: ```python 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 ``` The returned `name` is not passed through `basename()` and is not checked for `..` or `/` components. **Step 4 - `_recv_files`** (`scp.py:706-713`) joins the unsanitized name: ```python new_dstpath = 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:** `_recv_file` 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/authorized_keys` | Attacker logs in with `command=` | Medium | --- **Reproduction:** Link to reproduction script: [path_traversal_poc.zip](https://github.com/user-attachments/files/28160665/path_traversal_poc.zip) ```bash docker build -t asyncssh-scp-traversal -f Dockerfile . docker run --rm asyncssh-scp-traversal ``` The attached `poc_scp_traversal.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" />

CVE-2026-54591 Affected Asyncssh Versions

1 component(s)
Fixed Versions:
2.23.1
Product / Package Ecosystem Affected Versions Fixed Version
asyncssh
PyPI
< 2.23.1
2.23.1

References

Frequently Asked Questions

What is CVE-2026-54591?
CVE-2026-54591 is a security vulnerability in Asyncssh involving asyncssh has SCP Path Traversal to Arbitrary File Write under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Asyncssh versions are affected?
Affected versions include releases prior to 2.23.1 across affected packages: asyncssh.
What version fixes CVE-2026-54591?
Upgrading to 2.23.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is asyncssh affected?
Yes, asyncssh is affected in releases prior to 2.23.1. Upgrade your dependency to 2.23.1 or later.
What is the CVSS score of CVE-2026-54591?
CVE-2026-54591 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2026-54591?
CVE-2026-54591 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2026-54591?
Run the dependency tree command: 'pip show asyncssh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2wxc-x7rj-hg8f",
  "modified" : "2026-08-26T15:34:22Z",
  "published" : "2026-08-26T15:34:22Z",
  "aliases" : [ "CVE-2026-54591" ],
  "summary" : "asyncssh has SCP Path Traversal to Arbitrary File Write",
  "details" : "| | |\n|---|---|\n| Product | asyncssh (all versions through 2.23.0) |\n| Related | CVE-2019-6111 (same class in OpenSSH) |\n| Fix | AsyncSSH 2.23.1 |\n\nA 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.\n\n---\n\n**Steps to exploit:**\n\n**Step 1 - Normal usage:** Application calls `await asyncssh.scp((conn, 'file'), '/home/user/downloads/')`. This is the standard, documented API.\n\n**Step 2 - SCP protocol:** asyncssh opens an SSH exec channel, runs `scp -f file`. The server controls the filename field:\n\n```\nC0644 100 ../pwned.txt\\n       (simple traversal)\n\nD0755 0 ..\\n                   (traverse up, repeat as needed)\nC0644 47 .bashrc\\n             (write payload)\nE\\n\n```\n\n**Step 3 - `_parse_cd_args`** (`scp.py:134-142`) returns the filename verbatim:\n\n```python\ndef _parse_cd_args(args: bytes) -> Tuple[int, int, bytes]:\n    permissions, size, name = args.split(None, 2)\n    return int(permissions, 8), int(size), name  # no sanitization\n```\n\nThe returned `name` is not passed through `basename()` and is not checked for `..` or `/` components.\n\n**Step 4 - `_recv_files`** (`scp.py:706-713`) joins the unsanitized name:\n\n```python\nnew_dstpath = posixpath.join(dstpath, name)\n```\n\nWith `dstpath=b'/home/user/downloads/subdir'` and `name=b'../pwned.txt'`, this resolves to `/home/user/downloads/pwned.txt`, outside the target.\n\n**Step 5 - File write:** `_recv_file` 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.\n\n**Step 6 - RCE chains:**\n\n| Target | Execution trigger | Reliability |\n|---|---|---|\n| `~/.bashrc` | Next terminal open | High |\n| `~/.profile` | Next login | High |\n| `~/.ssh/rc` | Next SSH connection (requires sshd) | High |\n| `~/.ssh/authorized_keys` | Attacker logs in with `command=` | Medium |\n\n---\n\n**Reproduction:**\n\nLink to reproduction script: [path_traversal_poc.zip](https://github.com/user-attachments/files/28160665/path_traversal_poc.zip)\n\n```bash\ndocker build -t asyncssh-scp-traversal -f Dockerfile .\ndocker run --rm asyncssh-scp-traversal\n```\n\nThe attached `poc_scp_traversal.py` starts a malicious SSH server in-process using asyncssh's own API, then downloads from it via `asyncssh.scp()`.\n\n*Expected Output:*\n\n<img width=\"1400\" height=\"815\" alt=\"image\" src=\"https://github.com/user-attachments/assets/496745e4-d11d-4ed8-bddd-d15dd13d1751\" />",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "asyncssh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.23.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.23.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ronf/asyncssh/security/advisories/GHSA-2wxc-x7rj-hg8f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-54591"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ronf/asyncssh/commit/d730803b8e4e94c20c7580d90f94d1e05f9f58de"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ronf/asyncssh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ronf/asyncssh/releases/tag/v2.23.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-26T15:34:22Z",
    "nvd_published_at" : "2026-07-08T21:16:49Z"
  }
}