# SSH Algorithm Enumeration and Weak Crypto Detection

- **URL:** https://hackindex.io/services/ssh/enumeration/ssh-algorithm-enumeration-weak-crypto
- **Path:** SSH > Enumeration
- **Up:** [Enumeration](https://hackindex.io/services/ssh/enumeration.md)
- **Published:** 2026-01-03
- **Updated:** 2026-01-04

Enumerate KEX, ciphers, MACs, and hostkey algorithms to identify legacy crypto support and hardening gaps.

## What you are mapping

This page is about what the SSH service is willing to negotiate. You are building a capability profile that drives decisions:

Legacy support is often the real finding, not a specific exploit. If a server still accepts weak KEX or CBC, it usually means hardening is absent or drifted. It also explains client errors and tells you whether older tooling will work.

Signals that are typically worth documenting:

- `diffie-hellman-group1-sha1`
- SHA1-based MACs like `hmac-sha1`
- CBC ciphers
- legacy hostkey algorithms and weak key sizes
- RSA host keys under 2048 bits
- anything indicating SSHv1 support

## SSH Cipher and Key Exchange Enumeration with Nmap

This gives you the raw advertised lists. It is fast, reliable, and easy to paste into notes.

```bash
nmap -p $PORT -vv --script ssh2-enum-algos $TARGET_IP
# PORT   STATE SERVICE
# 22/tcp open  ssh
# | ssh2-enum-algos:
# |   kex_algorithms (4)
# |       diffie-hellman-group-exchange-sha256
# |       diffie-hellman-group-exchange-sha1
# |       diffie-hellman-group14-sha1
# |       diffie-hellman-group1-sha1
# |   server_host_key_algorithms (2)
# |       ssh-rsa
# |       ssh-dss
# |   encryption_algorithms (13)
# |       aes128-ctr
# |       aes192-ctr
# |       aes256-ctr
# |       arcfour256
# |       arcfour128
# |       aes128-cbc
# |       3des-cbc
# |       blowfish-cbc
# |       cast128-cbc
# |       aes192-cbc
# |       aes256-cbc
# |       arcfour
# |       rijndael-cbc@lysator.liu.se
# |   mac_algorithms (6)
# |       hmac-md5
# |       hmac-sha1
# |       hmac-ripemd160
# |       hmac-ripemd160@openssh.com
# |       hmac-sha1-96
# |       hmac-md5-96
# |   compression_algorithms (2)
# |       none
# |_      zlib@openssh.com
```

A common pattern on older appliances is “modern enough to connect” but still advertising group1 and CBC for compatibility. That is usually a hardening finding even if you never weaponize it.

## SSHv1 check

SSHv1 is rare. If it is enabled, capture it clearly. That is not “legacy for compatibility”, it is a serious misconfiguration.

```bash
nmap -p $PORT --script sshv1 $TARGET_IP
# PORT   STATE SERVICE
# 22/tcp open  ssh
# |_sshv1: Server supports SSHv1
```

## Fast interpretation with ssh-audit

`ssh-audit` is useful when you want a quick “what is weak here” view and a clean write-up structure for your report notes.

```bash
ssh-audit -p $PORT $TARGET_IP
```

This is also the quickest way to spot policy-level issues like deprecated algorithms being offered, weak host key types, or suspicious server versions.

## Handshake-driven confirmation from a real SSH client

If you hit negotiation errors, do not guess. Confirm what fails and what succeeds.

```bash
ssh -vvv -p $PORT -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $USERNAME@$TARGET_IP exit
```

When you see errors like “no matching key exchange method found”, that typically means the server is stuck on older KEX choices or your client is refusing legacy algorithms. Confirm the exact algorithm set with `ssh2-enum-algos` and record it.

Phase boundary note: forcing very specific downgrade combinations to make a connection succeed can stay “enumeration” if you only prove acceptance. Turning that into interception or credential capture work is not enumeration and should be a separate exploitation page.

## References

- [Nmap NSE ssh2-enum-algos](https://nmap.org/nsedoc/scripts/ssh2-enum-algos.html) - Enumerates SSH2 KEX, ciphers, MACs, compression, and hostkey algorithms.
- [Nmap NSE sshv1](https://nmap.org/nsedoc/scripts/sshv1.html) - Checks for SSH V1 support
- [ssh-audit](https://github.com/jtesta/ssh-audit) - SSH configuration audit with weak algorithm reporting.
