Repository navigation
Update dependency asyncssh to v2.24.0 [SECURITY] - #54
Open
konflux-internal-p02[bot] wants to merge 1 commit into
Open
konflux-internal-p02[bot] wants to merge 1 commit into
konflux-internal-p02[bot] wants to merge 1 commit into
Conversation
Signed-off-by: konflux-internal-p02 <170854209+konflux-internal-p02[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
==2.9→==2.24.0Warning
Some dependencies could not be looked up. Check the warning logs for more information.
AsyncSSH Rogue Session Attack
CVE-2023-46446 / GHSA-c35q-ffpf-5qpm / PYSEC-2023-239
More information
Details
Summary
An issue in AsyncSSH v2.14.0 and earlier allows attackers to control the remote end of an SSH client session via packet injection/removal and shell emulation.
Details
The rogue session attack targets any SSH client connecting to an AsyncSSH server, on which the attacker must have a shell account. The goal of the attack is to log the client into the attacker's account without the client being able to detect this. At that point, due to how SSH sessions interact with shell environments, the attacker has complete control over the remote end of the SSH session. The attacker receives all keyboard input by the user, completely controls the terminal output of the user's session, can send and receive data to/from forwarded network ports, and is able to create signatures with a forwarded SSH Agent, if any. The result is a complete break of the confidentiality and integrity of the secure channel, providing a strong vector for a targeted phishing campaign against the user. For example, the attacker can display a password prompt and wait for the user to enter the password, elevating the attacker's position to a MitM at the application layer and enabling perfect shell emulation.
The attacks work by the attacker injecting a chosen authentication request before the client's NewKeys. The authentication request sent by the attacker must be a valid authentication request containing his credentials. The attacker can use any authentication mechanism that does not require exchanging additional messages between client and server, such as password or publickey. Due to a state machine flaw, the AsyncSSH server accepts the unauthenticated user authentication request message and defers it until the client has requested the authentication protocol.
PoC
AsyncSSH 2.14.0 client (simple_client.py example) connecting to AsyncSSH 2.14.0 server (simple_server.py example)
Impact
The impact heavily depends on the application logic implemented by the AsyncSSH server. In the worst case, the AsyncSSH server starts a shell for the authenticated user upon connection, switching the user to the authenticated one. In this case, the attacker can prepare a modified shell beforehand to perform perfect phishing attacks and become a MitM at the application layer. When the username of the authenticated user is not used beyond authentication, this vulnerability does not impact the connection's security.
Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
AsyncSSH Rogue Extension Negotiation
CVE-2023-46445 / GHSA-cfc2-wr2v-gxm5 / PYSEC-2023-237
More information
Details
Summary
An issue in AsyncSSH v2.14.0 and earlier allows attackers to control the extension info message (RFC 8308) via a man-in-the-middle attack.
Details
The rogue extension negotiation attack targets an AsyncSSH client connecting to any SSH server sending an extension info message. The attack exploits an implementation flaw in the AsyncSSH implementation to inject an extension info message chosen by the attacker and delete the original extension info message, effectively replacing it.
A correct SSH implementation should not process an unauthenticated extension info message. However, the injected message is accepted due to flaws in AsyncSSH. AsyncSSH supports the server-sig-algs and global-requests-ok extensions. Hence, the attacker can downgrade the algorithm used for client authentication by meddling with the value of server-sig-algs (e.g. use of SHA-1 instead of SHA-2).
PoC
AsyncSSH Client 2.14.0 (simple_client.py example) connecting to AsyncSSH Server 2.14.0 (simple_server.py example)
Impact
Algorithm downgrade during user authentication.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
CVE-2023-46445 / GHSA-cfc2-wr2v-gxm5 / PYSEC-2023-237
More information
Details
An issue in AsyncSSH v2.14.0 and earlier allows attackers to control the extension info message (RFC 8308) via a man-in-the-middle attack.
Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:NReferences
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
CVE-2023-46446 / GHSA-c35q-ffpf-5qpm / PYSEC-2023-239
More information
Details
An issue in AsyncSSH v2.14.0 and earlier allows attackers to control the remote end of an SSH client session via packet injection/removal and shell emulation.
Severity
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
AsyncSSH vulnerable to Prefix Truncation Attack (a.k.a. Terrapin Attack) against ChaCha20-Poly1305 and Encrypt-then-MAC
GHSA-hfmc-7525-mj55
More information
Details
Summary
AsyncSSH v2.14.1 and earlier is vulnerable to a novel prefix truncation attack (a.k.a. Terrapin attack), which allows a man-in-the-middle attacker to strip an arbitrary number of messages right after the initial key exchange, breaking SSH extension negotiation (RFC8308) in the process and thus downgrading connection security.
Mitigations
To mitigate this protocol vulnerability, OpenSSH suggested a so-called "strict kex" which alters the SSH handshake to ensure a Man-in-the-Middle attacker cannot introduce unauthenticated messages as well as convey sequence number manipulation across handshakes. Support for strict key exchange has been added to AsyncSSH in the patched version.
Warning: To take effect, both the client and server must support this countermeasure.
As a stop-gap measure, peers may also (temporarily) disable the affected algorithms and use unaffected alternatives like AES-GCM instead until patches are available.
Details
The SSH specifications of ChaCha20-Poly1305 (
[email protected]) and Encrypt-then-MAC (*[email protected]MACs) are vulnerable against an arbitrary prefix truncation attack (a.k.a. Terrapin attack). This allows for an extension negotiation downgrade by stripping the SSH_MSG_EXT_INFO sent after the first message after SSH_MSG_NEWKEYS, downgrading security, and disabling attack countermeasures in some versions of OpenSSH. When targeting Encrypt-then-MAC, this attack requires the use of a CBC cipher to be practically exploitable due to the internal workings of the cipher mode. Additionally, this novel attack technique can be used to exploit previously unexploitable implementation flaws in a Man-in-the-Middle scenario.The attack works by an attacker injecting an arbitrary number of SSH_MSG_IGNORE messages during the initial key exchange and consequently removing the same number of messages just after the initial key exchange has concluded. This is possible due to missing authentication of the excess SSH_MSG_IGNORE messages and the fact that the implicit sequence numbers used within the SSH protocol are only checked after the initial key exchange.
In the case of ChaCha20-Poly1305, the attack is guaranteed to work on every connection as this cipher does not maintain an internal state other than the message's sequence number. In the case of Encrypt-Then-MAC, practical exploitation requires the use of a CBC cipher; while theoretical integrity is broken for all ciphers when using this mode, message processing will fail at the application layer for CTR and stream ciphers.
For more details and a pre-print of the associated research paper, see https://terrapin-attack.com. This website is not affiliated with AsyncSSH in any way.
PoC
Extension Negotiation Downgrade Attack (chacha20-poly1305@openssh.com)
Impact
This attack targets the specification of ChaCha20-Poly1305 (
[email protected]) and Encrypt-then-MAC (*[email protected]), which are widely adopted by well-known SSH implementations and can be considered de-facto standard. These algorithms can be practically exploited; however, in the case of Encrypt-Then-MAC, we additionally require the use of a CBC cipher. As a consequence, this attack works against all well-behaving SSH implementations supporting either of those algorithms and can be used to downgrade (but not fully strip) connection security in case SSH extension negotiation (RFC8308) is supported. The attack may also enable attackers to exploit certain implementation flaws in a man-in-the-middle (MitM) scenario.Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
asyncssh has SCP Path Traversal to Arbitrary File Write
CVE-2026-54591 / GHSA-2wxc-x7rj-hg8f / PYSEC-2026-3808
More information
Details
A malicious SSH server can write arbitrary files on the asyncssh SCP client's filesystem by sending filenames containing
../traversal sequences. The SCP receive path does not currently sanitize server-provided filenames. By chaining directory traversals via theD(directory) action, an attacker can escape any target directory and overwrite~/.bashrc,~/.ssh/rc, or~/.ssh/authorized_keys, achieving code execution. This is the same vulnerability class as CVE-2019-6111. The mitigation applied in OpenSSH does not appear to have been adopted in asyncssh.Steps to exploit:
Step 1 - Normal usage: Application calls
await asyncssh.scp((conn, 'file'), '/home/user/downloads/'). This is the standard, documented API.Step 2 - SCP protocol: asyncssh opens an SSH exec channel, runs
scp -f file. The server controls the filename field:Step 3 -
_parse_cd_args(scp.py:134-142) returns the filename verbatim:The returned
nameis not passed throughbasename()and is not checked for..or/components.Step 4 -
_recv_files(scp.py:706-713) joins the unsanitized name:With
dstpath=b'/home/user/downloads/subdir'andname=b'../pwned.txt', this resolves to/home/user/downloads/pwned.txt, outside the target.Step 5 - File write:
_recv_fileopens the traversed path viaself._fs.open(dstpath, 'wb')and writes attacker-controlled content. The resolved path is not checked against the target directory boundary.Step 6 - RCE chains:
~/.bashrc~/.profile~/.ssh/rc~/.ssh/authorized_keyscommand=Reproduction:
Link to reproduction script: path_traversal_poc.zip
docker build -t asyncssh-scp-traversal -f Dockerfile . docker run --rm asyncssh-scp-traversalThe attached
poc_scp_traversal.pystarts a malicious SSH server in-process using asyncssh's own API, then downloads from it viaasyncssh.scp().Expected Output:
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:HReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
asyncssh has an incomplete fix for CVE-2026-45309 — AuthorizedKeysFile %u still escapes the intended directory via a leading ~ (and weakly via ${ENV}) username substitution
CVE-2026-54590 / GHSA-qr67-gv47-xwwh / PYSEC-2026-3809
More information
Details
Incomplete fix for CVE-2026-45309 (GHSA-g794-3fmp-753h). The
2.23.0 guard that sanitises the SSH username before
%usubstitutionin
AuthorizedKeysFileblocks/,\and.., but does not block aleading
~(or${ENV}), both of which are re-introduced by laterexpansion and reach the file open — defeating the guard.
Affected: asyncssh 2.23.0 and current
develop(commita60f863,HEAD on 2026-05-29).
Summary
The fix for CVE-2026-45309 added a guard in
SSHServerConfig._set_tokens(asyncssh/config.py:715-716) thatrejects an SSH username containing
/,\, or equal to.., beforeit is substituted for the
%utoken inAuthorizedKeysFile:However, the
%u-substituted value is subsequently passed throughenvironment-variable expansion (
_expand_val,config.py:145-149—token expansion then env expansion) and, at file-open time, through
expanduser()(read_authorized_keys→read_file→open(Path(filename).expanduser()),auth_keys.py:348→misc.py:290). Both re-introduce the path control the guard was meantto remove, so a username that contains no
//\can still cause theserver to read an authorized-keys file outside the intended per-user
directory.
The client-supplied username reaches this path pre-authentication:
_process_userauth_requesttakes the username from theSSH_MSG_USERAUTH_REQUESTpacket (connection.py:2516-2519) and_finish_userauthcallsreload_config()(connection.py:2536),which re-evaluates
AuthorizedKeysFilewithusername=self._username(
connection.py:5906) before the offered key is validated.Primary vector — leading
~A username such as
~rootor~victimpasses the guard (no/). Fora server whose
AuthorizedKeysFilebegins with%u— e.g.AuthorizedKeysFile %u/.ssh/authorized_keys— the expanded value is~victim/.ssh/authorized_keys, whichexpanduser()resolves to/home/victim/.ssh/authorized_keys(~root→/root/...; a bare~→ the server process's home). The username has therefore escaped the
intended per-user location without using any path separator —
defeating the purpose of the guard.
Note:
expanduser()only expands a leading~, so this vectorrequires
%uto be the first path component ofAuthorizedKeysFile.(The CVE-2026-45309
authorized_keys/%uexample —%unot leading —is not reachable this way; that was the
../form.)Impact and limitations
a60f863): the guard isbypassable and the authorized-keys lookup is redirected to an
attacker-named home tree, pre-auth, with a separator-free username.
redirected username when a readable authorized-keys file containing
the attacker's key is reachable at the redirected location. The parent
CVE accepted this exact precondition and was scored
C:N/I:H/A:N;this is scored consistently.
the path-redirection mechanism in-process, deterministically. No new
primitive is claimed beyond the parent CVE's accepted model — only
that the 2.23.0 fix does not close it for
~/${ENV}.%umust be the leading pathcomponent; on Python 3.13,
Path('~nonexistentuser').expanduser()raises
RuntimeError, so only existing accounts are reachable(confirmed: asyncssh 2.23.0, Python 3.13.12).
Secondary vector —
${ENV}(defense-in-depth only)A username like
${HOME}also passes the guard and is thenenvironment-expanded, re-introducing
/. Weaker and not a practicalexploit: the attacker can only reference env vars that already exist
in the server process (a missing variable raises
ConfigParseError)and cannot control their values. Reported as hardening.
Reproduction
In-process, deterministic, no network. Against a checkout of asyncssh
2.23.0:
Output (abridged):
Suggested fix
Tighten
_set_tokensto also reject usernames that re-introduce pathcontrol after expansion — reject a leading
~/~userand$/${references in
self._user. More robustly, validate that the FINALexpanded
AuthorizedKeysFilepath remains within the intended basedirectory, and/or suppress
expanduser/environment expansion on the%u-derived component specifically.Disclosure
Coordinated, ~90-day default. I will not publish details/PoC before a
fix is released, and am happy to validate the patch. Credit (if given)
to
cesabici-bit.PoC source
(see code block below)
Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
asyncssh has SCP Path Traversal to Arbitrary File Write
CVE-2026-54591 / GHSA-2wxc-x7rj-hg8f / PYSEC-2026-3808
More information
Details
A malicious SSH server can write arbitrary files on the asyncssh SCP client's filesystem by sending filenames containing
../traversal sequences. The SCP receive path does not currently sanitize server-provided filenames. By chaining directory traversals via theD(directory) action, an attacker can escape any target directory and overwrite~/.bashrc,~/.ssh/rc, or~/.ssh/authorized_keys, achieving code execution. This is the same vulnerability class as CVE-2019-6111. The mitigation applied in OpenSSH does not appear to have been adopted in asyncssh.Steps to exploit:
Step 1 - Normal usage: Application calls
await asyncssh.scp((conn, 'file'), '/home/user/downloads/'). This is the standard, documented API.Step 2 - SCP protocol: asyncssh opens an SSH exec channel, runs
scp -f file. The server controls the filename field:Step 3 -
_parse_cd_args(scp.py:134-142) returns the filename verbatim:The returned
nameis not passed throughbasename()and is not checked for..or/components.Step 4 -
_recv_files(scp.py:706-713) joins the unsanitized name:With
dstpath=b'/home/user/downloads/subdir'andname=b'../pwned.txt', this resolves to/home/user/downloads/pwned.txt, outside the target.Step 5 - File write:
_recv_fileopens the traversed path viaself._fs.open(dstpath, 'wb')and writes attacker-controlled content. The resolved path is not checked against the target directory boundary.Step 6 - RCE chains:
~/.bashrc~/.profile~/.ssh/rc~/.ssh/authorized_keyscommand=Reproduction:
Link to reproduction script: path_traversal_poc.zip
docker build -t asyncssh-scp-traversal -f Dockerfile . docker run --rm asyncssh-scp-traversalThe attached
poc_scp_traversal.pystarts a malicious SSH server in-process using asyncssh's own API, then downloads from it viaasyncssh.scp().Expected Output:
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:HReferences
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
asyncssh has an incomplete fix for CVE-2026-45309 — AuthorizedKeysFile %u still escapes the intended directory via a leading ~ (and weakly via ${ENV}) username substitution
CVE-2026-54590 / GHSA-qr67-gv47-xwwh / PYSEC-2026-3809
More information
Details
Incomplete fix for CVE-2026-45309 (GHSA-g794-3fmp-753h). The
2.23.0 guard that sanitises the SSH username before
%usubstitutionin
AuthorizedKeysFileblocks/,\and.., but does not block aleading
~(or${ENV}), both of which are re-introduced by laterexpansion and reach the file open — defeating the guard.
Affected: asyncssh 2.23.0 and current
develop(commita60f863,HEAD on 2026-05-29).
Summary
The fix for CVE-2026-45309 added a guard in
SSHServerConfig._set_tokens(asyncssh/config.py:715-716) thatrejects an SSH username containing
/,\, or equal to.., beforeit is substituted for the
%utoken inAuthorizedKeysFile:However, the
%u-substituted value is subsequently passed throughenvironment-variable expansion (
_expand_val,config.py:145-149—token expansion then env expansion) and, at file-open time, through
expanduser()(read_authorized_keys→read_file→open(Path(filename).expanduser()),auth_keys.py:348→misc.py:290). Both re-introduce the path control the guard was meantto remove, so a username that contains no
//\can still cause theserver to read an authorized-keys file outside the intended per-user
directory.
The client-supplied username reaches this path pre-authentication:
_process_userauth_requesttakes the username from theSSH_MSG_USERAUTH_REQUESTpacket (connection.py:2516-2519) and_finish_userauthcallsreload_config()(connection.py:2536),which re-evaluates
AuthorizedKeysFilewithusername=self._username(
connection.py:5906) before the offered key is validated.Primary vector — leading
~A username such as
~rootor~victimpasses the guard (no/). Fora server whose
AuthorizedKeysFilebegins with%u— e.g.AuthorizedKeysFile %u/.ssh/authorized_keys— the expanded value is~victim/.ssh/authorized_keys, whichexpanduser()resolves to/home/victim/.ssh/authorized_keys(~root→/root/...; a bare~→ the server process's home). The username has therefore escaped the
intended per-user location without using any path separator —
defeating the purpose of the guard.
Note:
expanduser()only expands a leading~, so this vectorrequires
%uto be the first path component ofAuthorizedKeysFile.(The CVE-2026-45309
authorized_keys/%uexample —%unot leading —is not reachable this way; that was the
../form.)Impact and limitations
a60f863): the guard isbypassable and the authorized-keys lookup is redirected to an
attacker-named home tree, pre-auth, with a separator-free username.