# CVE-2023-48795: Prefix Truncation Attack against ChaCha20-Poly1305 and Encrypt-then-MAC aka Terrapin

> Remote attackers can bypass SSH integrity checks to downgrade security features or disable encryption during the handshake phase.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Dec 2023
- **Updated:** 15 Oct 2026
- **Also known as:** ALPINE-CVE-2023-48795, ALSA-2024:0628, ALSA-2024:1150, AZL-32195, AZL-32196, AZL-32200, AZL-32201, AZL-32202, AZL-32204, AZL-32221, AZL-32222, AZL-32223, AZL-32224, AZL-32225, AZL-32229, AZL-32259, AZL-32280, AZL-34581, AZL-34589, AZL-34673, AZL-34901, AZL-34906, AZL-34941, AZL-34944, AZL-35030, AZL-35099, AZL-35435, AZL-35443, AZL-36944, AZL-36983, AZL-37154, AZL-43762, AZL-43951, AZL-45123, AZL-45303, AZL-61246, BELL-CVE-2023-48795, CLEANSTART-2024-AM41653, CLEANSTART-2024-IU89203, CLEANSTART-2026-JG31127, CLEANSTART-2026-SF69821, CLEANSTART-2026-VX47769, CLSA-2024-1707420183, CLSA-2024-1707420378, CLSA-2024-1707919380, CLSA-2024-1708427752, CLSA-2024-1708638566, CLSA-2024-1718288901, CLSA-2024-1718290223, CLSA-2024-1718791502, CLSA-2024-1718796706, CLSA-2025-1758154333, DEBIAN-CVE-2023-48795, DLA-3718-1, DLA-3719-1, DLA-3730-1, DSA-5588-1, DSA-5599-1, DSA-5600-1, DSA-5601-1, DSA-5750-1, GHSA-45x7-px36-x8w8, GO-2023-2402, JLSEC-2025-95, MGASA-2023-0356, MGASA-2024-0002, MGASA-2024-0003, MGASA-2024-0004, MGASA-2024-0015, MGASA-2024-0034, MGASA-2026-0066, MGASA-2026-0179, MGASA-2026-0182, MINI-f9gc-qfc7-p228, MINI-r2v3-8h7f-f6g4, OESA-2024-1027, OESA-2024-1048, OESA-2024-1059, OESA-2024-1060, OESA-2024-1061, OESA-2024-1065, OESA-2024-1066, OESA-2024-1081, OESA-2024-1082, OESA-2024-1101, OESA-2024-1104, OESA-2024-1122, OESA-2024-1461, PYSEC-2026-1758, RHBA-2024:1127, RHBA-2024:1136, RHLW-2026-d0749bc5ef98b166, RHSA-2024:0499, RHSA-2024:0625, RHSA-2024:0628, RHSA-2024:1150, RHSA-2024:1196, RHSA-2024:2735, RHSA-2024:2768, RHSA-2024:3918, RLSA-2024:0628, ROOT-APP-PYPI-CVE-2023-48795, SUSE-SU-2023:4902-1, SUSE-SU-2023:4903-1, SUSE-SU-2023:4904-1, SUSE-SU-2023:4905-1, SUSE-SU-2023:4946-1, SUSE-SU-2024:0006-1, SUSE-SU-2024:0035-1, SUSE-SU-2024:0210-1, SUSE-SU-2024:0327-1, SUSE-SU-2024:0430-1, SUSE-SU-2024:0460-1, SUSE-SU-2024:0543-1, SUSE-SU-2024:0558-1, SUSE-SU-2024:0972-1, SUSE-SU-2024:0974-1, UBUNTU-CVE-2023-48795, USN-6561-1, USN-6585-1, USN-6589-1, USN-6598-1, USN-6738-1, USN-7051-1, openSUSE-SU-2023:0411-1, openSUSE-SU-2023:0421-1, openSUSE-SU-2024:0005-1, openSUSE-SU-2024:0036-1, openSUSE-SU-2024:0135-1, openSUSE-SU-2024:13515-1, openSUSE-SU-2024:13517-1, openSUSE-SU-2024:13518-1, openSUSE-SU-2024:13522-1, openSUSE-SU-2024:13523-1, openSUSE-SU-2024:13530-1, openSUSE-SU-2024:13539-1, openSUSE-SU-2024:13565-1, openSUSE-SU-2024:13580-1, openSUSE-SU-2024:13592-1, openSUSE-SU-2024:13608-1, openSUSE-SU-2024:13628-1, openSUSE-SU-2024:13646-1, openSUSE-SU-2024:13652-1, openSUSE-SU-2024:13772-1, openSUSE-SU-2024:13776-1, openSUSE-SU-2024:13812-1, openSUSE-SU-2024:13979-1

## What is CVE-2023-48795?

CVE-2023-48795 is a medium-severity vulnerability in Apple Macos, published on 18 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The SSH transport protocol with certain OpenSSH extensions, found in OpenSSH before 9.6 and other products, allows remote attackers to bypass integrity checks such that some packets are omitted (from the extension negotiation message), and a client and server may consequently end up with a connection for which some security features have been downgraded or disabled, aka a Terrapin attack. This occurs because the SSH Binary Packet Protocol (BPP), implemented by these extensions, mishandles the handshake phase and mishandles use of sequence numbers. For example, there is an effective attack against SSH's use of ChaCha20-Poly1305 (and CBC with Encrypt-then-MAC). The bypass occurs in chacha20-poly1305@openssh.com and (if CBC is used) the -etm@openssh.com MAC algorithms. This also affects Maverick Synergy Java SSH API before 3.1.0-SNAPSHOT, Dropbear through 2022.83, Ssh before 5.1.1 in Erlang/OTP, PuTTY before 0.80, AsyncSSH before 2.14.2, golang.org/x/crypto before 0.17.0, libssh before 0.10.6, libssh2 through 1.11.0, Thorn Tech SFTP Gateway before 3.4.6, Tera Term before 5.1, Paramiko before 3.4.0, jsch before 0.2.15, SFTPGo before 2.5.6, Netgate pfSense Plus through 23.09.1, Netgate pfSense CE through 2.7.2, HPN-SSH through 18.2.0, ProFTPD before 1.3.8b (and before 1.3.9rc2), ORYX CycloneSSH before 2.3.4, NetSarang XShell 7 before Build 0144, CrushFTP before 10.6.0, ConnectBot SSH library before 2.2.22, Apache MINA sshd through 2.11.0, sshj through 0.37.0, TinySSH through 20230101, trilead-ssh2 6401, LANCOM LCOS and LANconfig, FileZilla before 3.66.4, Nova before 11.8, PKIX-SSH before 14.4, SecureCRT before 9.4.3, Transmit5 before 5.10.4, Win32-OpenSSH before 9.5.0.0p1-Beta, WinSCP before 6.2.2, Bitvise SSH Server before 9.32, Bitvise SSH Client before 9.33, KiTTY through 0.76.1.13, the net-ssh gem 7.2.0 for Ruby, the mscdex ssh2 module before 1.15.0 for Node.js, the thrussh library before 0.35.1 for Rust, and the Russh crate before 0.40.2 for Rust.

Weakness: CWE-354 (Improper Validation of Integrity Check Value)

## Which versions are affected by CVE-2023-48795?

10 open source packages ship an affected version, including golang.org/x/crypto, paramiko and russh. It affects 68 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20231218163308-9d2ee975ef9f |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20231218163308-9d2ee975ef9f |
| `golang.org/x/crypto` | Go | All versions | 0.17.0 |
| `golang.org/x/crypto` | Go | From 0.1.0 | 0.17.0 |
| `golang.org/x/crypto` | Go | From 0.1.0 | 0.17.0 |
| `paramiko` | PyPI | From 2.5.0 | 3.4.0 |
| `paramiko` | PyPI | From 2.5.0 | 3.4.0 |
| `paramiko` | PyPI | From 2.5.0 | 3.4.0 |
| `russh` | crates.io | All versions | 0.40.2 |
| `russh` | crates.io | All versions | 0.40.2 |
| `libssh` | AlmaLinux:8 | All versions | 0.9.6-13.el8_9 |
| `libssh-config` | AlmaLinux:8 | All versions | 0.9.6-13.el8_9 |
| `libssh-devel` | AlmaLinux:8 | All versions | 0.9.6-13.el8_9 |
| `buildah` | AlmaLinux:9 | All versions | 1:1.31.4-1.el9_3 |
| `buildah-tests` | AlmaLinux:9 | All versions | 1:1.31.4-1.el9_3 |
| `libssh-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-13.el8_9 |
| `libssh-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-13.el8_9 |
| `libssh-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-13.el8_9 |
| `libssh` | Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-13.el8_9 |
| `libssh-config` | Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-13.el8_9 |
| `libssh-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-13.el8_9 |
| `libssh-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-13.el8_9 |
| `buildah` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.31.4-1.el9_3 |
| `buildah-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.31.4-1.el9_3 |
| `buildah-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.31.4-1.el9_3 |
| `buildah-tests` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.31.4-1.el9_3 |
| `buildah-tests-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.31.4-1.el9_3 |
| `libssh-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.10.4-12.el9_3 |
| `libssh-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.10.4-12.el9_3 |
| `libssh-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 0:0.10.4-12.el9_3 |
| `podman` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-docker` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-gvproxy` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-gvproxy-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-plugins` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-plugins-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-remote` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |
| `podman-remote-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 2:4.6.1-8.el9_3 |

Products: 9bis Kitty, Apache Sshd, Apache Sshj, Apple Macos, Asyncssh Project Asyncssh, Bitvise Ssh Client, Bitvise Ssh Server, Connectbot Sshlib, Crates Thrussh, Crushftp Crushftp, Debian Debian Linux, Dropbear Ssh Project Dropbear Ssh, Erlang Erlang\/Otp, Fedoraproject Fedora, Filezilla-Project Filezilla Client, Freebsd Freebsd, Gentoo Security, Golang Crypto, Jadaptive Maverick Synergy Java Ssh Api, Lancom-Systems Lanconfig and 48 more.

## How do I fix CVE-2023-48795?

Upgrade golang.org/x/crypto to a fixed version for your release line: 0.0.0-20231218163308-9d2ee975ef9f or 0.17.0.

## Is CVE-2023-48795 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-48795 exists.

Public exploit code:

- A Python-based tool to check for vulnerabilities in OpenSSH installations on local or remote systems by scanning specific IPs. It checks if the OpenSSH version is affected by CVE-2023-48795 (github_poc): https://github.com/TrixSec/CVE-2023-48795
- Scanner para identificação de servidores com softwares SSH possivelmente vulnerável às CVEs CVE-2024-6387 e CVE-2023-48795. (github_poc): https://github.com/oseasfr/Scanner_CVE_OpenSSH
- https://github.com/Mr-Whiskerss/SSH-Terrapin-Prefix-Truncation-Weakness-CVE-2023-48795-Checker (github_poc): https://github.com/Mr-Whiskerss/SSH-Terrapin-Prefix-Truncation-Weakness-CVE-2023-48795-Checker
- Python tool to identify SSH servers potentially vulnerable to CVE-2023-48795 (Terrapin) by analyzing OpenSSH version banners via netcat. Useful for internal audits, penetration testing, and vulnerability assessments. (github_poc): https://github.com/hav0cx0/CVE-2023-48795
- https://github.com/breaksek/CVE-2023-48795 (github_poc): https://github.com/breaksek/CVE-2023-48795
- OpenSSH Terrapin Attack - Detection (nuclei)

## Other vulnerabilities in Apple Macos

- [CVE-2016-2563](https://insights.sbomify.com/CVE-2016-2563/): Memory corruption in n/a (critical 9.8)
- [CVE-2024-23749](https://insights.sbomify.com/CVE-2024-23749/): Command injection in n/a (high 7.8)
- [CVE-2024-25003](https://insights.sbomify.com/CVE-2024-25003/): Memory corruption in n/a (high 7.8)
- [CVE-2024-25004](https://insights.sbomify.com/CVE-2024-25004/): Memory corruption in n/a (high 7.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-48795 and fix it if it is affected.

What it is: CVE-2023-48795 is a medium-severity vulnerability in Apple Macos, published on 18 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-48795 exists.

Affected packages and fixed versions:
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20231218163308-9d2ee975ef9f
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20231218163308-9d2ee975ef9f
- golang.org/x/crypto (Go): affected all versions; fixed in 0.17.0
- golang.org/x/crypto (Go): affected from 0.1.0; fixed in 0.17.0
- golang.org/x/crypto (Go): affected from 0.1.0; fixed in 0.17.0
- paramiko (PyPI): affected from 2.5.0; fixed in 3.4.0
- paramiko (PyPI): affected from 2.5.0; fixed in 3.4.0
- paramiko (PyPI): affected from 2.5.0; fixed in 3.4.0
- russh (crates.io): affected all versions; fixed in 0.40.2
- russh (crates.io): affected all versions; fixed in 0.40.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-48795/ (Markdown: https://insights.sbomify.com/CVE-2023-48795/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-48795
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-48795
- OSV: https://osv.dev/vulnerability/CVE-2023-48795

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-48795/
Summaries are generated and may contain mistakes; the official description above is the record.
