Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is the Terrapin Attack?

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.

Illustration for the cybersecurity term Terrapin Attack
Home / Blog / Cybersecurity Terms / What Is the Terrapin Attack?
17 November 2026

What Is the Terrapin Attack?

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.

Sequence Numbers That Nobody Checks

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:

AES-GCM and CTR-mode ciphers with standard MACs are not affected.

What Deleting a Message Achieves

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.

How Worried Should You Be?

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 Fix: Strict Key Exchange

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:

  1. Upgrade to OpenSSH 9.6 or later, released the same day as the disclosure, and update clients as well as servers; strict KEX only applies when both ends implement it.
  2. Patch third-party implementations, including PuTTY 0.80, libssh 0.10.6 and 0.9.8, AsyncSSH 2.14.2, Golang x/crypto/ssh, and the SSH stacks embedded in network appliances and managed file transfer products.
  3. Where upgrading is not yet possible, remove [email protected] and the -etm MACs from the configuration and prefer [email protected].
  4. Verify with the researchers’ Terrapin scanner, which reports whether a given endpoint supports strict KEX.

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.

FAQ – Frequently Asked Questions

Does Terrapin Let an Attacker Read My SSH Traffic?

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.

Which SSH Configurations Are Affected?

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.

Do I Need to Patch Clients as Well as Servers?

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.

How Can I Test Whether an SSH Server Is Still Vulnerable?

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.

Related Terms

You May Be Interested In These

What Is a Model Card?

Cybersecurity Terms

17 November 2026

What Is a Model Card?

Read More
What Is NIST SP 800-82?

Cybersecurity Terms

17 November 2026

What Is NIST SP 800-82?

Read More