CVE-2026-138374 in AsyncSSH
Summary
by MITRE • 11/29/2026
AsyncSSH 2.7.0 before 2.24.2 contains an argument injection vulnerability that allows attackers supplying host or user names to add arguments to the local proxy program by embedding whitespace or quote characters substituted into %h, %n or %r ProxyCommand tokens before splitting. Attackers can inject an -o option into the common ssh -W %h:%p bastion ProxyCommand to make the local ssh client run attacker-chosen commands as the application user.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/29/2026
The vulnerability identified in AsyncSSH versions prior to 2.24.2 represents a critical argument injection flaw within the SSH proxy command handling mechanism. This security issue stems from improper validation and sanitization of input data when processing host names, user names, or related identifiers that are substituted into ProxyCommand tokens such as %h for hostname, %n for local username, and %r for remote username. The core technical failure occurs during the string substitution phase where these variables are replaced with attacker-controlled values before the command line is split into executable arguments. Because the splitting logic does not adequately account for special characters like whitespace or quotes embedded within the substituted strings, it fails to isolate them as part of a single argument. Instead, these characters act as delimiters that break the intended command structure, allowing an adversary to inject additional flags and arguments directly into the execution context of the local proxy program.
This flaw specifically impacts configurations utilizing the ssh -W %h:%p bastion ProxyCommand pattern, which is commonly deployed in jump host or bastion server architectures to facilitate secure tunneling through intermediate systems. In such setups, the local SSH client relies on a secondary SSH process to establish connectivity to the target host via the bastion. When an attacker controls any part of the input that gets substituted into these ProxyCommand tokens—such as by tricking a user or automated system into connecting to a maliciously crafted hostname—the injected whitespace and quotes allow for command injection. By inserting an -o option, which is used in SSH to specify configuration options, the attacker can effectively override default behaviors or introduce new parameters that result in arbitrary code execution on the local machine under the privileges of the application user running the client software.
The operational impact of this vulnerability is severe, as it enables remote attackers to achieve arbitrary command execution without authentication if they can influence the connection target's hostname or associated metadata used in proxy commands. This capability bypasses standard access controls because the injection occurs at the level of the local SSH client process itself rather than through network-based exploitation of a server service. The attacker does not need credentials for the bastion host to exploit this; instead, they only need to control the input that gets substituted into the ProxyCommand template. This could lead to full system compromise if the application user has sufficient privileges or access to sensitive resources on the local machine. Furthermore, since SSH clients are often used in automated scripts and CI/CD pipelines, the risk of exploitation is amplified as these environments may execute commands with elevated permissions without interactive oversight.
From a classification perspective, this vulnerability aligns with CWE-78 Improper Neutralization of Special Elements used in an OS Command, commonly known as OS Command Injection. The root cause lies in the failure to properly sanitize or escape special characters before command construction and execution. In terms of attack tactics, this exploitation technique corresponds to ATT&CK T1059 Command and Scripting Interpreter, specifically leveraging shell commands for lateral movement or initial access depending on the context. It also touches upon CWE-20 Improper Input Validation, as the input data was not adequately validated against expected formats before being processed into a command string.
Mitigation strategies must prioritize immediate software updates to AsyncSSH version 2.24.2 or later, where this argument injection flaw has been addressed through improved handling of special characters in ProxyCommand substitutions. Organizations should audit their SSH configurations for the use of dynamic variables within proxy commands and consider restricting these patterns if possible. Additionally, implementing strict input validation on any user-supplied data that might be used as hostnames or identifiers in automated systems can reduce the attack surface. Security teams should also monitor for unusual process executions originating from SSH client processes, particularly those involving unexpected command line arguments, to detect potential exploitation attempts in real-time.