Improper Authentication Affecting asyncssh package, versions [1.13.1,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.77% (57th 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 Learn

Learn about Improper Authentication vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-ASYNCSSH-23050750
  • published30 Nov 2026
  • disclosed29 Nov 2026
  • creditChris Purcell

Introduced: 29 Nov 2026

NewCVE-2026-138376  (opens in a new tab)
CWE-287  (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 Improper Authentication in SSHConnection._match_known_hosts via two distinct flaws in how host-based authentication trust is scoped per connection. In the first flaw, trusted host keys accumulated across host-based authentication attempts rather than being replaced for each attempt, so with trust_client_host enabled an attacker holding the private host key of one known client host can make an initial attempt naming that host and then a second attempt naming a different known client host, passing the host key check while claiming the other host's identity. In the second flaw, X.509 certificates matched in known_client_hosts were appended to the server's global trusted certificate list, causing them to be accepted as trust anchors for X.509 user certificate validation for the remainder of the connection, even after a failed host-based attempt.

Note: Problem 1 requires trust_client_host to be enabled and a custom validate_host_based_user() that uses client_host in its access decision. Problem 2 requires X.509 certificates to be listed in known_client_hosts on a server that also accepts X.509 user certificates by subject name.

Workaround

For problem 1, leave trust_client_host disabled (the default), or do not rely on client_host in validate_host_based_user(). For problem 2, do not list X.509 certificates in known_client_hosts on servers that also accept X.509 user certificates by subject name.

PoC

For problem 1, on the server, `known_client_hosts` lists `build1.corp.test` with host key A and `admin-ws.corp.test` with host key B, and `trust_client_host` is set. `validate_host_based_user()` allows user `admin` only when `client_host` is `admin-ws.corp.test`.

A client holding only host key A makes two host-based attempts on one connection:

1. a request naming `build1.corp.test` (it may fail)
2. a request for user `admin` naming `admin-ws.corp.test`, signed with host key A

The second request passes the host key check, the callback is called with `admin-ws.corp.test`, and the login as `admin` is accepted. A single request naming `admin-ws.corp.test` with host key A is rejected. The stock client sends one host name per connection, so the test client was changed to send a different name on its second attempt.

For problem 2, on the server, `known_client_hosts` contains `* <X.509 CA certificate>`, the authorized keys contain `x509v3-sign-rsa subject=CN=admin`, and no other X.509 certificates are trusted. A user certificate for `CN=admin` issued by that CA is rejected on its own, but accepted if the client first makes a host-based attempt with any host key.

CVSS Base Scores

version 4.0
version 3.1