Aug 21, 2026·6 min read·159 visits
OpenSSH sftp clients prior to 10.4 are vulnerable to relative path traversal, allowing a compromised SFTP server to write arbitrary files on the client system during command-line downloads.
A relative path traversal vulnerability (CWE-23) in the client-side sftp utility of OpenSSH before version 10.4 allows malicious or compromised SFTP servers to write or overwrite files outside the intended destination directory when a user executes a direct one-shot download command.
The client-side sftp(1) tool provided by OpenSSH is widely utilized for secure file transfers over SSH. In configurations where a user invokes a direct, one-shot download command utilizing the specific syntax sftp server:/path ., the sftp client establishes a connection to the specified remote server, retrieves target files, and writes them locally. This operation creates an implicit trust relationship regarding the filenames returned by the remote entity.
Historically, the client application failed to adequately validate and sanitize file paths returned by remote endpoints. If an attacker controls or compromises the target SFTP server, they can manipulate the SFTP protocol responses to dictate exactly where the files are written on the local client host. This vulnerability belongs to the Relative Path Traversal class (CWE-23).
The vulnerability is constrained primarily by the privileges of the local user running the sftp command. Because the issue occurs within the client-side filename parser, standard server-side configurations do not mitigate the flaw. Users utilizing interactive SFTP sessions or automated scripts targeting unvetted remote hosts are particularly exposed.
During a typical SFTP session, name resolution and directory listings are handled via protocol-specific packets. When the client executes a one-shot transfer command, it sends a request for the remote file path. The server processes this request and responds with file attributes and filenames using SSH2_FXP_NAME packets. These packets contain the metadata that the client uses to write files to the local disk.
The critical bug resides in how the sftp(1) client processes the filenames extracted from these packets. The client constructs the target write path by appending the remote-provided filename to the user-supplied local target directory, which is typically the current working directory (.). Before the release of OpenSSH 10.4, the client failed to sanitize relative directory traversal components (such as ../) present within the filenames returned by the server.
Consequently, the local destination path is calculated using simple string concatenation without canonicalization checks. If the server returns a filename structured as ../../.ssh/authorized_keys, the client resolves the local path to ./../../.ssh/authorized_keys. This calculation forces the file creation routine to traverse outside of the intended target directory and write to arbitrary locations within the boundaries of the executing user's filesystem permissions.
A review of the vulnerable path-generation logic indicates that the sftp client handled remote filename parsing directly within the remote file download loops. Below is a structural representation of the vulnerable filename handling logic compared to the hardened validation implemented in version 10.4.
// Vulnerable logic pattern in sftp-client.c before OpenSSH 10.4
char *local_path;
char *remote_filename = get_filename_from_packet(payload);
// Naive concatenation of the local destination and the remote filename
local_path = path_append(destination_directory, remote_filename);
// Opens the file path directly, traversing parent directories if present in remote_filename
int file_descriptor = open(local_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);To correct this security flaw, OpenSSH 10.4 introduced a path sanitization routine. This routine strips relative path sequences and prevents the local sftp client from executing path operations outside the designated root directory of the download request. If directory traversal sequences are identified, the operation is rejected before file descriptors are opened.
// Hardened validation pattern in sftp-client.c in OpenSSH 10.4
char *local_path;
char *remote_filename = get_filename_from_packet(payload);
// New verification step to prevent path traversal
if (has_directory_traversal(remote_filename)) {
fatal("Security violation: remote server returned invalid filename '%s'", remote_filename);
cleanup_and_exit(1);
}
// Safely concatenate after validation passes
local_path = path_append(destination_directory, remote_filename);The fix is robust because it prevents the path resolution mechanism from executing if any path component attempts to go up the directory tree relative to the target location. This completely eliminates the threat vectors utilizing relative directory sequences via SFTP client downloads.
Exploiting CVE-2026-59995 requires a specific sequence of actions and conditions. First, the attacker must configure or compromise an SFTP server to serve modified file metadata. Standard SFTP daemons will not perform path traversal attacks of this nature; therefore, a custom or patched daemon is necessary to inject traversal payloads inside the SSH2_FXP_NAME protocol packets.
Next, the attacker must entice a target user into initiating a file transfer utilizing the one-shot syntax. This is typically achieved via social engineering, phishing, or modified documentation guides directing the victim to run a command such as:
sftp attacker-controlled-server:/files/manual.pdf .
When the victim executes this command, the rogue server responds with the file payload but specifies the filename as ../../.bashrc or ../../.ssh/authorized_keys. The vulnerable sftp client translates this path relative to the active target directory (.), executing the write outside the expected parameters. If the command is executed within a user's home directory, files such as shell profile configurations can be overwritten, leading to persistent code execution upon subsequent shell interactive logins.
The National Vulnerability Database evaluates this vulnerability with a CVSS 3.1 base score of 4.2 (Medium). This severity rating represents the combination of a remote attack vector with a high attack complexity and mandatory user interaction. The scope of the vulnerability is unchanged because the impact does not cross to separate virtualized security boundaries beyond the local system execution layer.
The integrity impact is assessed as low because file creation and manipulation are strictly bounded by the filesystem permissions of the local user running the sftp command. An attacker cannot overwrite root-level configuration files (such as /etc/passwd or /etc/shadow) unless the victim executes the vulnerable client session with superuser privileges.
However, in typical developer and administrator environments, local user privileges are sufficient to achieve persistence. Overwriting user-level startup scripts (.profile, .bashrc) or appending keys to .ssh/authorized_keys allows complete user-level compromise. The EPSS score currently sits at 0.0025, which reflects a low current threat profile in the wild, and the vulnerability is not currently tracked on the CISA KEV list.
The primary remediation strategy is upgrading the client-side OpenSSH suite to version 10.4 or higher. Operating system packages should be updated using local package distribution managers to ensure the binary is patched.
For systems where immediate upgrades are not possible, several configuration-based and operational workarounds can minimize the exposure surface. Users must refrain from utilizing the command-line format that maps remote files directly to the current directory (sftp server:file .). Instead, interactive sftp shell sessions should be used, where the target location is verified or controlled through specific interactive subcommands.
Additionally, automate SFTP workflows inside isolated directories that do not contain sensitive system configuration files. Restricting outbound SSH/SFTP access at the host firewall layer can ensure that client systems only initiate transfer sessions with trusted corporate servers, effectively blocking attempts to connect with untrusted, malicious remote infrastructure.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
OpenSSH sftp OpenBSD | < 10.4 | 10.4 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-23 |
| Attack Vector | Network |
| CVSS Score | 4.2 (Medium) |
| EPSS Score | 0.0025 (16.73%) |
| Impact | Low Integrity, Low Availability |
| Exploit Status | None |
| KEV Status | Not Listed |
The software uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize relative path sequences such as '../' that can resolve to a location outside of the directory.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.
CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.
Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.