CWE
345 354
Advisory Published
CVE Published
Advisory Published
Updated

CVE-2023-48795: Prefix Truncation Attacks in SSH Specification (Terrapin Attack)

First published: Tue Dec 12 2023(Updated: )

### 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](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.

Credit: cve@mitre.org cve@mitre.org CVE-2023-48795 CVE-2023-51384 CVE-2023-51385

Affected SoftwareAffected VersionHow to fix
Openbsd Openssh<9.6
Putty Putty<0.80
Filezilla-project Filezilla Client<3.66.4
Microsoft PowerShell<=11.1.0
All of
Panic Transmit 5<5.10.4
Apple macOS
All of
Panic Nova<11.8
Apple macOS
Roumenpetrov Pkixssh<14.4
Winscp Winscp<6.2.2
Bitvise SSH Client<9.33
Bitvise SSH Server<9.32
Lancom-systems Lcos<=3.66.4
Lancom-systems Lcos Fx
Lancom-systems Lcos Lx
Lancom-systems Lcos Sx=4.20
Lancom-systems Lcos Sx=5.20
Lancom-systems Lanconfig
Vandyke Securecrt<9.4.3
Libssh Libssh<0.10.6
Net-ssh Net-ssh Ruby=7.2.0
Ssh2 Project Ssh2 Node.js<=1.11.0
Proftpd Proftpd<=1.3.8b
FreeBSD FreeBSD<=12.4
Crates Thrussh<0.35.1
Tera Term Project Tera Term<=5.1
Oryx-embedded Cyclone Ssh<2.3.4
CrushFTP CrushFTP<=10.6.0
NetSarang XShell 7<build__0144
Paramiko Paramiko<3.4.0
Redhat Openshift Container Platform=4.0
Redhat Openstack Platform=16.1
Redhat Openstack Platform=16.2
Redhat Openstack Platform=17.1
Redhat Ceph Storage=6.0
Redhat Enterprise Linux=8.0
Redhat Enterprise Linux=9.0
Redhat Openshift Serverless
Redhat Openshift Gitops
Redhat Openshift Pipelines
Redhat Openshift Developer Tools And Services
Redhat Openshift Data Foundation=4.0
Redhat Openshift Api For Data Protection
Redhat Openshift Virtualization=4
Redhat Storage=3.0
Redhat Discovery
Redhat Openshift Dev Spaces
Redhat Cert-manager Operator For Red Hat Openshift
Redhat Keycloak
Redhat Jboss Enterprise Application Platform=7.0
Redhat Single Sign-on=7.0
Redhat Advanced Cluster Security=3.0
Redhat Advanced Cluster Security=4.0
Golang Crypto<0.17.0
Russh Project Russh Rust<0.40.2
Sftpgo Project Sftpgo<2.5.6
Erlang Erlang\/otp<26.2.1
Matez Jsch<0.2.15
Libssh2 Libssh2<1.11.10
Asyncssh Project Asyncssh<2.14.2
Dropbear Ssh Project Dropbear Ssh<2022.83
Jadaptive Maverick Synergy Java Ssh Api<3.1.0-snapshot
Ssh Ssh<5.11
Thorntech Sftp Gateway Firmware<3.4.6
Netgate pfSense Plus<=23.09.1
Netgate pfSense CE<=2.7.2
CrushFTP CrushFTP<10.6.0
Connectbot Sshlib<2.2.22
Apache Sshd<=2.11.0
Apache Sshj<=0.37.0
Tinyssh Tinyssh<=20230101
Trilead Ssh2=6401
9bis Kitty<=0.76.1.13
All of
Gentoo Security
Debian Debian Linux
Fedoraproject Fedora=38
Fedoraproject Fedora=39
Debian Debian Linux=10.0
Apple macOS>=14.0<14.4
pip/paramiko>=2.5.0<3.4.0
3.4.0
go/golang.org/x/crypto<0.17.0
0.17.0
rust/russh<0.40.2
0.40.2
Apple macOS Sonoma<14.4
14.4
IBM Concert Software<=1.0.0 - 1.0.1
redhat/PuTTY<0.80
0.80
redhat/AsyncSSH<2.14.1
2.14.1
redhat/libssh<0.9.8
0.9.8
redhat/libssh<0.10.6
0.10.6
redhat/golang.org/x/crypto/ssh<0.17.0
0.17.0
debian/dropbear
2020.81-3+deb11u2
2022.83-1+deb12u2
2024.86-1
debian/erlang<=1:23.2.6+dfsg-1+deb11u1<=1:25.2.3+dfsg-1
1:25.3.2.12+dfsg-3
debian/filezilla
3.52.2-3+deb11u1
3.63.0-1+deb12u3
3.68.0-1
debian/golang-go.crypto<=1:0.0~git20201221.eec23a3-1<=1:0.4.0-1
1:0.25.0-1
debian/jsch
0.1.55-1
0.2.19-1
debian/libssh
0.9.8-0+deb11u1
0.10.6-0+deb12u1
0.11.1-1
debian/libssh2
1.9.0-2+deb11u1
1.10.0-3
1.11.1-1
debian/openssh
1:8.4p1-5+deb11u3
1:9.2p1-2+deb12u3
1:9.9p1-3
debian/paramiko<=2.7.2-1<=2.12.0-2
3.4.1-2
debian/php-phpseclib
2.0.30-2+deb11u2
2.0.30-2+deb11u1
2.0.42-1+deb12u2
2.0.42-1+deb12u1
2.0.47-3
debian/php-phpseclib3
3.0.19-1+deb12u3
3.0.19-1+deb12u2
3.0.42-1
debian/phpseclib
1.0.19-3+deb11u2
1.0.19-3+deb11u1
1.0.20-1+deb12u2
1.0.20-1+deb12u1
1.0.23-3
debian/proftpd-dfsg<=1.3.7a+dfsg-12+deb11u2
1.3.8+dfsg-4+deb12u3
1.3.8.b+dfsg-4
debian/proftpd-mod-proxy<=0.7-1
0.9.2-1+deb12u1
0.9.4-1
debian/putty
0.74-1+deb11u2
0.74-1+deb11u1
0.78-2+deb12u2
0.78-2+deb12u1
0.81-3
debian/python-asyncssh<=2.5.0-0.1
2.5.0-0.1+deb11u1
2.10.1-2+deb12u1
2.18.0-1
debian/tinyssh<=20190101-1+deb11u1<=20230101-1
20241111-1
debian/trilead-ssh2<=6401+svn158-1.1

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Reference Links

Parent vulnerabilities

(Appears in the following advisories)

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203