HIGH 8.1

CVE-2026-54591: AsyncSSH Path Traversal Arbitrary File Write Vulnerability

AsyncSSH, a Python library that enables secure shell connections, contains a flaw that allows a malicious SSH server to write files anywhere on a user's computer. When an AsyncSSH client connects to a compromised or hostile server, that server can trick the client into saving files outside the intended download directory by embedding path-traversal sequences (like '../') in filenames. This happens because the library doesn't properly validate where files are being written. The vulnerability affects all versions before 2.23.1 and requires user interaction—the user must initiate an SCP (secure copy) operation against an untrusted server.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H
Weaknesses (CWE)
CWE-22
Affected products
0 configuration(s)
Published / Modified
2026-07-08 / 2026-07-10

NVD description (verbatim)

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 _parse_cd_args in scp.py returns server-provided names verbatim and _recv_files joins them to the destination path without enforcing the target directory boundary. This issue is fixed in version 2.23.1.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from improper path validation in AsyncSSH's SCP implementation. The _parse_cd_args function in scp.py accepts server-provided directory change commands and returns filenames verbatim without sanitization. When these names are subsequently joined to the destination path via _recv_files, no enforcement of directory boundaries occurs. An attacker controlling the SSH server can embed ../ sequences in filenames to traverse up the directory tree, enabling arbitrary file writes on the client filesystem. The flaw is a classic path-traversal issue (CWE-22) that bypasses intended access controls on file placement.

Business impact

Organizations using AsyncSSH for automated file transfers or secure copy operations face risk of data corruption, system compromise, or malware injection. An attacker could overwrite critical application files, configuration files, or system libraries, leading to denial of service, privilege escalation, or lateral movement. The business impact depends on the privileges of the user running the AsyncSSH client and the sensitivity of files in accessible directories. Any automation pipeline relying on AsyncSSH for untrusted or internet-facing server connections becomes an attack surface.

Affected systems

AsyncSSH versions prior to 2.23.1 are affected. The vulnerability specifically impacts SCP client functionality when connecting to SSH servers. Any Python application embedding AsyncSSH—whether for automated backups, file synchronization, or secure transfers—is potentially vulnerable if it receives connections from or connects to servers not fully under the organization's control. Systems where non-administrative users run AsyncSSH clients are somewhat less critical but still at risk.

Exploitability

Exploitation requires that a user initiate an SCP download from a malicious or compromised SSH server. The attacker must control or compromise the SSH server endpoint to inject traversal sequences into filenames. No network-level authentication bypass or complex technical steps are needed beyond hosting a hostile SSH server. However, user interaction is necessary—the client must deliberately connect and request a file transfer. The attack is straightforward to execute for any actor capable of running an SSH server, making it moderately exploitable in scenarios where users connect to untrusted servers or where server compromise occurs.

Remediation

Upgrade AsyncSSH to version 2.23.1 or later immediately. This version includes proper path-validation logic to ensure filenames cannot escape the intended destination directory. After patching, no additional configuration changes are required. Organizations should verify that all instances of AsyncSSH in use—including those embedded in custom applications or containerized services—are updated. If immediate patching is not possible, restrict SCP client usage to known, trusted SSH servers and avoid accepting file transfers from any server not fully under your control.

Patch guidance

Update the AsyncSSH package to version 2.23.1 or later via your package manager (pip install --upgrade asyncssh or equivalent). Verify the update by confirming the installed version matches or exceeds 2.23.1. If AsyncSSH is vendored or embedded in a larger application, check the application's release notes to confirm it includes the patched AsyncSSH version. Test functionality in a non-production environment before deploying widely. For organizations using multiple Python environments or virtual environments, ensure each is updated separately.

Detection guidance

Monitor for attempts to download files with ../ or similar traversal sequences in SSH/SCP logs if available. Examine file creation events for unexpected files appearing in system or application directories during SCP operations. Set up alerting on file integrity changes in critical directories. Review SSH server logs for unusual directory traversal patterns in file names during SCP sessions. Endpoint detection and response (EDR) tools should flag unexpected file writes outside expected directories by Python processes linked to AsyncSSH. Historical detection is possible by reviewing file creation timestamps and paths to identify if files were written outside intended download locations.

Why prioritize this

This vulnerability merits high priority because it enables arbitrary file writes on client systems via a commonly-used library, requires only moderate attacker capability (hosting an SSH server), and has a high CVSS score of 8.1. While user interaction is required, the attack surface is real for organizations performing automated transfers, CI/CD pipelines, or user-initiated downloads from semi-trusted sources. The integrity impact is severe—an attacker can corrupt or inject malicious files—and availability impact is possible through system file corruption. Prompt patching limits exposure window.

Risk score, explained

The CVSS 3.1 score of 8.1 (HIGH) reflects high integrity and availability impact (I:H, A:H), network-adjacent attack vector (AV:N), low attack complexity (AC:L), and no privilege requirements (PR:N). The user interaction requirement (UI:R) prevents a perfect score but remains significant. The scoring appropriately captures that while an attacker cannot silently exploit this from the network alone, a user performing a legitimate file transfer to a compromised or hostile server becomes a vector for system compromise. The unchanged scope (S:U) indicates the impact is confined to the affected system.

Frequently asked questions

Do I need to be connected to the internet for this vulnerability to affect me?

No, but an attacker must be able to reach you as an SSH server or you must connect to an attacker-controlled SSH server. If you only use AsyncSSH to connect to known, trusted internal servers you control, your risk is lower. However, if your code or applications connect to any server on the internet or accept SSH connections from untrusted networks, you are at risk.

If I'm only using AsyncSSH for SSH connections and not SCP, am I affected?

The vulnerability is specific to SCP (secure copy) client functionality. Standard SSH terminal sessions or SFTP operations are not affected. However, if your application uses AsyncSSH's SCP client for any file transfers, you are vulnerable until you patch to 2.23.1 or later.

What should I do if I cannot immediately patch to version 2.23.1?

Until you patch, restrict AsyncSSH SCP client usage to SSH servers you fully control and trust. Avoid initiating SCP transfers from or to untrusted or internet-accessible servers. Implement network-level controls (firewalls, VPNs) to limit which SSH servers your applications can reach. Monitor file system activity for unexpected file creation in sensitive directories during SCP operations. Plan your patching immediately as a high priority.

Does this vulnerability affect AsyncSSH when used as an SSH server (not a client)?

The vulnerability specifically affects the AsyncSSH SCP client receiving files from a server. If you are running AsyncSSH only as a server to accept connections from clients, you are not directly vulnerable. However, best practice is to patch all versions to stay current with security improvements.

This analysis is provided for informational purposes to support security decision-making. While based on CVE-2026-54591 source data, specific implementation details, environment configurations, and third-party dependencies may affect actual risk in your infrastructure. Always verify patch availability against official vendor advisories before deployment. Security teams should conduct their own risk assessment based on their specific use of AsyncSSH and network environment. No guarantee is made regarding completeness or applicability to all deployment scenarios. Consult official AsyncSSH documentation and release notes for authoritative guidance. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).