SSH Offers Weak Cryptography
Checks the SSH ciphers, MACs, key exchange and host key algorithms for outdated choices.
- Why It Matters
- CBC-mode ciphers, RC4, MD5/SHA-1 MACs and 1024-bit Diffie-Hellman have known practical weaknesses. Offering them lets a network attacker downgrade or weaken the session.
- How It Detects
- Reads ciphers, macs, kexalgorithms and hostkeyalgorithms from sshd -T and flags any algorithm whose name contains a known-weak fragment, plus the SHA-1 based ssh-rsa host key signature algorithm.
- How to Fix
- Remove the listed algorithms. On OpenSSH 8.x and later the defaults are already strong: delete any custom Ciphers/MACs/KexAlgorithms lines, or set explicit modern lists such as Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com then reload sshd.
- How to Verify
sshd -T | grep -Ei '^(ciphers|macs|kexalgorithms)' should list no cbc, arcfour, md5 or sha1 entries, and hostkeyalgorithms should not list ssh-rsa.- CVSS v3.1 Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N- Control Category
- Cryptography and TLS: CIS Controls v8 3; NIST CSF 2.0 PR.DS
- Fix Effort
- Low
- CIS Controls v8 Safeguard
- 3.10
- NIST CSF 2.0 Subcategory
- PR.DS-02
- CWE
- CWE-327
- OWASP Top 10
- A02:2021
- NIST SP 800-53 Rev. 5
- SC-8, SC-13
- Benchmark Topic
- SSH server configuration: approved ciphers, MACs and KEX (topic only, no benchmark text)
- References
- OpenBSD, sshd_config(5) manual page
RFC 9142, Key Exchange Method Updates for SSH
NIST SP 800-131A Rev. 2, Transitioning Cryptographic Algorithms
Source Code
The complete file that defines this check. Run it with openvapt scan --only HOST-SSH-004, or read it offline with openvapt explain HOST-SSH-004.
internal/checks/host/ssh_weak_crypto.go · Lines 1-65View on GitHub at This Commit
| 1 | package host |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "strings" |
| 6 | |
| 7 | "github.com/openvapt/openvapt/internal/check" |
| 8 | "github.com/openvapt/openvapt/internal/checks/collect" |
| 9 | "github.com/openvapt/openvapt/internal/sys" |
| 10 | ) |
| 11 | |
| 12 | // weakSSH lists algorithm name fragments considered weak. Sources: RFC 9142 |
| 13 | // (key exchange), RFC 8758 (RC4 deprecated), and the OpenSSH release notes |
| 14 | // that removed or disabled these algorithms by default. |
| 15 | var weakSSH = []string{"cbc", "arcfour", "3des", "blowfish", "hmac-md5", "hmac-sha1", "umac-64", |
| 16 | "diffie-hellman-group1-", "diffie-hellman-group14-sha1", "diffie-hellman-group-exchange-sha1", "ssh-dss"} |
| 17 | |
| 18 | // sshRSASHA1 reports the SHA-1 based RSA signature algorithm "ssh-rsa" |
| 19 | // (and its certificate form), disabled by default since OpenSSH 8.8. |
| 20 | func sshRSASHA1(alg string) bool { |
| 21 | return alg == "ssh-rsa" || alg == "ssh-rsa-cert-v01@openssh.com" |
| 22 | } |
| 23 | |
| 24 | func init() { |
| 25 | check.Register(&check.Check{ |
| 26 | ID: "HOST-SSH-004", |
| 27 | Title: "SSH Offers Weak Cryptography", |
| 28 | Domain: check.DomainHost, |
| 29 | Severity: check.Medium, |
| 30 | CVSS: "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N", |
| 31 | Summary: "Checks the SSH ciphers, MACs, key exchange and host key algorithms for outdated choices.", |
| 32 | Rationale: "CBC-mode ciphers, RC4, MD5/SHA-1 MACs and 1024-bit Diffie-Hellman have known practical weaknesses. Offering them lets a network attacker downgrade or weaken the session.", |
| 33 | Detection: "Reads ciphers, macs, kexalgorithms and hostkeyalgorithms from sshd -T and flags any algorithm whose name contains a known-weak fragment, plus the SHA-1 based ssh-rsa host key signature algorithm.", |
| 34 | Fix: "Remove the listed algorithms. On OpenSSH 8.x and later the defaults are already strong: delete any custom Ciphers/MACs/KexAlgorithms lines, or set explicit modern lists such as Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com then reload sshd.", |
| 35 | Verify: "sshd -T | grep -Ei '^(ciphers|macs|kexalgorithms)' should list no cbc, arcfour, md5 or sha1 entries, and hostkeyalgorithms should not list ssh-rsa.", |
| 36 | Refs: []check.Ref{refSSHDManual, |
| 37 | {Title: "RFC 9142, Key Exchange Method Updates for SSH", URL: "https://www.rfc-editor.org/rfc/rfc9142.html"}, |
| 38 | {Title: "NIST SP 800-131A Rev. 2, Transitioning Cryptographic Algorithms", URL: "https://csrc.nist.gov/pubs/sp/800/131/a/r2/final"}}, |
| 39 | Standards: check.Standards{CWE: []string{"CWE-327"}, OWASP: []string{"A02:2021"}, NIST: []string{"SC-8", "SC-13"}, CISTopic: "SSH server configuration: approved ciphers, MACs and KEX"}, |
| 40 | Run: func(ctx context.Context, s sys.System) []check.Result { |
| 41 | cfg, ok := collect.SSHD(ctx, s) |
| 42 | if !ok { |
| 43 | return []check.Result{check.SkipR("sshd", "SSH daemon configuration not found")} |
| 44 | } |
| 45 | var bad []string |
| 46 | for _, key := range []string{"ciphers", "macs", "kexalgorithms", "hostkeyalgorithms"} { |
| 47 | for _, alg := range strings.Split(cfg[key], ",") { |
| 48 | for _, w := range weakSSH { |
| 49 | if alg != "" && (strings.Contains(alg, w) || key == "hostkeyalgorithms" && sshRSASHA1(alg)) { |
| 50 | bad = append(bad, key+": "+alg) |
| 51 | break |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | if len(bad) > 0 { |
| 57 | return []check.Result{check.FailR("sshd", "Weak SSH algorithms are offered", bad...)} |
| 58 | } |
| 59 | if cfg["ciphers"] == "" { |
| 60 | return []check.Result{check.SkipR("sshd", "Algorithm lists not available (sshd -T not readable); OpenSSH defaults assumed")} |
| 61 | } |
| 62 | return []check.Result{check.PassR("sshd", "No weak SSH algorithms offered")} |
| 63 | }, |
| 64 | }) |
| 65 | } |
Also available as plain Markdown for notes, scripts and AI tools. Same facts, same source, no styling.
Cite This Page
If this page helped your work, please cite it. The version and web address are filled in; the access date is today's date in your browser. Every other style, and when credit is required, is on How to Cite OpenVAPT.
OpenVAPT. (2026). HOST-SSH-004 SSH Offers Weak Cryptography (Version 0.1.0-alpha.6). OpenVAPT Check Catalogue. Retrieved October 16, 2026, from https://openvapt.com/checks/HOST-SSH-004.html
In text: (OpenVAPT, 2026). Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.
@misc{openvapt_host_ssh_004,
author = {{OpenVAPT}},
title = {{HOST-SSH-004 SSH Offers Weak Cryptography}},
year = {2026},
howpublished = {\url{https://openvapt.com/checks/HOST-SSH-004.html}},
note = {OpenVAPT Check Catalogue, version 0.1.0-alpha.6. Accessed 16 October 2026}
}
Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.
Citing OpenVAPT does not mean OpenVAPT endorses, approves or has reviewed your work.