Skip to content
Crypto Write-up Advanced

Terrapin Attack

The Terrapin attack exploits weaknesses in the SSH protocol's sequence number handling to allow a man-in-the-middle attacker to remove messages from the beginning of the encrypted channel without detection. This can downgrade security by truncating extension negotiation, potentially enabling less secure authentication algorithms and deactivating keystroke timing countermeasures.

Fabian Bäumer Follow

Published on terrapin-attack.com

SSH is an internet standard that provides secure access to network services, particularly remote terminal login and file transfer within organizational networks and to over 15 million servers on the open internet.

Fabian Bäumer, Marcus Brinkmann, Jörg Schwenk, on terrapin-attack.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The SSH protocol does not reset sequence numbers when encryption starts, allowing an attacker to inject an ignored packet during the handshake to offset sequence numbers and then delete messages without detection.

Impact

The attack can downgrade connection security by truncating extension negotiation, potentially enabling less secure client authentication algorithms and deactivating keystroke timing countermeasures in OpenSSH 9.5; it can also enable exploitation of implementation flaws like those in AsyncSSH, but requires a man-in-the-middle position and specific encryption modes.

What the attacker needed

Man-in-the-middle network position; Connection uses ChaCha20-Poly1305 or CBC with…

The fix

The vulnerability is addressed by an optional strict key exchange extension that resets sequence numbers and prevents packet injection during the initial handshake, but it requires both client and server to support it.

How it was found

  1. The attacker intercepts the SSH connection between client and server.
  2. During the handshake, the attacker injects an ignored packet to manipulate sequence numbers.
  3. The attacker drops the EXT_INFO message from the server to the client.
  4. The client does not notice the deletion because sequence numbers are now offset.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

SSH is a protocol for securely connecting to remote computers. The Terrapin attack lets someone who can intercept network traffic secretly delete some of the first messages in an SSH connection, making the connection less secure. This requires the attacker to be in the middle of the connection and the use of certain encryption modes.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.