Arbitrary Argument Injection Affecting asyncssh package, versions [2.7.0,2.24.2)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.83% (59th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-ASYNCSSH-23050749
  • published30 Nov 2026
  • disclosed29 Nov 2026
  • creditChris Purcell, Liam Dowd

Introduced: 29 Nov 2026

NewCVE-2026-138374  (opens in a new tab)
CWE-88  (opens in a new tab)

How to fix?

Upgrade asyncssh to version 2.24.2 or higher.

Overview

Affected versions of this package are vulnerable to Arbitrary Argument Injection via ProxyCommand token substitution in asyncssh/config.py. When an OpenSSH client config file sets a ProxyCommand using the %h, %n, or %r tokens, host and user names passed to connect() are substituted into the command string before it is split into arguments. An attacker who controls the host or user name can embed whitespace or quote characters to inject additional arguments into the proxy program. Additionally, in the affected range, ${...} environment variable references inside a substituted name are expanded, allowing the value of local environment variables to be placed into the proxy command's arguments. With the common ProxyCommand ssh -W %h:%p bastion pattern, an injected -o option can cause the local ssh client to execute attacker-chosen commands as the application user.

Workaround

Validate host and user names from untrusted sources before passing them to AsyncSSH, rejecting whitespace, quotes, $, and a leading -. Alternatively, avoid %h, %n, and %r in ProxyCommand entries that can match such names, or pass an explicit config argument that does not include them.

PoC

Config of the account that runs the application:

    Host *.corp.test
        ProxyCommand prog --target %h --port %p --login %r

Call:

    await asyncssh.connect('x --injected-option=1 y.corp.test', username='deploy')

Arguments received by `prog`:

    --target x --injected-option=1 y.corp.test --port 22 --login deploy

A user name containing a space does the same through `%r`, and a host name such as `x${SECRET}.corp.test` passes the value of the `SECRET` environment variable to `prog`.

CVSS Base Scores

version 4.0
version 3.1