SSH-AUDIT(1)
β¨ NAME β¨
Bestie, this is ssh-audit(1) β aka SSH-AUDIT(1) from the General Commands Manual β the SSH server & client configuration auditor. Periodt. π
πΈ SYNOPSIS πΈ
ssh-audit [options] <target_host>
π¦ DESCRIPTION π¦
Okay so ssh-audit analyzes the configuration of SSH servers & clients, then warns you about weak, obsolete, and/or untested cryptographic primitives. Itβs very useful for hardening SSH tunnels, which by default tend to be optimized for compatibility, not security. No cap. π₯
See https://www.ssh-audit.com/ for official hardening guides for common platforms. π«Ά
π OPTIONS π
Okay bestie, hereβs the whole menu β every flag, every value, zero skips. β¨
-h,--helpβ prints a short summary of options. π«Ά-4,--ipv4β prioritizes the usage of IPv4.-6,--ipv6β prioritizes the usage of IPv6.-b,--batchβ enables grepable output. π-c,--client-auditβ starts a server on port2222to audit client software configuration. Use-p/--port=<port>to change the port and-t/--timeout=<secs>to change the listen timeout. π--conn-rate-test=N[:max_rate]β performs a connection rate test (useful for collecting metrics related to susceptibility of the DHEat vulnerability [CVE-2002-20001]). A successful connection is counted when the server returns a valid SSH banner. Testing is conducted withNconcurrent sockets with an optional maximum rate of connections per second.-d,--debugβ enables debug output. π--dheat=N[:kex[:e_len]]β runs the DHEat DoS attack (CVE-2002-20001) against the target server (which will consume all available CPU resources). The number of concurrent sockets,N, needed to achieve this effect will be highly dependent on the CPU resources available on the target, as well as the latency between the source and target machines. The key exchange is automatically chosen based on which would cause maximum effect, unless explicitly chosen in the second field. Lastly, an (experimental) option allows the length in bytes of the fakeevalue sent to the server to be specified in the third field. Normally, the length ofeis roughly the length of the modulus of the Diffie-Hellman exchange (hence, an8192-bit/1024-bytevalue ofeis sent in each connection when targeting thediffie-hellman-group18-sha512algorithm). Instead, it was observed that many SSH implementations accept small values, such as4 bytes; this results in a much more network-efficient attack. π--get-hardening-guide=<platform_name>β retrieves the hardening guide for the specified platform name (use--list-hardening-guidesto see the list of available guides). π-g,--gex-test=<x[,y,...] | min1:pref1:max1[,min2:pref2:max2,...] | x-y[:step]>β runs a Diffie-Hellman Group Exchange modulus size test against a server.
Diffie-Hellman requires the client and server to agree on a generator value and a modulus value. In the βGroup Exchangeβ implementation of Diffie-Hellman, the client specifies the size of the modulus in bits by providing the server with minimum, preferred and maximum values. The server then finds a group that best matches the clientβs request, returning the corresponding generator and modulus. For a full explanation of this process see RFC 4419 and its successors. π§
This test acts as a client by providing an SSH server with the size of a modulus and then obtains the size of the modulus returned by the server. π«
Three types of syntax are supported:
<x[,y,...]>β a comma delimited list of modulus sizes. A test is performed against each value in the list where it acts as the minimum, preferred and maximum modulus size.<min:pref:max[,min:pref:max,...]>β a set of three colon delimited values denoting minimum, preferred and maximum modulus size. A test is performed against each set. Multiple sets can be specified as a comma separated list.<x-y[:step]>β a range of modulus sizes with an optional step value. Step defaults to1if omitted. If the left value is greater than the right value, then the sequence operates from right to left. A test is performed against each value in the range where it acts as the minimum, preferred and maximum modulus size.
Duplicates are excluded from the return value. π¦
-j,--jsonβ outputs results in JSON format. Specify it twice (-jj) to enable indent printing (useful for debugging). β¨-l,--level=<info|warn|fail>β specifies the minimum output level. Default isinfo.--list-hardening-guidesβ lists all official, built-in hardening guides for common systems. Their full names can then be passed to--get-hardening-guide. Add-vto this option to view hardening guide change logs and prior versions. π-L,--list-policiesβ lists all official, built-in policies for common systems. Their full names can then be passed to-P/--policy. Add-vto-Lto view policy change logs. π--lookup=<alg1,alg2,...>β looks up the security information of an algorithm(s) in the internal database. Does not connect to a server. π-m,--manualβ prints the man page (Docker, PyPI, Snap, and Windows builds only). π-M,--make-policy=<custom_policy.txt>β creates a policy based on the target server. Useful when other servers should be compared to the target serverβs custom configuration (i.e.: a cluster environment). Note that the resulting policy can be edited manually. π-n,--no-colorsβ disables color output. Automatically set when theNO_COLORenvironment variable is set. π¨-p,--port=<port>β the TCP port to connect to when auditing a server, or the port to listen on when auditing a client.-P,--policy=<"built-in policy name" | path/to/custom_policy.txt>β runs a policy audit against a target using the specified policy (see the POLICY AUDIT section for a detailed description of this mode of operation). Combine with-c/--client-auditto audit a client configuration instead of a server. Use-L/--list-policiesto list all official, built-in policies for common systems. π--skip-rate-testβ skips the connection rate test during standard audits. By default, a few dozen TCP connections are created with the target host to see if connection throttling is implemented (this can safely infer whether the target is vulnerable to the DHEat attack; seeCVE-2002-20001). π«--socks5 host:portβ connects through a SOCKS5 proxy. Rate tests are automatically skipped (i.e.: implies--skip-rate-test). π§¦-t,--timeout=<secs>β the timeout, in seconds, for creating connections and reading data from the socket. Default is5.-T,--targets=<hosts.txt>β a file containing a list of target hosts. Each line must have one host, in the format ofHOST[:PORT](or for UNIX sockets, use"unix://path/to/socket"). Use-p/--portto set the default port for all hosts. Use--threadsto control concurrent scans. π--threads=<threads>β the number of threads to use when scanning multiple targets (with-T/--targets). Default is32. π§΅-v,--verboseβ enables verbose output. π£οΈ
π₯ STANDARD AUDIT π₯
By default, ssh-audit performs a standard audit. That is, it enumerates all host key types, key exchanges, ciphers, MACs, and other information, then color-codes them in output to you. Cryptographic primitives with potential issues are displayed in yellow; primitives with serious flaws are displayed in red. π¨
π POLICY AUDIT π
When the -P/--policy option is used, ssh-audit performs a policy audit. The targetβs host key types, key exchanges, ciphers, MACs, and other information is compared to a set of expected values defined in the specified policy file. If everything matches, only a short message stating a passing result is reported. Otherwise, the field(s) that did not match are reported. π
Policy auditing is helpful for ensuring a group of related servers are properly hardened to an exact specification.
The set of official built-in policies can be viewed with -L/--list-policies. Multiple servers can be audited with -T/--targets=<servers.txt>. Custom policies can be made from an ideal target server with -M/--make-policy=<custom_policy.txt>. π«Ά
β¨ EXAMPLES β¨
Okay bestie, this is the section you're actually here for β real, copy-pasteable receipts. Every command below is exactly what you type, no cap. π«Ά
Basic server auditing β the classic "who are you and what are you running" move:
ssh-audit localhost
ssh-audit 127.0.0.1
ssh-audit 127.0.0.1:222
ssh-audit ::1
ssh-audit [::1]:222
ssh-audit unix:///run/ssh-unix-local/socket
Notice how it handles IPv6 with brackets when there's a port ([::1]:222), and even audits a Unix domain socket through unix:// β versatile icon behavior. π
To run a standard audit against many servers β drop your targets into servers.txt, one on each line in the format of HOST[:PORT]:
ssh-audit -T servers.txt
To audit a client configuration β this one listens on port 2222 by default, and you connect using ssh -p 2222 anything@localhost:
ssh-audit -c
To audit a client configuration, with a listener on port 4567:
ssh-audit -c -p 4567
To list all official built-in policies β hint: use their full names with -P/--policy:
ssh-audit -L
To run a built-in policy audit against a server β hint: use -L to see list of built-in policies:
ssh-audit -P "Hardened Ubuntu Server 20.04 LTS (version 1)" targetserver
To run a custom policy audit against a server β hint: use -M/--make-policy to create a custom policy file:
ssh-audit -P path/to/server_policy.txt targetserver
To run a policy audit against a client:
ssh-audit -c -P ["policy name" | path/to/client_policy.txt]
To run a policy audit against many servers:
ssh-audit -T servers.txt -P ["policy name" | path/to/server_policy.txt]
To create a policy based on a target server β which can be manually edited; see official built-in policies for syntax examples:
ssh-audit -M new_policy.txt targetserver
Now the gex-test trio, aka my personal faves because the syntax is lowkey elegant π
To run a Diffie-Hellman Group Exchange modulus size test using the values 2000 bits, 3000 bits, 4000 bits and 5000 bits:
ssh-audit targetserver --gex-test=2000,3000,4000,5000
To run a Diffie-Hellman Group Exchange modulus size test where 2048 bits is the minimum, 3072 bits is the preferred and 5000 bits is the maximum:
ssh-audit targetserver --gex-test=2048:3072:5000
To run a Diffie-Hellman Group Exchange modulus size test from 0 bits to 5120 bits in increments of 1024 bits:
ssh-audit targetserver --gex-test=0-5120:1024
DHEat time π β and seriously, monitor the target server's CPU usage for the first one to determine the optimal number of concurrent sockets:
To run the DHEat DoS attack:
ssh-audit targetserver --dheat=10
To run the DHEat attack and manually target the diffie-hellman-group-exchange-sha256 algorithm:
ssh-audit targetserver --dheat=10:diffie-hellman-group-exchange-sha256
To run the DHEat attack and manually target the diffie-hellman-group-exchange-sha256 algorithm with a very small length of e β resulting in the same effect but without having to send large packets:
ssh-audit targetserver --dheat=10:diffie-hellman-group-exchange-sha256:4
Connection rate testing, the chill sibling of DHEat π¦
To test the number of successful connections per second that can be created with the target using 8 parallel threads β useful for detecting whether connection throttling is implemented by the target:
ssh-audit targetserver --conn-rate-test=8
To use 8 parallel threads to create up to 100 connections per second with the target β useful for understanding how much CPU load is caused on the target simply from handling new connections vs excess modular exponentiation when performing the DHEat attack:
ssh-audit targetserver --conn-rate-test=8:100
π RETURN VALUES π
Here's the vibe check on exit codes, bestie. When a successful connection is made and all algorithms are rated as "good", ssh-audit returns 0. Iconic. β¨
Other possible return values are:
1 = connection error
2 = at least one algorithm warning was found
3 = at least one algorithm failure was found
<any other non-zero value> = unknown error
So like, 0 = slay, 1 = couldn't even connect π, 2 = one lil warning, 3 = a whole failure, and anything else non-zero = mystery behavior, we don't know her. π
πΈ SSH HARDENING GUIDES πΈ
Hardening guides for common platforms can be found at: <https://www.ssh-audit.com/>
Go get your server snatched, periodt. π
π BUG REPORTS π
Please file bug reports as a Github Issue at: <https://github.com/jtesta/ssh-audit/issues>
Don't be shy, the maintainer literally wants to know. π«Ά
π AUTHOR π
ssh-audit was originally written by Andris Raugulis <moo@arthepsy.eu>, and maintained from 2015 to 2017.
Maintainership was assumed and development was resumed in 2017 by Joe Testa <jtesta@positronsecurity.com>.
Give them their flowers, fr fr. π
And that's the whole page, bestie! This was SSH-AUDIT(1), from source/version dated June 20, 2026 β screenshot the date if you need it for your records, mwah πβ¨π§
π¦ where this page comes from
- arch rolling: ssh-audit 3.9.0-1 Β· MIT
- nixpkgs unstable: ssh-audit 3.9.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms