mailing list archives
Secure SSL connections with Ncat
From: David Fifield <david () bamsoftware com>
Date: Fri, 24 Apr 2009 10:39:46 -0600
The Ncat Users' Guide has had this warning on its SSL page
Ncat's SSL support is currently provided by the Nsock socket
library, which is optimized for Nmap's version detection and
prioritizes speed over security. The SSL channel may use a weak
cipher or none at all, and there is no way to specify which
ciphers to allow. Server certificates are not verified, making
man-in-the-middle attacks possible. Ncat's SSL mode should be
used as a tool to test and debug SSL servers and clients, and
should not be considered strong encryption.
For the last few days I've been making changes so we can remove that
warning; that is, to enable Ncat to make SSL connections that are at
least as good as what your web browser makes.
The basic usage doesn't change:
ncat --ssl www.amazon.com 443 -v
The only difference is that Ncat will use only secure ciphers and won't
do SSLv2. To do certificate verification, use --ssl-verify instead:
ncat --ssl-verify www.amazon.com 443 -v
That may or may not work, depending on whether you have default trusted
CA certificates installed. If you have the root CA certificates in
another place, or you want to connect to a server whose certificate is
not signed by a root CA, use --ssl-trustfile to list trusted
ncat --ssl-verify --ssl-trustfile ~/custom-certs.pem my.example.com 993 -v
To try the new code, do
svn co --username guest --password "" svn://svn.insecure.org/nmap-exp/david/nmap-ssl
Are there any suggestions on option syntax or behavior before I merge
Summary of changes:
* An Nsock pool can be initialized for security (nsp_ssl_init) or
* nsp_ssl_init quits with a fatal error if it can't gather enough
entropy (but from looking at the OpenSSL source code it's hard to
make that happen on most operating systems).
* Ncat in connect mode uses nsp_ssl_init.
* Server certificate verification is done with the --ssl-verify option.
This includes domain name verification.
* If certificate verification fails, Ncat prints the SHA-1 fingerprint
of the certificate so you can check it out with your web browser or
* The --ssl-trustfile option lets you specify which CA certificates are
trusted. In the absence of this option, OpenSSL's default
certificates are trusted (these may be found in /etc/ssl/certs but
are not available on every operating system and distribution).
* Ncat in listen mode uses only secure ciphers and does not allow SSLv2.
* Version scan and NSE use nsp_ssl_init_max_speed, so their behavior
should be unchanged.
Ideas for more improvements:
* Certificate revocation checking. This isn't currently done. The book
I bought (Network Security with OpenSSL) indicates it is a huge pain.
Apparently many applications ignore this issue, so we're at least
doing no worse. But this could be an opportunity for Ncat to lead the
way. The Online Certificate Status Protocol
(http://en.wikipedia.org/wiki/OCSP) is worth investigating.
* Support for sending a certificate in connect mode. Some SSL servers
use client certificates for authentication, though it is not common.
This would be easy to implement by overloading --ssl-cert and --ssl-key.
Sent through the nmap-dev mailing list
Archived at http://SecLists.Org
- Secure SSL connections with Ncat David Fifield (Apr 24)