SSH offers weak ciphers, MACs or key exchanges
- Check
ssh.weak_algorithms- Severity
- low
- Runs
- on the server, in the daily run of the agent
- Looks at
- Ciphers, MACs, KexAlgorithms set to known weak values
What the check looks at
The agent reads the effective Ciphers, MACs and KexAlgorithms of sshd (sshd -T) and fails when they
contain algorithms that are known to be weak, for example CBC-mode ciphers (aes128-cbc, 3des-cbc),
arcfour, MD5-based or 96-bit MACs (hmac-md5, hmac-sha1-96), and key exchanges with SHA-1 or small groups
(diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1).
Why it matters
Current OpenSSH releases do not offer these algorithms by default. They appear when someone added a
Ciphers or KexAlgorithms line years ago for an old client, or copied a hardening guide that is out of date.
None of them gives an attacker a direct way in, which is why the severity is low, but they weaken the
protection of the connection against an attacker who can record or tamper with the traffic, and old
compliance scanners flag them.
How to fix it
Find the lines:
sudo grep -rnE '^\s*(Ciphers|MACs|KexAlgorithms)' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/
sudo sshd -T | grep -E '^(ciphers|macs|kexalgorithms) '
Debian, Ubuntu and Alpine
Delete the lines and let the defaults apply. To drop single algorithms from the defaults, prefix the list
with -:
MACs -hmac-sha1*,umac-64*
This form leaves the rest of the default list in place and stays correct when a later OpenSSH release changes the defaults. Check and reload:
sudo sshd -t
sudo systemctl reload ssh # Debian, Ubuntu
sudo rc-service sshd reload # Alpine
RHEL, Rocky Linux and AlmaLinux
The algorithms come from the system-wide crypto policy, through
/etc/crypto-policies/back-ends/opensshserver.config. On RHEL 9 and later a file in /etc/ssh/sshd_config.d/
includes it. Remove your own Ciphers, MACs and KexAlgorithms lines and set the policy:
update-crypto-policies --show
sudo update-crypto-policies --set DEFAULT
sudo systemctl restart sshd
LEGACY turns old algorithms back on for the whole system; if a server shows weak algorithms, check whether
someone set it.
RHEL 8, Rocky Linux 8 and AlmaLinux 8 pass the policy to sshd as command line options ($CRYPTO_POLICY in
sshd.service). They override sshd_config, and a plain sshd -T does not show them. The list the running
server uses:
sudo sh -c '. /etc/crypto-policies/back-ends/opensshserver.config; sshd -T $CRYPTO_POLICY' | grep -E '^(ciphers|macs|kexalgorithms) '
The DEFAULT policy of RHEL 8 still offers aes256-cbc, aes128-cbc, diffie-hellman-group14-sha1 and
diffie-hellman-group-exchange-sha1. The shipped NO-SHA1 module removes the two SHA-1 key exchanges; a small
module of your own removes the CBC ciphers for SSH only:
echo 'cipher@SSH = -AES-256-CBC -AES-128-CBC' | sudo tee /etc/crypto-policies/policies/modules/NO-SSH-CBC.pmod
sudo update-crypto-policies --set DEFAULT:NO-SHA1:NO-SSH-CBC
sudo systemctl restart sshd
NO-SHA1 drops SHA-1 hashes and signatures for the whole system (hash = -SHA1, sign = -*-SHA1); test
connections from old clients before you roll it out. In a test on Rocky Linux 8.10 (crypto-policies 20230731), the three lines left
aes256-gcm@openssh.com, chacha20-poly1305@openssh.com, aes256-ctr, aes128-gcm@openssh.com and
aes128-ctr, and none of the SHA-1 key exchanges.
How to check the fix
sudo sshd -T | grep -E '^(ciphers|macs|kexalgorithms) '
On RHEL 8, use the command with $CRYPTO_POLICY from the section above.
From another machine, ssh -vv user@server 2>&1 | grep -E 'kex: algorithm|cipher:' shows what a client and
the server agreed on. Tools such as ssh-audit list everything a server offers.
When a warning is fine
When an old client or device must connect (an old network switch, a backup appliance) and cannot be updated.
sshd cannot offer an algorithm to one client only: Ciphers, MACs and KexAlgorithms are not allowed in a
Match block (sshd -t refuses them there). The old algorithm is then offered to everyone, so allow only the
address of that device to reach the SSH port in the firewall, accept the result on the dashboard, and plan to
replace the device.
An accepted result is left out of the digest and the counts until it changes; then it shows again.
Sources
- sshd_config(5) — default lists of
Ciphers,MACs,KexAlgorithms, the+,-and^prefixes - OpenSSH release notes — algorithms removed or disabled over time
- crypto-policies — system-wide policies on RHEL and Fedora, policy modules (
.pmod) - Tested on 2026-11-26 in
rockylinux/rockylinux:8.10.20240528with openssh-server 8.0p1-35.el8_10 and crypto-policies 20230731:sshd.servicewith$CRYPTO_POLICY, theDEFAULT,DEFAULT:NO-SHA1and module lists,Ciphersin aMatchblock (Directive 'Ciphers' is not allowed within a Match block) - ssh-audit — audit of SSH server algorithms