CVE-2026-48798 in SSH.NET
Summary
by MITRE • 08/18/2026
SSH.NET is a Secure Shell (SSH) library for .NET. In 2025.1.0 and earlier, ScpClient.Download(string directoryName, DirectoryInfo directoryInfo) trusts file and directory names returned by a remote SCP server and combines them with the requested local directory without containment validation, allowing a malicious, compromised, or man-in-the-middle server to use ../ sequences or absolute paths to create or overwrite files anywhere writable by the client process. This issue is fixed in version 2026.0.0.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 08/18/2026
The vulnerability identified in SSH.NET versions prior to 2026.0.0 represents a critical path traversal and directory traversal flaw within the ScpClient.Download method, specifically affecting how file names received from remote Secure Copy Protocol servers are handled during local file system operations. This library is widely used for implementing secure shell functionality in .NET applications, making it a common component in enterprise automation scripts, deployment pipelines, and data transfer utilities where trust in remote server integrity may be assumed but not strictly enforced at the application layer. The core technical flaw lies in the lack of containment validation when combining file or directory names returned by the SCP server with the target local download path. Instead of sanitizing these inputs to ensure they remain within the intended destination directory, the implementation directly concatenates them, allowing for arbitrary file system writes if an attacker can control the filenames provided by the remote service.
From a technical perspective, this vulnerability exploits the standard behavior of operating systems regarding relative and absolute paths. By supplying path sequences such as ../ or using absolute paths like /etc/passwd on Unix-like systems or C:\Windows\System32\config\SAM on Windows, an attacker can manipulate the final resolved file path to escape the designated download directory. This allows for the creation of new files in arbitrary locations or, more critically, the overwriting of existing critical system files, configuration files, or application binaries that are writable by the user account executing the SSH.NET client process. The severity is heightened because SCP servers may be compromised, acting as a vector for supply chain attacks, or an attacker could perform a man-in-the-middle attack to intercept and modify file names during transit if encryption integrity checks are not rigorously applied at higher layers.
The operational impact of this vulnerability extends beyond simple data corruption. An attacker with the ability to control SCP server responses can achieve arbitrary code execution by overwriting executable files or configuration scripts that are loaded by privileged processes. For instance, replacing a trusted library or script in a directory where the application runs could lead to remote code execution under the context of the user running the SSH client. In automated deployment scenarios, this could result in the injection of malicious payloads into build artifacts or infrastructure-as-code templates stored on disk. Furthermore, the ability to overwrite sensitive configuration files can disrupt service availability by corrupting database connections, API keys, or authentication mechanisms, leading to significant denial-of-service conditions and potential data exfiltration if combined with other vulnerabilities.
This flaw aligns closely with Common Weakness Enumeration (CWE) categories such as CWE-22: Improper Limitation of a Pathname to a Restricted Directory, which describes how software does not properly validate input paths to ensure they remain within an expected directory structure. It also relates to CWE-73: External Control of File Name or Path, where user-controlled data influences the file path used in subsequent operations without adequate sanitization. In terms of the MITRE ATT&CK framework, this vulnerability facilitates techniques associated with Defense Evasion and Persistence, specifically through methods like Component Firmware Modification or Indicator Removal on Host if attackers use it to overwrite logs or security tools. It also supports Initial Access via Supply Chain Compromise when exploited in environments where third-party SCP servers are trusted but not fully audited for integrity.
Mitigation strategies must prioritize immediate version updates as the primary defense vector, with all systems utilizing SSH.NET versions 2025.1.0 and earlier being upgraded to version 2026.0.0 or later, which includes the necessary containment validation logic. For environments where upgrading is not immediately feasible, developers should implement a robust path normalization routine before passing any remote file names to local file system operations. This involves resolving the absolute path of both the intended download directory and the target file name, then verifying that the resolved target path starts with the resolved base directory path. Additionally, implementing strict allow-listing for acceptable characters in filenames can reduce the attack surface by rejecting inputs containing slashes or dots that are not part of a valid filename structure. Network-level controls such as ensuring TLS integrity is maintained and validating server certificates rigorously can also mitigate risks associated with man-in-the-middle attacks that attempt to inject malicious path sequences into SCP responses.