Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Terrapin (CVE-2023-48795) is a prefix truncation attack on SSH that lets a machine-in-the-middle silently delete messages from the start of a session and downgrade its security features.

What Is the Terrapin Attack?
Terrapin, published on 18 December 2023 by Fabian Bäumer and Marcus Brinkmann of Ruhr University Bochum, is the first practically exploitable attack on the integrity of the SSH protocol’s transport layer. Tracked as CVE-2023-48795, it allows an attacker positioned between client and server to delete a chosen number of messages from the very start of the encrypted session without either side noticing.
It does not recover the session key or decrypt traffic. What it achieves is subtler: by removing specific handshake messages, the attacker can silently turn off security features that both parties believe are active.
SSH wraps every message in a Binary Packet Protocol record, and each record carries an implicit sequence number used in integrity checking. The sequence counter starts at zero with the first packet sent and keeps incrementing across the transition from unencrypted handshake to encrypted session; it is not reset when encryption begins.
Some handshake messages are optional and unauthenticated. The attacker inserts extra packets, such as the ignorable SSH_MSG_IGNORE, during the unencrypted phase, which pushes the counter forward on one side. They then delete an equal number of messages from the beginning of the encrypted session. The two adjustments cancel out, the sequence numbers still line up, the integrity check still passes, and the deleted messages are simply gone.
The attack works only where the integrity mechanism is sensitive to this manipulation. Two cases qualify:
[email protected], which derives its nonce directly from the sequence number;[email protected] MAC variants.AES-GCM and CTR-mode ciphers with standard MACs are not affected.
The first message after key exchange is usually SSH_MSG_EXT_INFO, which carries extension negotiation. Removing it has real consequences. In OpenSSH, it disables the keystroke timing obfuscation introduced in version 9.5, which exists to frustrate inference of typed passwords from packet timing. It can also strip the server-sig-algs extension, forcing a client to fall back to weaker signature algorithms for public key authentication.
In some third-party implementations the consequences were worse. AsyncSSH was found to have related flaws, CVE-2023-46445 and CVE-2023-46446, where truncation could be combined with the library’s state handling to redirect a client into an attacker-chosen session, which is a genuine authentication bypass rather than a downgrade.
Terrapin needs an active machine-in-the-middle position on the TCP connection. An attacker who already has that can attempt many other things, so the practical risk depends on where your SSH traffic travels: across the public internet to a jump host, through a third-party network, or over an untrusted hotel or conference connection.
Scans in December 2023 suggested that around 11 million internet-facing SSH servers, roughly 52% of those sampled, supported a vulnerable mode. Vulnerable configuration is not the same as compromise, and there are no confirmed reports of Terrapin being used in intrusions. Treat it as a hygiene item with a clear fix rather than an emergency.
The protocol-level remedy is the “strict KEX” countermeasure, negotiated through the pseudo-algorithms [email protected] and [email protected]. When both sides support it, two things change: unexpected messages during key exchange cause the connection to be terminated rather than ignored, and the sequence number is reset to zero after key exchange completes. Either change alone defeats the attack.
Practical steps:
x/crypto/ssh, and the SSH stacks embedded in network appliances and managed file transfer products.[email protected] and the -etm MACs from the configuration and prefer [email protected].Appliances are where this tends to linger. Load balancers, storage controllers, and OT gateways often run an old embedded SSH stack with no independent update path, and they are the hosts least likely to appear in a patching report. Our Infrastructure Security Testing Services enumerate the actual algorithms each endpoint negotiates, which is the only way to know what your estate really offers.
No. Terrapin breaks integrity rather than confidentiality: it removes messages from the start of the session but does not decrypt anything or recover keys. The damage comes from what those deleted messages would have enabled, such as extension negotiation and keystroke timing obfuscation. In certain third-party libraries, the truncation could be chained into more serious authentication problems.
Connections negotiating [email protected], or a CBC-mode cipher with an Encrypt-then-MAC algorithm ending in [email protected]. AES-GCM and CTR-mode ciphers with conventional MACs are not vulnerable. Because ChaCha20-Poly1305 was a common default, a large share of internet-facing servers supported an affected mode when the research was published in December 2023.
Yes. Strict key exchange is negotiated, so it only takes effect when both ends support it. A patched server talking to an old client still falls back to the vulnerable behaviour. Include PuTTY, WinSCP, CI runners, deployment tooling, and any application library that speaks SSH, not only the OpenSSH packages on your Linux servers.
The research team published a Terrapin scanner that connects to an endpoint and reports whether it offers strict key exchange and which ciphers and MACs it supports. You can also inspect the key exchange algorithm list directly with ssh -vv or nmap’s ssh2-enum-algos script and look for the kex-strict pseudo-algorithm in the server’s proposal.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.