Skip to main content

CVE-2023-48795 — Vulnerability in russh — CVE Details

MEDIUM

Prefix Truncation Attack against ChaCha20-Poly1305 and Encrypt-then-MAC aka Terrapin

Published December 18, 2023Updated September 10, 2026Source: OSV

What Should I Do?

Fix Within 2-4 Weeks

Moderate exploitation risk (35.76% probability in 30 days). Schedule remediation soon.

Does your project use an affected golang.org/x/crypto version?

Paste your go.sum to check it for CVE-2023-48795 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my go.sum

Summary

Summary

Terrapin is a prefix truncation attack targeting the SSH protocol. More precisely, Terrapin breaks the integrity of SSH's secure channel. By carefully adjusting the sequence numbers during the handshake, an attacker can remove an arbitrary amount of messages sent by the client or server at the beginning of the secure channel without the client or server noticing it.

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.

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 (chacha20-poly1305@openssh.com) and Encrypt-then-MAC (*-etm@openssh.com 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 see https://terrapin-attack.com.

Impact

This attack targets the specification of ChaCha20-Poly1305 (chacha20-poly1305@openssh.com) and Encrypt-then-MAC (*-etm@openssh.com), 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.

Advisory Timeline

  • First published December 18, 2023 (1074 days ago).
  • Last revised September 10, 2026 — 996 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update russh to 0.40.2 or later
cargo update -p russh --precise 0.40.2
Go
Update golang.org/x/crypto to 0.0.0-20231218163308-9d2ee975ef9f or later
go get golang.org/x/crypto@v0.0.0-20231218163308-9d2ee975ef9f
pip
Update paramiko to 3.4.0 or later
pip install "paramiko>=3.4.0"
Go
Update golang.org/x/crypto to 0.17.0 or later
go get golang.org/x/crypto@v0.17.0

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (4)

Affects 3 ecosystems: crates.io (1), Go (1), PyPI (1).

PackageFixed In
russh crates.io · Affected: All versions0.40.2
golang.org/x/crypto Go · Affected: All versions0.0.0-20231218163308-9d2ee975ef9f
paramiko PyPI · Affected: 2.10.0, 2.10.1, 2.10.2, 2.10.3 (+26 more)3.4.0
golang.org/x/crypto Go · Affected: All versions0.17.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 5.9 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

References

Frequently Asked Questions

What is CVE-2023-48795?
Prefix Truncation Attack against ChaCha20-Poly1305 and Encrypt-then-MAC aka Terrapin. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 5.9/10).
How do I check if my project is affected by CVE-2023-48795?
CVE-2023-48795 affects russh, golang.org/x/crypto and paramiko. It has a 35.8% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2023-48795 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
5.9

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
35.76%
EPSS percentile: 98.8

This places it in the top 5% of EPSS-scored vulnerabilities — 98.8% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.

Also Known As

GHSA-45x7-px36-x8w8
GO-2023-2402
PYSEC-2026-1758

Related CVEs

  • CVE-2024-45337
    CRITICAL

    Misuse of ServerConfig.PublicKeyCallback may cause authorization bypass in golang.org/x/crypto

  • CVE-2026-39830
    CRITICAL

    golang.org/x/crypto: Invoking client can cause server deadlock on unexpected responses

  • CVE-2024-43410
    HIGH

    Memory exhaustion from an unchecked SSH packet length

  • CVE-2026-46673
    HIGH

    Unbounded 32-bit allocation

  • CVE-2026-102823
    HIGH

    Client `Handler` callbacks run for channels the client never opened

  • CVE-2024-43410
    HIGH

    Russh has an OOM Denial of Service due to allocation of untrusted amount

  • CVE-2026-116794
    HIGH

    russh: Agent server never calls `Agent::confirm`, so keys added with the confirm constraint (`ssh-add -c`) sign without confirmation

  • CVE-2026-56855

    Prevent DoS on deadlocked established channel in golang.org/x/crypto/ssh

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my go.sum