CVE
CVE-2026-138374, CVE-2026-138375, CVE-2026-138376, CVE-2026-138377
CWE
CWE-295, CWE-296, CWE-178, CWE-22, CWE-59, CWE-78, CWE-88, CWE-15, CWE-287, CWE-362, CWE-299, CWE-770
Affected Surface
- PyPI `asyncssh` up to and including 2.24.1: 23 advisories fixed in 2.24.2 (27 November 2026), including GHSA-fc6g-2vwf-pcv6 (X.509 trust root injection, CVSS 9.1) and four SFTP chroot escapes rated 8.1 to 8.3
- PyPI `asyncssh` up to and including 2.24.0: 13 more advisories fixed in 2.24.1 (4 October 2026) but only published on 27 November, including an authentication race that logs one user in as another (GHSA-7p24-mqc7-93r2) and recursive SFTP downloads that write outside the target directory (GHSA-qh52-pm2g-92v4, GHSA-xw5f-qvpr-c3v6, CVSS 8.8)
- Distribution packages built from older upstream releases (Debian 2.5.0 to 2.24.0, Ubuntu 22.04 and later 2.5.0 to 2.20.0, Fedora 2.14.2 to 2.24.0 on 29 November 2026) until their maintainers backport the fixes
TL;DR
AsyncSSH is the asyncio SSH client and server library for Python. It gets about 16.7 million downloads a month from PyPI. On 27 November 2026 its maintainer, Ron Frederick, released 2.24.2 and published 36 security advisories at once. 23 cover bugs fixed in 2.24.2. The other 13 cover bugs that 2.24.1 had already fixed on 4 October without saying so. Most of the advisories include a working proof of concept.
The one to read first is GHSA-fc6g-2vwf-pcv6 (CVSS 9.1), found by GitHub Security Lab’s Taskflow Agent. When AsyncSSH checked an X.509 certificate chain sent by the other side of the connection, it could treat a self-signed root in that chain as trusted. A malicious server could impersonate any host to clients that check X.509 host certificates, and a client could log in as any user on servers that accept X.509 user certificates. X.509 support is opt-in, so you’re only exposed if you configured X.509 trusted certificates for host or user authentication.
The SFTP fixes matter to more people. Four advisories rated 8.1 to 8.3 describe new ways for a logged-in user to break out of a chrooted AsyncSSH SFTP server, all through symlinks: a link path ending in /., renaming a directory that holds relative links, creating a link inside a directory reached through another link, and backslash paths on Windows. In the other direction, a malicious SFTP server could make recursive get() and mget() calls write outside the download directory, including through the symlink check that 2.24.1 added.
Several advisories only bite under particular configurations. RemoteCommand entries in ~/.ssh/config that use %h, %n or %r passed host and user names to the remote shell unchecked. A client could override environment="..." values bound to its key in authorized_keys. Servers that load per-user authorized keys could be raced so that Alice’s key logged her in as Bob (fixed in 2.24.1).
VulnCheck assigned CVEs to four of the advisories on 29 November (CVE-2026-138374 to CVE-2026-138377). The other 32 have no CVE. GitHub’s global advisory database hadn’t imported any of the 36 by 29 November, so Dependabot and other tools that read it won’t warn you. Nobody has reported exploitation, and none of the four CVEs has an EPSS score yet.
What to do now:
- Upgrade
asyncsshto 2.24.2. No smaller release contains these fixes, and 2.24.1 is not enough. - If you run an AsyncSSH SFTP server with
chrootfor users you don’t fully trust, look for symlinks inside the chroot that resolve outside it (command below), and check the service account’s~/.ssh/authorized_keysand shell startup files for changes. - If you use X.509 certificates for SSH host or user authentication, review recent logins and host key changes. Until you upgrade, switch to OpenSSH certificates or plain keys.
- 2.24.2 ignores environment requests a client sends after its session starts. Test clients that set environment variables late.
Affected packages and projects
| Ecosystem | Package | Affected versions | Fixed or safe version |
|---|---|---|---|
| PyPI | asyncssh | <= 2.24.1 (23 advisories, earliest affected version differs per advisory) | 2.24.2 |
| PyPI | asyncssh | <= 2.24.0 (13 advisories published 27 November) | 2.24.1, but take 2.24.2 |
| Debian | python3-asyncssh | 2.5.0 (bullseye), 2.10.1 (bookworm), 2.20.0 (trixie), 2.24.0 (forky, sid) | Check the Debian security tracker for backports |
| Ubuntu | python3-asyncssh | 2.5.0 (22.04), 2.10.1 (24.04), 2.20.0 (25.04, 25.10) | Check the Ubuntu CVE tracker for backports |
| Fedora | python3-asyncssh | 2.14.2 to 2.24.0 depending on release | Pending a 2.24.2 update |
These are the advisories rated 7.0 or higher, plus the four with CVEs:
| Advisory | CVE | Issue | CVSS 3.1 | Affected | Fixed in |
|---|---|---|---|---|---|
| GHSA-fc6g-2vwf-pcv6 | none | Peer can add its own trusted root to an X.509 chain | 9.1 | <= 2.24.1 | 2.24.2 |
| GHSA-xw5f-qvpr-c3v6 | none | SFTP download of symlinks writes outside the destination | 8.8 | 1.1.0 to 2.24.0 | 2.24.1 |
| GHSA-qh52-pm2g-92v4 | none | Recursive SFTP download writes outside the destination | 8.8 | 1.1.0 to 2.24.0 | 2.24.1 |
| GHSA-p829-qgjf-vjrp | none | Symlink paths ending in /. escape the SFTP chroot | 8.3 | 1.1.0 to 2.24.1 | 2.24.2 |
| GHSA-gqr5-mpmr-vq6h | none | Host and user names run commands through RemoteCommand | 8.2 | 2.3.0 to 2.24.1 | 2.24.2 |
| GHSA-5c83-297m-w672 | none | SFTP chroot escape by renaming directories that hold symlinks | 8.1 | <= 2.24.1 | 2.24.2 |
| GHSA-523m-7fcp-9v4r | none | Links created through a symlink escape the SFTP chroot | 8.1 | 1.1.0 to 2.24.1 | 2.24.2 |
| GHSA-r98q-c7gm-3hvg | none | Chained symlinks get past the 2.24.1 download check | 8.1 | 2.24.1 | 2.24.2 |
| GHSA-ch2j-9j46-rf3w | none | Client overrides environment= values from authorized_keys | 8.1 | <= 2.24.1 | 2.24.2 |
| GHSA-jr2x-9894-h63r | none | Backslash paths escape the SFTP chroot on Windows | 8.1 | 1.18.0 to 2.24.0 | 2.24.1 |
| GHSA-7p24-mqc7-93r2 | none | Authentication race logs a client in as a different user | 8.1 | 2.3.0 to 2.24.0 | 2.24.1 |
| GHSA-8c74-72gh-pqwc | none | Crafted PEM header hangs key import | 7.5 | 1.18.0 to 2.24.1 | 2.24.2 |
| GHSA-p2wr-q54c-hg2g | none | Crafted key or certificate data blocks the event loop | 7.5 | <= 2.24.1 | 2.24.2 |
| GHSA-gv85-2g9p-9j8x | none | Huge packet length exhausts memory before authentication | 7.5 | <= 2.24.0 | 2.24.1 |
| GHSA-4ghm-82rg-pg6c | none | Host key revoked for one port still trusted on that port | 7.4 | <= 2.24.1 | 2.24.2 |
| GHSA-xx29-jph9-vq39 | none | Revoked host key still accepted inside a host certificate | 7.4 | 1.0.0 to 2.24.0 | 2.24.1 |
| GHSA-54qj-68m2-5346 | CVE-2026-138374, CVE-2026-138375 | Host and user names add ProxyCommand arguments; ${NAME} in names leaks environment variables | 6.8 (VulnCheck: 7.5 and 3.1) | 2.7.0 / 2.20.0 to 2.24.1 | 2.24.2 |
| GHSA-4hgp-7gmx-wvfg | CVE-2026-138376, CVE-2026-138377 | Host-based auth trust carries over between attempts, including X.509 CAs from known_client_hosts | 5.9 (VulnCheck: 5.9 and 6.8) | 1.13.1 to 2.24.1 | 2.24.2 |
The other 18 advisories are rated medium or low. They cover denial of service (decompression bombs, small channel packet sizes, RSA key exchange CPU, unchecked SFTP packet lengths, an unenforced channel window, duplicate session requests), an mget wildcard download that writes outside the destination, SCP name and permission checks, X11 cookie checks, SSHSIG signature and certificate checks, a certificate extension misread as a permission, key options and empty usernames in per-user key handling, a CBC plaintext-recovery variant of CVE-2008-5161, unchecked liboqs errors and unverified client host names. The // chroot escape fixed in 2.24.1, CVE-2026-102643, was published earlier and is covered in our November roundup.
Technical analysis
X.509 chains: one name check, two meanings of “equal”
When an AsyncSSH client or server receives an X.509 certificate chain, SSHX509CertificateChain.validate_chain() in asyncssh/public_key.py builds a trust store and hands it to X509Certificate.validate() in asyncssh/crypto/x509.py, which asks pyOpenSSL to verify the leaf. Before the fix, the first lines looked like this:
trust_store = {c for c in trust_chain if c.subject != c.issuer} | \
set(trusted_certs)
trust_chain is the list of certificates the peer sent. trusted_certs is what the local admin configured. The two were merged into one set, and the only thing keeping a peer-supplied root out was c.subject != c.issuer, which uses the cryptography library’s Name comparison. That comparison is exact. OpenSSL’s isn’t: it compares names ignoring case and extra whitespace.
So a peer sends a root whose subject is CN=EvilCA and whose issuer is CN=evilca. Python sees two different names and puts the certificate in the trust store. OpenSSL sees a self-signed root sitting in its trust store and accepts it as an anchor. Every certificate the attacker signs with that key now validates. The advisory’s proof of concept calls the real validate_chain() with a trust store holding only CN=LegitRootCA. A control CA with a different issuer is rejected with “unable to get issuer certificate”, and the case-variant CA is accepted.
Two attacks follow. A server sends an x509v3-* host key containing [leaf, fake_root], with the leaf naming the target host and carrying the secureShellServer extended key usage. The client accepts it as the real host, and the attacker can read and change the session, capture passwords and use a forwarded agent. In the other direction, a client sends a user authentication request for root with a leaf whose rfc822Name is root, signed by its fake root, and logs in.
Commit 54d6cda9d520 (7 November) stops mixing the two lists:
--- a/asyncssh/public_key.py
+++ b/asyncssh/public_key.py
@@ def validate_chain(self, trust_chain, ...)
- trust_store = {c for c in trust_chain if c.subject != c.issuer} | \
- set(trusted_certs)
+ trust_store = set(trusted_certs)
...
- self.x509_cert.validate([c.x509_cert for c in trust_store],
+ self.x509_cert.validate([c.x509_cert for c in trust_chain],
+ [c.x509_cert for c in trust_store],
purposes, user_principal, host_principal)
--- a/asyncssh/crypto/x509.py
+++ b/asyncssh/crypto/x509.py
@@ def validate(self, ...)
+ openssl_chain = [c.openssl_cert for c in trust_chain
+ if c.subject_hash != c.issuer_hash]
+
x509_store = crypto.X509Store()
for c in trust_store:
x509_store.add_cert(c.openssl_cert)
try:
x509_ctx = crypto.X509StoreContext(x509_store, self.openssl_cert,
- None)
+ openssl_chain)
Only locally configured certificates go into the X509Store. The peer’s certificates become the untrusted chain argument to X509StoreContext, which OpenSSL uses to build a path but never as an anchor. The self-signed filter now compares OpenSSL’s own subject and issuer hashes, so both sides agree on what “self-signed” means.
SFTP chroot: link targets checked from the wrong directory
AsyncSSH’s SFTPServer takes a chroot argument and maps every client path under it. When a client creates a symlink, the server checks the target and rewrites it so the link stays inside the chroot. The 2.24.2 advisories describe three ways that check computed the link’s directory differently from where the filesystem actually put the link.
- Trailing
/.(GHSA-p829-qgjf-vjrp). For a link path such as/a/b/., the check dropped the last component and treated/a/bas the link’s directory. The filesystem creates the link at/a/b, so its relative target resolves from/a, one level higher. A target of../..looks safe from/a/band points at the chroot’s parent from/a. Paths ending in/./or/behave the same way. - Links created through a link (GHSA-523m-7fcp-9v4r). A client may create
/d1/d2/d3/d4/esc -> /, which points at the chroot root and is allowed. A new link at/d1/d2/d3/d4/esc/pwnwas treated as four levels deep, so an escaping target was rewritten to../../../../DEEP_OUT.txt. Becauseescis the chroot root, the link actually lands there and its target climbs four levels above the chroot. The attacker picks the depth, so any file the server process can reach is in range. - Renaming directories (GHSA-5c83-297m-w672). A relative target is only correct at the depth where the link was made. Renaming a link re-checked it, but renaming a directory moved every link inside it unchecked. A link at
/d1/d2/sub/link -> ../../outside/victim.txtstays inside the chroot until/d1/d2/subis renamed to/top.
Through any of these links the client can read, create, overwrite or delete files the server process can access outside its chroot. The advisories note that writing ~/.ssh/authorized_keys or shell startup files for the server’s account can turn that into code execution. The fixes (commits 7ac9a1bdd9a8, 58eab14f231e and d2789835e210) resolve the link’s real parent directory through the filesystem, rewrite targets relative to it, refuse links whose target lands outside the chroot, and check every link inside a directory before renaming it.
SFTP downloads: .. treated as text
The client side has the mirror-image bug. A recursive get() or mget() recreates the server’s symlinks locally. 2.24.1 added a check that each target stays inside the download directory, but GHSA-r98q-c7gm-3hvg shows it normalized .. as text. The server sends s -> ., which is fine, then X -> s/../X. Textually s/.. cancels out and leaves X. On disk, s is the download directory, so s/.. is its parent. When the server then lists X again as a file or directory, the client writes through it. Chaining l0 -> ., l1 -> l0/.., l2 -> l1/.. climbs one level per link. Commit 22ebf994098c resolves targets against links already created in the download and rejects targets whose meaning could change later in the same download.
RemoteCommand: names pasted into a shell
AsyncSSH reads ~/.ssh/config unless you pass config=. If a matching Host block sets RemoteCommand with %h, %n or %r, the values passed to connect() were substituted into a string the server runs with the user’s login shell. The advisory’s proof of concept uses this config:
Host *.corp.test
HostName server.corp.test
RemoteCommand echo connected to %n
and this call:
await asyncssh.connect('x;touch$IFS/tmp/pwned;.corp.test', username='deploy')
The host still matches *.corp.test, HostName sends the connection to the real server, and %n (the name as given) puts x;touch$IFS/tmp/pwned;.corp.test into the command. The remote shell runs touch /tmp/pwned. It only matters when an application passes host or user names from a less trusted source to connect() and the effective config has a matching RemoteCommand with one of those tokens.
Commit 6bb991278de6 adds a shell-aware path to SSHConfig._expand_val() and turns it on for RemoteCommand only:
+_shell_metachars = r'\'`"$\\;&<>|(){}\x00-\x1f\x7f'
+_unsafe_shell_host_pattern = re.compile(rf'^-|[{_shell_metachars}\s]')
+_unsafe_shell_user_pattern = re.compile(rf'^-|[{_shell_metachars}]|\s-')
...
if token is not None:
- return self._expand_token(token)
+ result = self._expand_token(token)
+
+ if shell:
+ pattern = self._shell_unsafe.get(token)
+
+ if pattern and pattern.search(result):
+ raise ConfigParseError(
+ f'Unsafe %{token} substitution in shell command')
+
+ return result
...
+ _shell_expand = {'RemoteCommand'}
+ _shell_unsafe = {'h': _unsafe_shell_host_pattern,
+ 'n': _unsafe_shell_host_pattern,
+ 'r': _unsafe_shell_user_pattern}
A name with a leading -, a shell metacharacter or a control character now fails with ConfigParseError before anything is sent, which is close to what OpenSSH did for CVE-2023-51385. The sibling bug for ProxyCommand (GHSA-54qj-68m2-5346, CVE-2026-138374) runs locally instead: whitespace or quotes in a name split into extra arguments, so a common ssh -W %h:%p bastion proxy command could be handed an -o option that runs commands as the application user. Commit 43dfcb81b86d fixes that one.
Server-side authentication bugs
- Key-bound environment (GHSA-ch2j-9j46-rf3w). With
environment="ROLE=readonly"on a key inauthorized_keys, a client could sendROLE=adminwhen opening a session, and the application sawROLE=admin. OpenSSH gives the key’s values priority. Commite4111b5e7f50does the same and applies the key’s values when the session starts, which is why environment requests sent after that point are now ignored. Applications that never use key-bound environment variables for authorization aren’t affected. - Per-user key race (GHSA-7p24-mqc7-93r2, fixed in 2.24.1). Reported by a researcher at OpenAI. A client queries Alice’s key as Alice, which loads Alice’s authorized keys, then immediately sends an authentication request as Bob signed with Alice’s key. The server hadn’t finished loading Bob’s configuration, checked the request against Alice’s keys, accepted it, and reported Bob as the logged-in user. Only servers that load different authorized keys per user (
begin_auth()plusset_authorized_keys(), orAuthorizedKeysFilewith%u) are affected. - Host-based auth carry-over (GHSA-4hgp-7gmx-wvfg, CVE-2026-138376 and CVE-2026-138377). With
trust_client_hostenabled, keys and X.509 CA certificates matched during one host-based attempt stayed trusted for later attempts on the same connection. A client holding one known host’s key could retry as another host, or add host-only CAs to its trust anchors and then log in with a user certificate issued under them.
IOCs
These are vulnerabilities, not malware, and nobody has published exploitation indicators. Patterns worth hunting for come straight from the advisories:
- SFTP
SYMLINKrequests whose link path ends in/.,/./or/, or whose path passes through another symlink. - SFTP
RENAMEorposix-rename@openssh.comrequests that move directories containing relative symlinks toward the chroot root. - Host or user names containing
;,|,`,$(, whitespace or a leading-in application logs aroundasyncssh.connect(). - X.509 SSH certificates whose subject and issuer differ only in case or whitespace (for example
CN=EvilCA/CN=evilca).
Detection and remediation
Find the installed version:
pip show asyncssh 2>/dev/null | rg '^(Name|Version)'
python -c 'import asyncssh; print(asyncssh.__version__)'
rg -n 'asyncssh' requirements*.txt pyproject.toml poetry.lock uv.lock Pipfile.lock 2>/dev/null
dpkg -l python3-asyncssh 2>/dev/null; rpm -q python3-asyncssh 2>/dev/null
Find code that uses the affected features:
# Chrooted SFTP servers
rg -n 'chroot\s*=' --type py
# X.509 trust for host or user auth
rg -n 'x509_trusted_cert|x509v3-|cert-authority' --type py
# Recursive downloads from servers you may not control
rg -n '\.(get|mget)\(.*recurse\s*=\s*True' --type py
# Per-user authorized keys (race fixed in 2.24.1)
rg -n 'begin_auth|set_authorized_keys|AuthorizedKeysFile.*%u' .
# Key-bound environment used for authorization
rg -n 'environment="' ~/.ssh/authorized_keys /etc/ssh 2>/dev/null
# RemoteCommand or ProxyCommand with name tokens
rg -n '^\s*(RemoteCommand|ProxyCommand).*%[hnr]' ~/.ssh/config /etc/ssh/ssh_config* 2>/dev/null
Look for symlinks inside a chroot tree that resolve outside it. Set ROOT to the directory you pass as chroot (or the parent of per-user chroots):
ROOT=/srv/sftp
find "$ROOT" -type l -print0 | while IFS= read -r -d '' l; do
t=$(realpath -m -- "$l")
case "$t" in "$ROOT"|"$ROOT"/*) ;; *) printf '%s -> %s\n' "$l" "$t" ;; esac
done
Then upgrade:
pip install --upgrade 'asyncssh>=2.24.2'
If the symlink check finds anything, or you can’t rule out that untrusted users reached a chrooted server before the upgrade, treat everything the server process could read as exposed. Rotate the server’s SSH host keys, any credentials or API keys in files that account can read, and the account’s own authorized_keys. Check shell startup files and cron entries for that account. If you relied on X.509 host certificates from clients, rotate passwords that were typed into sessions to hosts you can’t verify, and revoke any agent-forwarded keys used on them.
Timeline
- 2026-10-04: AsyncSSH 2.24.1 is released. It fixes 13 issues, including the per-user authentication race and recursive download escapes, without publishing advisories for them.
- 2026-11-06 to 2026-11-07: Fixes land for additional SFTP chroot escapes (
7ac9a1bdd9a8) and the X.509 trust root bug (54d6cda9d520). - 2026-11-14 to 2026-11-26: Further fixes land, including more chroot escapes (
58eab14f231e,d2789835e210), client download escapes (22ebf994098c),authorized_keysenvironment precedence (e4111b5e7f50),ProxyCommandandRemoteCommandname checks (43dfcb81b86d,6bb991278de6) and host-based auth trust (19731a172894). - 2026-11-27, 22:16 to 22:17 UTC: The maintainer publishes 13 advisories for issues fixed in 2.24.1.
- 2026-11-27, 23:17 UTC: AsyncSSH 2.24.2 is uploaded to PyPI.
- 2026-11-27, 23:29 UTC: 23 advisories for issues fixed in 2.24.2 are published, including GHSA-fc6g-2vwf-pcv6 (GHSL-2026-235).
- 2026-11-28: Cybersecurity Help lists the SFTP chroot escapes (VU170783, VU170784, VU170792).
- 2026-11-29: VulnCheck publishes CVE-2026-138374 to CVE-2026-138377. GitHub’s global advisory database still has none of the 36 advisories.
From research to remediation
Check whether this pattern exists in your codebase
Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.
References
- AsyncSSH change log: release 2.24.2 (27 November 2026)
- AsyncSSH security advisories (36 published 27 November 2026)
- GHSA-fc6g-2vwf-pcv6: Peer can inject its own trusted root in X.509 chains (GHSL-2026-235)
- AsyncSSH commit 54d6cda9d520: Fix issue with X.509 certificate chain validation
- GHSA-gqr5-mpmr-vq6h: Host and user names can run commands via RemoteCommand (fix 6bb991278de6)
- GHSA-7p24-mqc7-93r2: Authentication race allows login as a different user (fixed in 2.24.1)
- VulnCheck: AsyncSSH 2.7.0 before 2.24.2 argument injection via ProxyCommand token substitution (CVE-2026-138374)
- VulnCheck: AsyncSSH 1.13.1 before 2.24.2 improper certificate validation via known_client_hosts (CVE-2026-138377)
- Cybersecurity Help VU170792: Link following in AsyncSSH (SFTP chroot escape through renamed directories)
- PyPI: asyncssh