Course contentsShow
← Security
Lesson 1446 of 3,05229. Operating System Security - HardeningFree lesson

SSH Protocol Version and Cipher Selection

Ensure Protocol 2 only, disable weak ciphers/MACs/key exchanges, and configure strong cryptographic algorithms.

SSH Protocol Version and Cipher Selection

You'll learn: How to lock SSH to the secure Protocol 2 and configure strong cryptographic algorithms while disabling weak ciphers, MACs, and key exchanges.


Why This Matters

Not all SSH encryption is created equal. Older protocol versions and weak cryptographic algorithms have known vulnerabilities that attackers can exploit. Think of it like locking your door: using SSH Protocol 1 is like using a lock whose blueprints are public, while Protocol 2 with modern ciphers is a high-security deadbolt that resists picking.

Core Concepts

Protocol Version: SSH Protocol 1 has known design flaws and should never be used. Protocol 2 is mandatory for secure communication. In /etc/ssh/sshd_config, enforce this:

Protocol 2

Cipher Selection: Weak ciphers like arcfour, 3des-cbc, or blowfish are cryptographically broken or vulnerable. You should explicitly specify strong ciphers:

Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com

Message Authentication Codes (MACs): These verify message integrity. Disable weak MACs like MD5 variants:

MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com

Key Exchange Algorithms: Control which key exchange methods are allowed:

KexAlgorithms curve25519-sha256,diffie-hellman-group-exchange-sha256

Configuration Strategy

Review your current SSH configuration, identify weak algorithms using security scanning tools, and explicitly allowlist only modern, vetted cryptographic primitives. Remove support for legacy clients if your environment permits.

Key Takeaway: Enforce SSH Protocol 2 only and explicitly configure strong ciphers, MACs, and key exchange algorithms to eliminate cryptographic weaknesses and protect your SSH sessions from known attacks.