CVE-2026-45309: AsyncSSH `AuthorizedKeysFile %u` path traversal allows attacker-selected authorized keys to authenticate a traversal username
Summary AsyncSSH 2.22.0 expands the OpenSSH-compatible AuthorizedKeysFile %u token with the raw SSH username during pre-authentication server config reload. A server configured with a documented per-user key pattern such as AuthorizedKeysFile authorizedkeys/%u can be made to read an authorized-keys file outside the intended directory when the SSH username contains path traversal segments. If the attacker can place or reference a readable authorized-keys-format file containing their public key, the attacker can authenticate over SSH as the traversal username.
Affected Product - Package: asyncssh - Ecosystem: pip - Affected versions: confirmed on 2.22.0; exact lower bound not finalized - Tested version: 2.22.0 - Audit commit/tag: tag v2.22.0, commit af5a81e669633d83d535163f93b6bf3f957c9238 - PyPI sdist SHA256: c3ce72b01be4f97b40e62844dd384227e5ff5a401a3793007c42f86a5c8eb537
Vulnerability Details - CWE: CWE-22: Improper Limitation of a Pathname to a Restricted Directory - Component: AsyncSSH server config reload and public-key authentication (asyncssh/config.py, asyncssh/connection.py, asyncssh/authkeys.py, asyncssh/misc.py) - Root cause: %u in AuthorizedKeysFile is expanded from the remote username without rejecting path separators or .. segments, and the resulting path is opened without constraining it to the intended authorized-keys directory. - Security boundary violated: the configured authorized-keys directory and public-key authentication trust boundary. - Direct impact: public-key authentication succeeds using an attacker-selected authorized-keys file outside the intended directory. - Chain impact, if any: none claimed; direct authentication impact is primary.
Attack Preconditions - The AsyncSSH server uses a config or equivalent pattern where AuthorizedKeysFile contains %u, for example AuthorizedKeysFile authorizedkeys/%u. - Public-key authentication is enabled. - The attacker can place or reference a readable authorized-keys-format file outside the intended directory, such as a file in a world-writable or application-writable location. - The application does not separately reject usernames containing /, \, or .. before AsyncSSH uses the username for key-file selection.
Reproduction The run-scoped evidence contains a safe localhost proof:
1. Start the proof harness saved at harnessapp.py
2. Run exploitproof.py through runproof.sh
3. The harness creates sshdconfig with AuthorizedKeysFile authorizedkeys/%u, writes the attacker's public key to a file outside authorizedkeys/, starts a real AsyncSSH server, and attempts two SSH logins. 4. Expected result: the normal username victim fails, while the traversal username authenticates with the same attacker key.
Observed proof output:
text [CONTROL] username=victim success=False [ATTACK] username=../../../asyncssh-proof-exploit-proof-8b2bd23daeeb.pub success=True [ATTACK] output=AUTHBYPASSSUCCESS username=../../../asyncssh-proof-exploit-proof-8b2bd23daeeb.pub PASS: traversal username authenticated with attacker-controlled authorizedkeys file
Other sources
AsyncSSH is a Python package which provides an asynchronous client and server implementation of the SSHv2 protocol on top of the Python asyncio framework. Prior to 2.23.0, AsyncSSH expands the OpenSSH-compatible AuthorizedKeysFile %u token in asyncssh/config.py, asyncssh/connection.py, asyncssh/authkeys.py, and asyncssh/misc.py with the raw SSH username during pre-authentication server config reload, allowing a server configured with AuthorizedKeysFile authorizedkeys/%u to read an authorized-keys file outside the intended directory when the SSH username contains /, \, or .. path traversal segments and authenticate with an attacker-selected key file. This issue is fixed in version 2.23.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/asyncsshto a version that resolves this vulnerability.Fixed in 2.23.0 - Upgrade
Upgrade
asyncsshto a version that resolves this vulnerability.Fixed in 2.23.0 - Compensating control
Harden the server-side filesystem path(s) used for OpenSSH-compatible AuthorizedKeysFile patterns so that an attacker cannot place or reference readable authorized-keys-format files outside the intended authorized-keys directory (e.g., ensure the directories above/related to authorized_keys/ are not world-writable and that only the intended authorized-keys directory is writable by trusted actors).
Event History
Frequently Asked Questions
What is the severity of CVE-2026-45309?
CVE-2026-45309 has a risk rating of 62, indicating a moderate severity level.
What type of vulnerability is CVE-2026-45309?
CVE-2026-45309 is classified as a Path Traversal vulnerability.
How does CVE-2026-45309 affect the AsyncSSH software?
CVE-2026-45309 allows a server configured with user-specific key patterns to inadvertently read unauthorized files during SSH pre-authentication.
How do I fix CVE-2026-45309?
To fix CVE-2026-45309, update to the latest version of AsyncSSH that addresses this vulnerability.
When was CVE-2026-45309 published?
CVE-2026-45309 was published on May 27, 2026.