VAITP Dataset

← Back to the dataset

CVE-2026-77473

AsyncSSH before 2.24.1 allows SFTP path traversal via crafted remote filenames.

  • CVSS 6.5
  • CWE-22
  • Input Validation and Sanitization
  • Remote

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, recursive remote-to-local SFTP copies in SFTPClient._copy() in asyncssh/sftp.py, reached through get(), mget(), and copy(), trust filenames returned by a remote server's directory enumeration. A malicious or compromised SFTP server can return an absolute filename or a filename containing path separators and parent-directory traversal, causing destination path construction to escape the requested local directory and write attacker-selected content to locations writable by the client process. This issue is fixed in version 2.24.1.

CVSS base score
6.5
Published
2026-11-09
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Privilege Escalation
Affected component
asyncssh
Fixed by upgrading
Yes

Solution

Upgrade AsyncSSH to version 2.24.1 or later.

Vulnerable code sample

import os
import asyncssh

def copy_remote_to_local(sftp: asyncssh.SFTPClient, remote_dir: str, local_dir: str):
    """
    Recursively copy everything from remote_dir to local_dir.
    """
    for entry in sftp.listdir(remote_dir):
        remote_path = f"{remote_dir}/{entry.filename}"
        # VULNERABLE: trusts remote filename, allowing absolute paths or traversal
        local_path = os.path.join(local_dir, entry.filename)
        if entry.longname.startswith('d'):  # directory
            os.makedirs(local_path, exist_ok=True)
            copy_remote_to_local(sftp, remote_path, local_path)
        else:
            with sftp.open(remote_path, 'rb') as rfd, open(local_path, 'wb') as wfd:
                wfd.write(rfd.read())

Patched code sample

import os
import asyncssh

def copy_remote_to_local(sftp: asyncssh.SFTPClient, remote_dir: str, local_dir: str):
    """
    Recursively copy everything from remote_dir to local_dir.
    """
    for entry in sftp.listdir(remote_dir):
        remote_path = f"{remote_dir}/{entry.filename}"
        # FIX: sanitize filename to prevent path traversal
        safe_name = os.path.basename(entry.filename)
        local_path = os.path.join(local_dir, safe_name)
        if entry.longname.startswith('d'):  # directory
            os.makedirs(local_path, exist_ok=True)
            copy_remote_to_local(sftp, remote_path, local_path)
        else:
            with sftp.open(remote_path, 'rb') as rfd, open(local_path, 'wb') as wfd:
                wfd.write(rfd.read())

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve202677473,
  title        = {{AsyncSSH before 2.24.1 allows SFTP path traversal via crafted remote filenames.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-77473},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-77473/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.