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 Software | Affected Version | How to fix |
---|---|---|
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 |
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 |
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 | =7.2.0 | |
Ssh2 Project Ssh2 | <=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 | |
Microsoft Windows Server 2022 | =6.0 | |
Redhat Enterprise Linux | =8.0 | |
Redhat Enterprise Linux | =9.0 | |
Redhat Openshift Serverless | ||
IETF HTTP/2 | ||
Microsoft .NET 7.0 | ||
Microsoft Windows Server 2022 | ||
Redhat Openshift Data Foundation | =4.0 | |
IETF HTTP/2 | ||
Microsoft Windows 11 | =4 | |
Redhat Storage | =3.0 | |
Redhat Discovery | ||
Microsoft Windows Server 2022 | ||
Microsoft Windows Server 2016 | ||
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 | <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 | |
Kitty Project Kitty | <=0.76.1.13 | |
All of | ||
Gentoo Security | ||
Debian Debian Linux | ||
debian/dropbear | 2018.76-5+deb10u1 2018.76-5+deb10u2 2020.81-3+deb11u1 2022.83-1+deb12u1 2024.84-1 | |
debian/erlang | <=1:21.2.6+dfsg-1<=1:22.2.7+dfsg-1+deb10u1<=1:23.2.6+dfsg-1+deb11u1<=1:25.2.3+dfsg-1 | 1:25.3.2.8+dfsg-1 1:25.3.2.11+dfsg-1 |
debian/filezilla | 3.39.0-2+deb10u1 3.52.2-3+deb11u1 3.63.0-1+deb12u3 3.66.5-2 3.67.0-1 | |
debian/golang-go.crypto | <=1:0.0~git20181203.505ab14-1<=1:0.0~git20181203.505ab14-1+deb10u1<=1:0.0~git20201221.eec23a3-1<=1:0.4.0-1 | 1:0.21.0-1 |
debian/jsch | 0.1.55-1 | |
debian/libssh | <=0.8.7-1+deb10u1<=0.8.7-1+deb10u2 | 0.9.8-0+deb11u1 0.10.6-0+deb12u1 0.10.6-2 |
debian/libssh2 | 1.8.0-2.1 1.8.0-2.1+deb10u1 1.9.0-2 1.10.0-3 1.11.0-4.1 | |
debian/openssh | <=1:7.9p1-10+deb10u2 | 1:7.9p1-10+deb10u4 1:8.4p1-5+deb11u3 1:9.2p1-2+deb12u2 1:9.6p1-4 1:9.7p1-4 |
debian/paramiko | <=2.7.2-1<=2.12.0-2<=2.12.0-3 | 2.4.2-0.1 2.4.2-0.1+deb10u1 |
debian/php-phpseclib | <=2.0.14-1 | 2.0.30-2~deb10u3 2.0.30-2+deb11u1 2.0.42-1+deb12u1 2.0.47-1 |
debian/php-phpseclib3 | 3.0.19-1+deb12u2 3.0.37-1 | |
debian/phpseclib | <=1.0.14-1 | 1.0.19-3~deb10u3 1.0.19-3+deb11u1 1.0.20-1+deb12u1 1.0.23-1 |
debian/proftpd-dfsg | <=1.3.6-4+deb10u6<=1.3.6-4+deb10u4<=1.3.7a+dfsg-12+deb11u2 | 1.3.8+dfsg-4+deb12u3 1.3.8.b+dfsg-1 1.3.8.b+dfsg-2 |
debian/proftpd-mod-proxy | <=0.7-1 | 0.9.2-1+deb12u1 0.9.3-1 |
debian/putty | <=0.70-6 | 0.74-1+deb11u1 0.78-2+deb12u1 0.80-1 0.81-1 |
debian/python-asyncssh | <=1.12.2-1<=2.5.0-0.1<=2.10.1-2 | 1.12.2-1+deb10u1 |
debian/tinyssh | <=20190101-1<=20190101-1+deb11u1<=20230101-1 | 20240101-3 |
debian/trilead-ssh2 | <=6401+svn158-1<=6401+svn158-1.1 | |
ubuntu/filezilla | <3.46.3-1ubuntu0.1 | 3.46.3-1ubuntu0.1 |
ubuntu/filezilla | <3.58.0-1ubuntu0.1 | 3.58.0-1ubuntu0.1 |
ubuntu/filezilla | <3.65.0-3ubuntu0.1 | 3.65.0-3ubuntu0.1 |
ubuntu/filezilla | <3.66.4. | 3.66.4. |
ubuntu/libssh | <0.9.3-2ubuntu2.4 | 0.9.3-2ubuntu2.4 |
ubuntu/libssh | <0.9.6-2ubuntu0.22.04.2 | 0.9.6-2ubuntu0.22.04.2 |
ubuntu/libssh | <0.10.4-2ubuntu0.2 | 0.10.4-2ubuntu0.2 |
ubuntu/libssh | <0.10.5-3ubuntu1.1 | 0.10.5-3ubuntu1.1 |
ubuntu/libssh | <0.10.6-1 | 0.10.6-1 |
ubuntu/libssh2 | <1.11.0-2ubuntu0.1 | 1.11.0-2ubuntu0.1 |
ubuntu/libssh2 | <1.11.0-4 | 1.11.0-4 |
ubuntu/lxd | <3.0.3-0ubuntu1~18.04.2+ | 3.0.3-0ubuntu1~18.04.2+ |
ubuntu/lxd | <2.0.11-0ubuntu1~16.04.4+ | 2.0.11-0ubuntu1~16.04.4+ |
ubuntu/openssh | <1:7.6 | 1:7.6 |
ubuntu/openssh | <1:8.2 | 1:8.2 |
ubuntu/openssh | <1:8.9 | 1:8.9 |
ubuntu/openssh | <1:9.0 | 1:9.0 |
ubuntu/openssh | <1:9.3 | 1:9.3 |
ubuntu/openssh | <1:9.5 | 1:9.5 |
ubuntu/openssh | <1:7.2 | 1:7.2 |
ubuntu/paramiko | <2.6.0-2ubuntu0.3 | 2.6.0-2ubuntu0.3 |
ubuntu/paramiko | <2.9.3-0ubuntu1.2 | 2.9.3-0ubuntu1.2 |
ubuntu/paramiko | <2.12.0-2ubuntu1.23.10.2 | 2.12.0-2ubuntu1.23.10.2 |
ubuntu/putty | <0.80-1 | 0.80-1 |
ubuntu/python-asyncssh | <2.14.2 | 2.14.2 |
https://github.com/net-ssh/net-ssh/blob/2e65064a52d73396bfc3806c9196fc8108f33cd8/CHANGES.txt#L14-L16
https://nest.pijul.com/pijul/thrussh/changes/D6H7OWTTMHHX6BTB3B6MNBOBX2L66CBL4LGSEUSAI2MCRCJDQFRQC
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=9e099151574885f3c717ac10a633a9218db8e7bb
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=f2e7086902b3605c96e54ef9c956ca7ab000010e
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=9fcbb86f715bc03e58921482efe663aa0c662d62
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=244be5412728a7334a2d457fbac4e0a2597165e5
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=58fc33a155ad496bdcf380fa6193302240a15ae9
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=0b00e4ce26d89cd010e31e66fd02ac77cb982367
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=fdc891d17063ab26cf68c74245ab1fd9771556cb
https://git.tartarus.org/?p=simon/putty.git;a=commit;h=b80a41d386dbfa1b095c17bd2ed001477f302d46
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
(Appears in the following advisories)
(Found alongside the following vulnerabilities)