This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Testing for Weak SSL/TLS Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-001)"

From OWASP
Jump to: navigation, search
Line 3: Line 3:
  
 
== Brief Summary ==
 
== Brief Summary ==
<br>
+
Sensitive data must be protected when it is transmitted through the network. These data includes credentials and credit cards. As a rule of thumb if data must be protected when it is stored, it must be protected also during transmission.
Due to the historical exporting restrictions of high grade cryptography, both legacy and new web servers could be able to handle a weak cipher suite.<br>
+
 
Even if high grade ciphers are today supported and normally used, some misconfiguration in server installation could be used to force the use of a weak cipher (or at worst no encryption) permitting to an attacker to gain access to the supposed secure communication channel.<br>
+
HTTP is a clear-text protocol and it is normally secured via an SSL/TLS tunnel, resulting in HTTPS traffic [1]. Use of these protocols ensure not only confidentiality but also authentication. Servers are authenticated using digital certificates, and it is also possibile to use client certificate for mutual authentication.  
<br>
+
 
 +
Even if high grade ciphers are today supported and normally used, some misconfiguration in server can be used to force the use of a weak cipher - or at worst no encryption - permitting to an attacker to gain access to the supposed secure communication channel. Other misconfiguration can be used for a Denial of Service attack.
 +
 
 
== Description of the Issue ==  
 
== Description of the Issue ==  
<br>
+
If control is missed and HTTP protocol is used to transmit sensitive information is a vulnerability [2] (e.g. credentials transmitted over HTTP [3]) and there are a specific OWASP Testing Guide v4’s test.
The HTTP clear-text protocol is normally secured via an SSL or TLS tunnel, resulting in HTTPS traffic. In addition to providing encryption of data in transit, HTTPS allows the identification of servers (and, optionally, of clients) by means of digital certificates.
+
 
 +
If SSL/TLS service is present it is good but it increments the attack surface and some vulnerabilities insist on it, such as:
 +
* SSL/TLS protocols, ciphers, keys and renegotiation must be properly configured.
 +
* Certificate validity must be ensured.
 +
Other vulnerabilities linked to this is:
 +
* Software exposed must be updated due to possibility of known vulnerabilities [4].
 +
* Usage of Secure flag for Session Cookies [5].
 +
* Usage of HTTP Strict Transport Security (HSTS) [6].
 +
* The presence of HTTP and HTTPS both, which can be used to intercept traffic [7], [8].
 +
* The presence of mixed HTTP and HTTP content in the same page, which can be used to Leak information.
 +
 
 +
===Sensitive data transmitted in clear-text===
 +
If the application transmits sensitive information via unencrypted channes - e.g. HTTP - it is a vulnerability. Typically it is possible to find BASIC authentication over HTTP, input password sent via HTTP and, in general, other information considered by regulations, laws or organization policy.
 +
 
 +
===Weak SSL/TSL Ciphers/Protocols/Keys===
 +
Historically, there have been limitations set in place by the U.S. government to allow cryptosystems to be exported only for key sizes of at most 40 bits, a key length which could be broken and would allow the decryption of communications. Since then cryptographic export regulations have been relaxed the maximum key size is 128 bits.
 +
It is important to check the SSL configuration being used to avoid putting in place cryptographic support which could be easily defeated. To reach this goal SSL-based services should not offer the possibility to choose weak cipher suite. A cipher suite is specified by an encryption protocol (e.g. DES, RC4, AES), the encryption key length (e.g. 40, 56, or 128 bits), and a hash algorithm (e.g. SHA, MD5) used for integrity checking.
 +
Briefly, the key points for the cipher suite determination are the following:
 +
# The client sends to the server a ClientHello message specifying, among other information, the protocol and the cipher suites that it is able to handle. Note that a client is usually a web browser (most popular SSL client nowadays), but not necessarily, since it can be any SSL-enabled application; the same holds for the server, which needs not to be a web server, though this is the most common case [9].
 +
#The server responds with a ServerHello message, containing the chosen protocol and cipher suite that will be used for that session (in general the server selects the strongest protocol and cipher suite supported by both the client and server).
 +
 
 +
It is possible (for example, by means of configuration directives) to specify which cipher suites the server will honor. In this way you may control, for example, whether or not conversations with clients will support 40-bit encryption only.
 +
 
 +
#The server sends its Certificate message and, if client authentication is required, also sends a CertificateRequest message to the client.
 +
#The server sends a ServerHelloDone message and waits for a client response.
 +
#Upon receipt of the ServerHelloDone message, the client verifies the validity of the server's digital certificate.
  
===Weak SSL/TSL Ciphers===
 
<br>
 
Historically, there have been limitations set in place by the U.S. government to allow cryptosystems to be exported only for key sizes of at most 40 bits, a key length which could be broken and would allow the decryption of communications. Since then cryptographic export regulations have been relaxed (though some constraints still hold), however it is important to check the SSL configuration being used to avoid putting in place cryptographic support which could be easily defeated. To reach this goal SSL-based services should not offer the possibility to choose weak cipher suite. A cipher suite is specified by an encryption protocol (DES, RC4, AES), the encryption key length (such as 40, 56, or 128 bits), and a hash algorithm (SHA, MD5) used for integrity checking.<br>
 
Briefly, the key points for the cipher suite determination are the following: <br>
 
# The client sends to the server a ClientHello message specifying, among other information, the protocol and the cipher suites that it is able to handle. Note that a client is usually a web browser (most popular SSL client nowadays), but not necessarily, since it can be any SSL-enabled application; the same holds for the server, which needs not to be a web server, though this is the most common case. (For example, a noteworthy class of SSL clients is that of SSL proxies such as stunnel (www.stunnel.org) which can be used to allow non-SSL enabled tools to talk to SSL services);<br>
 
# The server responds with a ServerHello message, containing the chosen protocol and cipher suite that will be used for that session (in general the server selects the strongest protocol and cipher suite supported by both the client and server). <br>
 
It is possible (for example, by means of configuration directives) to specify which cipher suites the server will honor. In this way you may control, for example, whether or not conversations with clients will support 40-bit encryption only.<br>
 
 
===SSL certificate validity – client and server===
 
===SSL certificate validity – client and server===
When accessing a web application via the HTTPS protocol, a secure channel is established between the client and the server. The identity of one (the server) or both parties (client and server) is then established by means of digital certificates. So, once the cipher suite is determined, the “SSL Handshake” continues with the exchange of the certificates, like follow:<br>
+
 
<ol>
+
When accessing a web application via the HTTPS protocol, a secure channel is established between the client and the server. The identity of one (the server) or both parties (client and server) is then established by means of digital certificates. So, once the cipher suite is determined, the “SSL Handshake” continues with the exchange of the certificates, like follow:
<li value=3> The server sends its Certificate message and, if client authentication is required, also sends a CertificateRequest message to the client.  
+
# The server sends its Certificate message and, if client authentication is required, also sends a CertificateRequest message to the client.
<li> The server sends a ServerHelloDone message and waits for a client response.
+
# The server sends a ServerHelloDone message and waits for a client response.
<li> Upon receipt of the ServerHelloDone message, the client verifies the validity of the server's digital certificate.
+
# Upon receipt of the ServerHelloDone message, the client verifies the validity of the server's digital certificate.
</ol>
+
 
In order for the communication to be set up, a number of checks on the certificates must be passed. While discussing SSL and certificate based authentication is beyond the scope of this Guide, we will focus on the main criteria involved in ascertaining certificate validity: <br>
+
In order for the communication to be set up, a number of checks on the certificates must be passed. While discussing SSL and certificate based authentication is beyond the scope of this Guide, we will focus on the main criteria involved in ascertaining certificate validity:  
a) checking if the Certificate Authority (CA) is a known one (meaning one considered trusted);<br>
+
 
b) checking that the certificate is currently valid;<br>
+
* Checking if the Certificate Authority (CA) is a known one (meaning one considered trusted);
c) checking that the name of the site and the name reported in the certificate match.<br>
+
* Checking that the certificate is currently valid;
Let’s examine each check more in detail. <br>
+
* Checking that the name of the site and the name reported in the certificate match.
a) Each browser comes with a preloaded list of trusted CAs, against which the certificate signing CA is compared (this list can be customized and expanded at will). During the initial negotiations with an HTTPS server, if the server certificate relates to a CA unknown to the browser, a warning is usually raised. This happens most often because a web application relies on a certificate signed by a self-established CA. Whether this is to be considered a concern depends on several factors. For example, this may be fine for an Intranet environment (think of corporate web email being provided via HTTPS; here, obviously all users recognize the internal CA as a trusted CA). When a service is provided to the general public via the Internet, however (i.e. when it is important to positively verify the identity of the server we are talking to), it is usually imperative to rely on a trusted CA, one which is recognized by all the user base (and here we stop with our considerations; we won’t delve deeper in the implications of the trust model being used by digital certificates). <br>
+
 
b) Certificates have an associated period of validity, therefore they may expire. Again, we are warned by the browser about this. A public service needs a temporally valid certificate; otherwise, it means we are talking with a server whose certificate was issued by someone we trust, but has expired without being renewed. <br>
+
Let is examine each check more in detail.  
c) What if the name on the certificate and the name of the server do not match? If this happens, it might sound suspicious. For a number of reasons, this is not so rare to see. A system may host a number of name-based virtual hosts, which share the same IP address and are identified by means of the HTTP 1.1 Host: header information. In this case, since the SSL handshake checks the server certificate before the HTTP request is processed, it is not possible to assign different certificates to each virtual server. Therefore, if the name of the site and the name reported in the certificate do not match, we have a condition which is typically signaled by the browser. To avoid this, IP-based virtual servers must be used. [2] and [3] describe techniques to deal with this problem and allow name-based virtual hosts to be correctly referenced. <br>
+
 
 +
* Each browser comes with a preloaded list of trusted CAs, against which the certificate signing CA is compared (this list can be customized and expanded at will). During the initial negotiations with an HTTPS server, if the server certificate relates to a CA unknown to the browser, a warning is usually raised. This happens most often because a web application relies on a certificate signed by a self-established CA. Whether this is to be considered a concern depends on several factors. For example, this may be fine for an Intranet environment (think of corporate web email being provided via HTTPS; here, obviously all users recognize the internal CA as a trusted CA). When a service is provided to the general public via the Internet, however (i.e. when it is important to positively verify the identity of the server we are talking to), it is usually imperative to rely on a trusted CA, one which is recognized by all the user base (and here we stop with our considerations; we won’t delve deeper in the implications of the trust model being used by digital certificates).  
 +
 
 +
* Certificates have an associated period of validity, therefore they may expire. Again, we are warned by the browser about this. A public service needs a temporally valid certificate; otherwise, it means we are talking with a server whose certificate was issued by someone we trust, but has expired without being renewed.  
 +
 
 +
* What if the name on the certificate and the name of the server do not match? If this happens, it might sound suspicious. For a number of reasons, this is not so rare to see. A system may host a number of name-based virtual hosts, which share the same IP address and are identified by means of the HTTP 1.1 Host: header information. In this case, since the SSL handshake checks the server certificate before the HTTP request is processed, it is not possible to assign different certificates to each virtual server. Therefore, if the name of the site and the name reported in the certificate do not match, we have a condition which is typically signaled by the browser. To avoid this, IP-based virtual servers must be used. [33] and [34] describe techniques to deal with this problem and allow name-based virtual hosts to be correctly referenced.  
  
 
===Other vulnerabilities===
 
===Other vulnerabilities===
Moreover, also in the case in which weak cipher suites are not supported by the server, there are others vulnerabilities that could lead an attacker to force a victim into using a non-secure channel instead of a secure one. These vulnerabilities, like SSL Strip attack and Surf Jacking, are possible due to the use, by the server, of both the HTTP and HTTPS protocols to provide the website contents.<br>
+
The presence of a new service, listening in a separate tcp port may introduce vulnerabilities such as Infrastructure vulnerability if software is not up to date [4]. Futhermore for a correct protection of data during transmission Session Cookie must use the Secure flag [5] and some directives should be sent to the browser to accept only secure traffic (e.g. HSTS [6], CSP [9]).
 +
 
 +
Also there are some attacks can be used to intercept traffic if the web server exposes the application on both HTTP and HTTPS [6], [7] or in case of mixed HTTP and HTTPS resources in the same page.
  
<br>
 
 
== Black Box testing and example ==
 
== Black Box testing and example ==
<br>
 
===Testing for Weak SSL/TSL Ciphers vulnerabilities===
 
Large number of available cipher suites and quick progress in cryptanalysis makes judging a SSL server a non-trivial task. These criteria are widely recognized as minimum checklist:<br>
 
* SSLv2, due to known weaknesses in protocol design
 
* Export (EXP) level cipher suites in SSLv3
 
* Cipher suites with symmetric encryption algorithm smaller than 128 bits
 
* X.509 certificates with RSA or DSA key smaller than 1024 bits
 
* X.509 certificates signed using MD5 hash, due to known collision attacks on this hash
 
* TLS Renegotiation vulnerability
 
While there are known collision attacks on MD5 and known crypto-analytical attacks on RC4, their specific usage in SSL and TLS doesn't allow these attacks to be practical and SSLv3 or TLSv1 cipher suites using RC4 and MD5 with key length of 128 bit is still considered sufficient.<br>
 
The following standards can be used as reference while assessing SSL servers:<br>
 
* NIST SP 800-52 recommends U.S. federal systems to use at least TLS 1.0 with ciphersuites based on RSA or DSA key agreement with ephemeral Diffie-Hellman, 3DES or AES for confidentality and SHA1 for integrity protection. NIST SP 800-52 specifically disallows non-FIPS compliant algorithms like RC4 and MD5. An exception is U.S. federal systems making connections to outside servers, where these algorithms can be used in SSL client mode.
 
* PCI-DSS v2.0 in point 4.1 requires compliant parties to use "strong cryptography" without precisely defining key lengths and algorithms. Common interpretation, partially based on previous versions of the standard, is that at least 128 bit key cipher, no export strength algorithms and no SSLv2 should be used.
 
* SSL Server Rating Guide has been proposed to standardize SSL server assessment and currently is in draft version.
 
SSL Server Database can be used to assess configuration of publicly available SSL servers based on SSL Rating Guide[5].<br>
 
In order to detect possible support of weak ciphers, the ports associated to SSL/TLS wrapped services must be identified. These typically include port 443, which is the standard https port; however, this may change because a) https services may be configured to run on non-standard ports, and b) there may be additional SSL/TLS wrapped services related to the web application. In general, a service discovery is required to identify such ports. <br>
 
The nmap scanner, via the “–sV” scan option, is able to identify SSL services. Vulnerability Scanners, in addition to performing service discovery, may include checks against weak ciphers (for example, the Nessus scanner has the capability of checking SSL services on arbitrary ports, and will report weak ciphers). <br>
 
  
''' Example 1. ''' SSL service recognition via nmap.
+
===Testing for sensitive data transmitted in clear-text===
 +
Various typologies of information which must be protected can be also transmitted in clear text. It is possible to check if these information is transmitted over HTTP instead of HTTPS.
 +
 
 +
Please refer to specific Tests for full details, for credentials [3] and other kind of data [2]. 
 +
 
 +
=====Example 1. Basic Authentication over HTTP=====
 +
A typical example is the usage of Basic Autentication over HTTP. Also because with Basic Autentication, after login, credentials are encoded - and not encrypted - into HTTP Headers.
 
<pre>
 
<pre>
[root@test]# nmap -F -sV localhost
+
$ curl -kis http://example.com/restricted/
 +
HTTP/1.1 401 Authorization Required
 +
Date: Fri, 01 Aug 2013 00:00:00 GMT
 +
WWW-Authenticate: Basic realm="Restricted Area"
 +
Accept-Ranges: bytes
 +
Vary: Accept-Encoding
 +
Content-Length: 162
 +
Content-Type: text/html
  
Starting nmap 3.75 ( http://www.insecure.org/nmap/ ) at 2005-07-27 14:41 CEST
+
<html><head><title>401 Authorization Required</title></head>
Interesting ports on localhost.localdomain (127.0.0.1):
+
<body bgcolor=white>
(The 1205 ports scanned but not shown below are in state: closed)
+
<h1>401 Authorization Required</h1>
  
PORT      STATE SERVICE        VERSION
+
Invalid login credentials!
443/tcp  open  ssl            OpenSSL
 
901/tcp  open  http            Samba SWAT administration server
 
8080/tcp  open  http            Apache httpd 2.0.54 ((Unix) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/4.3.11)
 
8081/tcp  open  http            Apache Tomcat/Coyote JSP engine 1.0
 
  
Nmap run completed -- 1 IP address (1 host up) scanned in 27.881 seconds
+
</body></html>
[root@test]#
 
 
</pre>
 
</pre>
  
''' Example 2. ''' Identifying weak ciphers with Nessus. The following is an anonymized excerpt of a report generated by the Nessus scanner, corresponding to the identification of a server certificate allowing weak ciphers (see underlined text).  
+
===Testing for Weak SSL/TSL Ciphers/Protocols/Keys vulnerabilities===
 +
Large number of available cipher suites and quick progress in cryptanalysis makes judging a SSL server a non-trivial task. At the time of writing these criteria are widely recognized as minimum checklist:
 +
* Weak ciphers must not be used (e.g. less than 128 bits [10]; no NULL ciphers suite, due to no encryption used; no Anonymous Diffie-Hellmann, due to not provides authentication).
 +
* Weak protocols must be disabled (e.g. SSLv2 must be disabled, due to known weaknesses in protocol design [11]).
 +
* Renegotiation must be properly configured (e.g. Insecure Renegotiation must be disabled, due to MiTM attacks [12] and Client-initiated Renegotiation must be disabled, due to Denial of Service vulnerability [13]).
 +
* No Export (EXP) level cipher suites, due to can be easly broken [10].
 +
* X.509 certificates key length must be strong (e.g. if RSA or DSA is used the key must be at least 1024 bits).
 +
* X.509 certificates must be signed only with secure hashing algoritms (e.g. not signed using MD5 hash, due to known collision attacks on this hash).
 +
* Keys must be generated with proper entropy (e.g, Weak Key Generated with Debian) [14].
 +
A most complete checklist includes:
 +
* Secure Renegotiation should be enabled.
 +
* MD5 should not be used, due to known collision attacks, but it is ok the use with at least 128 bit key.
 +
* RC4 should not be used, due to crypto-analytical attacks [15].
 +
* Server should be protected from BEAST Attack [16].
 +
* Server should be protected from CRIME attack, TLS compression must be disabled [17].
 +
* Server should support Forward Secrecy [18].
 +
 
 +
Following standards can be used as reference while assessing SSL servers:
 +
* PCI-DSS v2.0 in point 4.1 requires compliant parties to use "strong cryptography" without precisely defining key lengths and algorithms. Common interpretation, partially based on previous versions of the standard, is that at least 128 bit key cipher, no export strength algorithms and no SSLv2 should be used [19].
 +
* Qualys SSL Labs Server Rating Guide [14], Depoloyment best practice [10] and SSL Threat Model [20] has been proposed to standardize SSL server assessment and configuration. But is less updated than the SSL Server tool [21].
 +
* OWASP has a lot of resources about SSL/TLS Security [22], [23], [24], [25]. [26].
 +
 
 +
Some tools and scanners both commercial - e.g. Tenable Nessus [27] - and free - e.g. SSLAudit [28] or SSLScan [29], and other used into examples - can be used to assess SSL/TLS vulnerabilities. But due to evolution of these vulnerabilities a good way is also to check them manually with openssl [30] or using tool’s output as an input for manual evaluation using the references on the bottom on the Test to stay updated.
 +
 
 +
====Example 2. SSL service recognition via nmap====
 +
First step is to identify ports which have SSL/TLS wrapped services. Typically tcp ports with SSL for web and mail services are -  but not limited to - 443 (https), 465 (ssmtp), 585 (imap4-ssl), 993 (imaps), 995 (ssl-pop).
 +
In this example we search for SSL services using nmap with “-sV” option, used for identify services and it is also able to identify SSL services [31]. Other options are for this particular example and must be customized. Often in a Web Application Penetration Test scope is limited to port 80 and 443.
  
 
<pre>
 
<pre>
https (443/tcp)
+
$ nmap -sV --reason -PN -n --top-ports 100 www.example.com
Description
+
Starting Nmap 6.25 ( http://nmap.org ) at 2013-01-01 00:00 CEST
Here is the SSLv2 server certificate:
+
Nmap scan report for www.example.com (127.0.0.1)
Certificate:
+
Host is up, received user-set (0.20s latency).
Data:
+
Not shown: 89 filtered ports
Version: 3 (0x2)
+
Reason: 89 no-responses
Serial Number: 1 (0x1)
+
PORT    STATE SERVICE REASON VERSION
Signature Algorithm: md5WithRSAEncryption
+
21/tcp open ftp      syn-ack Pure-FTPd
Issuer: C=**, ST=******, L=******, O=******, OU=******, CN=******
+
22/tcp open ssh      syn-ack OpenSSH 5.3 (protocol 2.0)
Validity
+
25/tcp open smtp    syn-ack Exim smtpd 4.80
Not Before: Oct 17 07:12:16 2002 GMT
+
26/tcp open smtp    syn-ack Exim smtpd 4.80
Not After : Oct 16 07:12:16 2004 GMT
+
80/tcp open http    syn-ack
  Subject: C=**, ST=******, L=******, O=******, CN=******
+
110/tcp open pop3    syn-ack Dovecot pop3d
  Subject Public Key Info:
+
143/tcp open imap    syn-ack Dovecot imapd
  Public Key Algorithm: rsaEncryption
+
443/tcp open ssl/http syn-ack Apache
  RSA Public Key: (1024 bit)
+
465/tcp open ssl/smtp syn-ack Exim smtpd 4.80
Modulus (1024 bit):
+
993/tcp open ssl/imap syn-ack Dovecot imapd
00:98:4f:24:16:cb:0f:74:e8:9c:55:ce:62:14:4e:
+
995/tcp open ssl/pop3 syn-ack Dovecot pop3d
6b:84:c5:81:43:59:c1:2e:ac:ba:af:92:51:f3:0b:
+
Service Info: Hosts: example.com
ad:e1:4b:22:ba:5a:9a:1e:0f:0b:fb:3d:5d:e6:fc:
+
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
  ef:b8:8c:dc:78:28:97:8b:f0:1f:17:9f:69:3f:0e:
+
Nmap done: 1 IP address (1 host up) scanned in 131.38 seconds
  72:51:24:1b:9c:3d:85:52:1d:df:da:5a:b8:2e:d2:
+
</pre>
09:00:76:24:43:bc:08:67:6b:dd:6b:e9:d2:f5:67:
 
e1:90:2a:b4:3b:b4:3c:b3:71:4e:88:08:74:b9:a8:
 
2d:c4:8c:65:93:08:e6:2f:fd:e0:fa:dc:6d:d7:a2:
 
3d:0a:75:26:cf:dc:47:74:29
 
Exponent: 65537 (0x10001)
 
  X509v3 extensions:
 
  X509v3 Basic Constraints:
 
  CA:FALSE
 
  Netscape Comment:
 
OpenSSL Generated Certificate
 
Page 10
 
Network Vulnerability Assessment Report 25.05.2005
 
X509v3 Subject Key Identifier:
 
10:00:38:4C:45:F0:7C:E4:C6:A7:A4:E2:C9:F0:E4:2B:A8:F9:63:A8
 
X509v3 Authority Key Identifier:
 
keyid:CE:E5:F9:41:7B:D9:0E:5E:5D:DF:5E:B9:F3:E6:4A:12:19:02:76:CE
 
DirName:/C=**/ST=******/L=******/O=******/OU=******/CN=******
 
  serial:00
 
  Signature Algorithm: md5WithRSAEncryption
 
7b:14:bd:c7:3c:0c:01:8d:69:91:95:46:5c:e6:1e:25:9b:aa:
 
8b:f5:0d:de:e3:2e:82:1e:68:be:97:3b:39:4a:83:ae:fd:15:
 
2e:50:c8:a7:16:6e:c9:4e:76:cc:fd:69:ae:4f:12:b8:e7:01:
 
b6:58:7e:39:d1:fa:8d:49:bd:ff:6b:a8:dd:ae:83:ed:bc:b2:
 
40:e3:a5:e0:fd:ae:3f:57:4d:ec:f3:21:34:b1:84:97:06:6f:
 
f4:7d:f4:1c:84:cc:bb:1c:1c:e7:7a:7d:2d:e9:49:60:93:12:
 
0d:9f:05:8c:8e:f9:cf:e8:9f:fc:15:c0:6e:e2:fe:e5:07:81:
 
82:fc
 
Here is the list of available SSLv2 ciphers:
 
RC4-MD5
 
  EXP-RC4-MD5
 
  RC2-CBC-MD5
 
  EXP-RC2-CBC-MD5
 
  DES-CBC-MD5
 
  DES-CBC3-MD5
 
RC4-64-MD5
 
The SSLv2 server offers 5 strong ciphers, but also 0 medium strength and 2 weak "export class" ciphers.
 
  The weak/medium ciphers may be chosen by an export-grade or badly configured client software. They only offer a limited protection against a brute force attack
 
Solution: disable those ciphers and upgrade your client software if necessary.
 
See http://support.microsoft.com/default.aspx?scid=kben-us216482
 
or http://httpd.apache.org/docs-2.0/mod/mod_ssl.html#sslciphersuite
 
This SSLv2 server also accepts SSLv3 connections.
 
This SSLv2 server also accepts TLSv1 connections.
 
 
Vulnerable hosts
 
(list of vulnerable hosts follows)
 
  
 +
====Example 3. Checking for Certificate information, Weak Ciphers and SSLv2 via nmap====
 +
nmap has two scripts for checking Certificate information, Weak Ciphers and SSLv2 [31].
 +
 +
<pre>
 +
$ nmap --script ssl-cert,ssl-enum-ciphers -p 443,465,993,995 www.example.com
 +
Starting Nmap 6.25 ( http://nmap.org ) at 2013-01-01 00:00 CEST
 +
Nmap scan report for www.example.com (127.0.0.1)
 +
Host is up (0.090s latency).
 +
rDNS record for 127.0.0.1: www.example.com
 +
PORT    STATE SERVICE
 +
443/tcp open  https
 +
| ssl-cert: Subject: commonName=www.example.org
 +
| Issuer: commonName=*******
 +
| Public Key type: rsa
 +
| Public Key bits: 1024
 +
| Not valid before: 2010-01-23T00:00:00+00:00
 +
| Not valid after:  2020-02-28T23:59:59+00:00
 +
| MD5:  *******
 +
|_SHA-1: *******
 +
| ssl-enum-ciphers:
 +
|  SSLv3:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|  TLSv1.0:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|_  least strength: strong
 +
465/tcp open  smtps
 +
| ssl-cert: Subject: commonName=*.exapmple.com
 +
| Issuer: commonName=*******
 +
| Public Key type: rsa
 +
| Public Key bits: 2048
 +
| Not valid before: 2010-01-23T00:00:00+00:00
 +
| Not valid after:  2020-02-28T23:59:59+00:00
 +
| MD5:  *******
 +
|_SHA-1: *******
 +
| ssl-enum-ciphers:
 +
|  SSLv3:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|  TLSv1.0:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|_  least strength: strong
 +
993/tcp open  imaps
 +
| ssl-cert: Subject: commonName=*.exapmple.com
 +
| Issuer: commonName=*******
 +
| Public Key type: rsa
 +
| Public Key bits: 2048
 +
| Not valid before: 2010-01-23T00:00:00+00:00
 +
| Not valid after:  2020-02-28T23:59:59+00:00
 +
| MD5:  *******
 +
|_SHA-1: *******
 +
| ssl-enum-ciphers:
 +
|  SSLv3:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|  TLSv1.0:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|_  least strength: strong
 +
995/tcp open  pop3s
 +
| ssl-cert: Subject: commonName=*.exapmple.com
 +
| Issuer: commonName=*******
 +
| Public Key type: rsa
 +
| Public Key bits: 2048
 +
| Not valid before: 2010-01-23T00:00:00+00:00
 +
| Not valid after:  2020-02-28T23:59:59+00:00
 +
| MD5:  *******
 +
|_SHA-1: *******
 +
| ssl-enum-ciphers:
 +
|  SSLv3:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|  TLSv1.0:
 +
|    ciphers:
 +
|      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
 +
|      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
 +
|      TLS_RSA_WITH_RC4_128_SHA - strong
 +
|    compressors:
 +
|      NULL
 +
|_  least strength: strong
 +
Nmap done: 1 IP address (1 host up) scanned in 8.64 seconds
 
</pre>
 
</pre>
''' Example 3. ''' Manually audit weak SSL cipher levels with OpenSSL. The following will attempt to connect to Google.com with SSLv2.
 
  
 +
====Example 4 Checking for Client-initiated Renegotiation and Secure Renegotiation via openssl (manually)====
 +
openssl [30] can be used for testing manually SSL/TLS. In this example we try to initiate a renegotiation by client [m] connecting to server with openssl - writing the fist line of an HTTP request, in a new line typing “R”, waiting for renegotiaion and completing the HTTP request - and check if secure renegotiaion is supperted looking server output. Using manual request it is also possible to see if Compression is enabled for TLS in order to check for CRIME [13], check for ciphers and other vulnerabilities.
  
 
<pre>
 
<pre>
[root@test]# openssl s_client -no_tls1 -no_ssl3 -connect www.google.com:443
+
$ openssl s_client -connect www2.example.com:443
 
CONNECTED(00000003)
 
CONNECTED(00000003)
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
+
depth=2 ******
 
verify error:num=20:unable to get local issuer certificate
 
verify error:num=20:unable to get local issuer certificate
verify return:1
+
verify return:0
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
+
---
verify error:num=27:certificate not trusted
+
Certificate chain
verify return:1
+
0 s:******
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
+
  i:******
verify error:num=21:unable to verify the first certificate
+
1 s:******
verify return:1
+
  i:******
 +
2 s:******
 +
  i:******
 
---
 
---
 
Server certificate
 
Server certificate
 
-----BEGIN CERTIFICATE-----
 
-----BEGIN CERTIFICATE-----
MIIDYzCCAsygAwIBAgIQYFbAC3yUC8RFj9MS7lfBkzANBgkqhkiG9w0BAQQFADCB
+
******
zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ
 
Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE
 
CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh
 
d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl
 
cnZlckB0aGF3dGUuY29tMB4XDTA2MDQyMTAxMDc0NVoXDTA3MDQyMTAxMDc0NVow
 
aDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1v
 
dW50YWluIFZpZXcxEzARBgNVBAoTCkdvb2dsZSBJbmMxFzAVBgNVBAMTDnd3dy5n
 
b29nbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/e2Vs8U33fRDk
 
5NNpNgkB1zKw4rqTozmfwty7eTEI8PVH1Bf6nthocQ9d9SgJAI2WOBP4grPj7MqO
 
dXMTFWGDfiTnwes16G7NZlyh6peT68r7ifrwSsVLisJp6pUf31M5Z3D88b+Yy4PE
 
D7BJaTxq6NNmP1vYUJeXsGSGrV6FUQIDAQABo4GmMIGjMB0GA1UdJQQWMBQGCCsG
 
AQUFBwMBBggrBgEFBQcDAjBABgNVHR8EOTA3MDWgM6Axhi9odHRwOi8vY3JsLnRo
 
YXd0ZS5jb20vVGhhd3RlUHJlbWl1bVNlcnZlckNBLmNybDAyBggrBgEFBQcBAQQm
 
MCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wDAYDVR0TAQH/
 
BAIwADANBgkqhkiG9w0BAQQFAAOBgQADlTbBdVY6LD1nHWkhTadmzuWq2rWE0KO3
 
Ay+7EleYWPOo+EST315QLpU6pQgblgobGoI5x/fUg2U8WiYj1I1cbavhX2h1hda3
 
FJWnB3SiXaiuDTsGxQ267EwCVWD5bCrSWa64ilSJTgiUmzAv0a2W8YHXdG08+nYc
 
X/dVk5WRTw==
 
 
-----END CERTIFICATE-----
 
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
+
subject=******
issuer=/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected]
+
issuer=******
 
---
 
---
 
No client certificate CA names sent
 
No client certificate CA names sent
 
---
 
---
Ciphers common between both SSL endpoints:
+
SSL handshake has read 3558 bytes and written 640 bytes
RC4-MD5        EXP-RC4-MD5    RC2-CBC-MD5
 
EXP-RC2-CBC-MD5 DES-CBC-MD5    DES-CBC3-MD5
 
RC4-64-MD5
 
---
 
SSL handshake has read 1023 bytes and written 333 bytes
 
 
---
 
---
New, SSLv2, Cipher is DES-CBC3-MD5
+
New, TLSv1/SSLv3, Cipher is DES-CBC3-SHA
Server public key is 1024 bit
+
Server public key is 2048 bit
 +
Secure Renegotiation IS NOT supported
 
Compression: NONE
 
Compression: NONE
 
Expansion: NONE
 
Expansion: NONE
 
SSL-Session:
 
SSL-Session:
     Protocol  : SSLv2
+
     Protocol  : TLSv1
     Cipher    : DES-CBC3-MD5
+
     Cipher    : DES-CBC3-SHA
     Session-ID: 709F48E4D567C70A2E49886E4C697CDE
+
     Session-ID: ******
     Session-ID-ctx:
+
     Session-ID-ctx:  
     Master-Key: 649E68F8CF936E69642286AC40A80F433602E3C36FD288C3
+
     Master-Key: ******
     Key-Arg  : E8CB6FEB9ECF3033
+
     Key-Arg  : None
     Start Time: 1156977226
+
    PSK identity: None
 +
    PSK identity hint: None
 +
    SRP username: None
 +
     Start Time: ******
 
     Timeout  : 300 (sec)
 
     Timeout  : 300 (sec)
     Verify return code: 21 (unable to verify the first certificate)
+
     Verify return code: 20 (unable to get local issuer certificate)
 
---
 
---
closed
 
 
</pre>
 
</pre>
 +
Now we can write the first line of an HTTP request and then R in a new line.
 +
<pre>
 +
HEAD / HTTP/1.1
 +
R
 +
</pre>
 +
Server is renegotiating
 +
<pre>
 +
RENEGOTIATING
 +
depth=2 C******
 +
verify error:num=20:unable to get local issuer certificate
 +
verify return:0
 +
</pre>
 +
And we can complete our request, checking for response.
 +
<pre>
 +
HEAD / HTTP/1.1
  
''' Example 4. ''' Testing supported protocols and ciphers using SSLScan. <br>
+
HTTP/1.1 403 Forbidden ( The server denies the specified Uniform Resource Locator (URL). Contact the server administrator.  )
SSLScan is a free command line tool that scans a HTTPS service to enumerate what protocols (supports SSLv2, SSLv3 and TLS1) and what ciphers the HTTPS service supports. It runs both on Linux and Windows OS (OSX not tested) and is released under an open source license.  
+
Connection: close
 +
Pragma: no-cache
 +
Cache-Control: no-cache
 +
Content-Type: text/html
 +
Content-Length: 1792 
 +
 
 +
read:errno=0
 +
</pre>
 +
Even if the HEAD is not permitted, Client-intiated renegotiaion is permitted.
 +
 
 +
====Example 5. Testing supported Cipher Suites, BEAST and CRIME attacks via TestSSLServer====
 +
TestSSLServer [32] is a script which permits to check cipher suite and also BEAST and CRIME attacks. BEAST (Browser Exploit Against SSL/TLS)  exploits a vulnerability of CBC in TLS 1.0. CRIME (Compression Ratio Info-leak Made Easy) exploits a vulnerability of TLS Compression, that sould be disabled. It is really interesting a first fix for BEAST was the usage of RC4, but this is discouraged due to a crypto-analytical attack to RC4 [15].
 +
 
 +
An online tool to check for these attacks is SSL Labs, but can be used only for internet facing servers. Also consider that target data will be stored on SSL Labs server and also will result some connection from SSL Labs server [21].
 +
 
 +
<pre>
 +
$ java -jar TestSSLServer.jar www3.example.com 443
 +
Supported versions: SSLv3 TLSv1.0 TLSv1.1 TLSv1.2
 +
Deflate compression: no
 +
Supported cipher suites (ORDER IS NOT SIGNIFICANT):
 +
  SSLv3
 +
    RSA_WITH_RC4_128_SHA
 +
    RSA_WITH_3DES_EDE_CBC_SHA
 +
    DHE_RSA_WITH_3DES_EDE_CBC_SHA
 +
    RSA_WITH_AES_128_CBC_SHA
 +
    DHE_RSA_WITH_AES_128_CBC_SHA
 +
    RSA_WITH_AES_256_CBC_SHA
 +
    DHE_RSA_WITH_AES_256_CBC_SHA
 +
    RSA_WITH_CAMELLIA_128_CBC_SHA
 +
    DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
 +
    RSA_WITH_CAMELLIA_256_CBC_SHA
 +
    DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
 +
    TLS_RSA_WITH_SEED_CBC_SHA
 +
    TLS_DHE_RSA_WITH_SEED_CBC_SHA
 +
  (TLSv1.0: idem)
 +
  (TLSv1.1: idem)
 +
  TLSv1.2
 +
    RSA_WITH_RC4_128_SHA
 +
    RSA_WITH_3DES_EDE_CBC_SHA
 +
    DHE_RSA_WITH_3DES_EDE_CBC_SHA
 +
    RSA_WITH_AES_128_CBC_SHA
 +
    DHE_RSA_WITH_AES_128_CBC_SHA
 +
    RSA_WITH_AES_256_CBC_SHA
 +
    DHE_RSA_WITH_AES_256_CBC_SHA
 +
    RSA_WITH_AES_128_CBC_SHA256
 +
    RSA_WITH_AES_256_CBC_SHA256
 +
    RSA_WITH_CAMELLIA_128_CBC_SHA
 +
    DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
 +
    DHE_RSA_WITH_AES_128_CBC_SHA256
 +
    DHE_RSA_WITH_AES_256_CBC_SHA256
 +
    RSA_WITH_CAMELLIA_256_CBC_SHA
 +
    DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
 +
    TLS_RSA_WITH_SEED_CBC_SHA
 +
    TLS_DHE_RSA_WITH_SEED_CBC_SHA
 +
    TLS_RSA_WITH_AES_128_GCM_SHA256
 +
    TLS_RSA_WITH_AES_256_GCM_SHA384
 +
    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
 +
    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
 +
----------------------
 +
Server certificate(s):
 +
  ******
 +
----------------------
 +
Minimal encryption strength:    strong encryption (96-bit or more)
 +
Achievable encryption strength:  strong encryption (96-bit or more)
 +
BEAST status: vulnerable
 +
CRIME status: protected
 +
 
 +
</pre>
 +
 
 +
====Example 6.  Testing SSL/TLS vulnerabilities with sslyze====
 +
sslyze [33] is a python script which permits also mass scan and XML output. Follows an example of a regular scan. Is one of the most complete and versatile tool for SSL/TLS testing.
  
 
<pre>
 
<pre>
[user@test]$ ./SSLScan --no-failed mail.google.com
+
./sslyze.py --regular example.com:443
                  _
 
          ___ ___| |___  ___ __ _ _ __
 
          / __/ __| / __|/ __/ _` | '_ \
 
          \__ \__ \ \__ \ (_| (_| | | | |
 
          |___/___/_|___/\___\__,_|_| |_|
 
  
                  Version 1.9.0-win
+
REGISTERING AVAILABLE PLUGINS
            http://www.titania.co.uk
+
  -----------------------------
  Copyright 2010 Ian Ventura-Whiting / Michael Boman
 
    Compiled against OpenSSL 0.9.8n 24 Mar 2010
 
  
Testing SSL server mail.google.com on port 443
+
  PluginHSTS
 +
  PluginSessionRenegotiation
 +
  PluginCertInfo
 +
  PluginSessionResumption
 +
  PluginOpenSSLCipherSuites
 +
  PluginCompression
  
  Supported Server Cipher(s):
 
    accepted  SSLv3  256 bits  AES256-SHA
 
    accepted  SSLv3  128 bits  AES128-SHA
 
    accepted  SSLv3  168 bits  DES-CBC3-SHA
 
    accepted  SSLv3  128 bits  RC4-SHA
 
    accepted  SSLv3  128 bits  RC4-MD5
 
    accepted  TLSv1  256 bits  AES256-SHA
 
    accepted  TLSv1  128 bits  AES128-SHA
 
    accepted  TLSv1  168 bits  DES-CBC3-SHA
 
    accepted  TLSv1  128 bits  RC4-SHA
 
    accepted  TLSv1  128 bits  RC4-MD5
 
  
  Prefered Server Cipher(s):
 
    SSLv3  128 bits  RC4-SHA
 
    TLSv1  128 bits  RC4-SHA
 
  
  SSL Certificate:
+
CHECKING HOST(S) AVAILABILITY
    Version: 2
+
-----------------------------
    Serial Number: -4294967295
 
    Signature Algorithm: sha1WithRSAEncryption
 
    Issuer: /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 
    Not valid before: Dec 18 00:00:00 2009 GMT
 
    Not valid after: Dec 18 23:59:59 2011 GMT
 
    Subject: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com
 
    Public Key Algorithm: rsaEncryption
 
    RSA Public Key: (1024 bit)
 
      Modulus (1024 bit):
 
          00:d9:27:c8:11:f2:7b:e4:45:c9:46:b6:63:75:83:
 
          b1:77:7e:17:41:89:80:38:f1:45:27:a0:3c:d9:e8:
 
          a8:00:4b:d9:07:d0:ba:de:ed:f4:2c:a6:ac:dc:27:
 
          13:ec:0c:c1:a6:99:17:42:e6:8d:27:d2:81:14:b0:
 
          4b:82:fa:b2:c5:d0:bb:20:59:62:28:a3:96:b5:61:
 
          f6:76:c1:6d:46:d2:fd:ba:c6:0f:3d:d1:c9:77:9a:
 
          58:33:f6:06:76:32:ad:51:5f:29:5f:6e:f8:12:8b:
 
          ad:e6:c5:08:39:b3:43:43:a9:5b:91:1d:d7:e3:cf:
 
          51:df:75:59:8e:8d:80:ab:53
 
      Exponent: 65537 (0x10001)
 
    X509v3 Extensions:
 
      X509v3 Basic Constraints: critical
 
        CA:FALSE      X509v3 CRL Distribution Points:
 
        URI:http://crl.thawte.com/ThawteSGCCA.crl
 
      X509v3 Extended Key Usage:
 
        TLS Web Server Authentication, TLS Web Client Authentication, Netscape Server Gated Crypto      Authority Information Access:
 
        OCSP - URI:http://ocsp.thawte.com
 
        CA Issuers - URI:http://www.thawte.com/repository/Thawte_SGC_CA.crt
 
  Verify Certificate:
 
    unable to get local issuer certificate
 
  
 +
  example.com:443                      => 127.0.0.1:443
  
Renegotiation requests supported
 
</pre>
 
  
''' Example 5. ''' Testing common SSL flaws with ssl_tests <br>
 
ssl_tests (http://www.pentesterscripting.com/discovery/ssl_tests) is a bash script that uses sslscan and openssl to check for various flaws - ssl version 2, weak ciphers, md5withRSAEncryption,SSLv3 Force Ciphering Bug/Renegotiation.
 
  
<pre>
+
SCAN RESULTS FOR EXAMPLE.COM:443 - 127.0.0.1:443
[user@test]$ ./ssl_test.sh 192.168.1.3 443
+
---------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++
+
 
SSL Tests - v2, weak ciphers, MD5, Renegotiation
+
  * Compression :
by Aung Khant, http://yehg.net
+
        Compression Support:      Disabled
+++++++++++++++++++++++++++++++++++++++++++++++++
+
 
 +
  * Session Renegotiation :
 +
      Client-initiated Renegotiations:    Rejected
 +
      Secure Renegotiation:              Supported
 +
 
 +
  * Certificate :
 +
      Validation w/ Mozilla's CA Store:  Certificate is NOT Trusted: unable to get local issuer certificate
 +
      Hostname Validation:              MISMATCH                         
 +
      SHA1 Fingerprint:                  ******
 +
 
 +
      Common Name:                      www.example.com                   
 +
      Issuer:                            ******
 +
      Serial Number:                    ****                             
 +
      Not Before:                        Sep 26 00:00:00 2010 GMT         
 +
      Not After:                        Sep 26 23:59:59 2020 GMT 
 +
     
 +
      Signature Algorithm:              sha1WithRSAEncryption             
 +
      Key Size:                          1024 bit                         
 +
      X509v3 Subject Alternative Name:  {'othername': ['<unsupported>'], 'DNS': ['www.example.com']}
 +
 
 +
  * OCSP Stapling :
 +
      Server did not send back an OCSP response.                                 
 +
 
 +
  * Session Resumption :
 +
      With Session IDs:          Supported (5 successful, 0 failed, 0 errors, 5 total attempts).
 +
      With TLS Session Tickets:  Supported
 +
 
 +
  * SSLV2 Cipher Suites :
 +
 
 +
      Rejected Cipher Suite(s): Hidden
 +
 
 +
      Preferred Cipher Suite: None   
 +
 
 +
      Accepted Cipher Suite(s): None 
 +
 
 +
      Undefined - An unexpected error happened: None
 +
 
 +
  * SSLV3 Cipher Suites :
 +
 
 +
      Rejected Cipher Suite(s): Hidden
 +
 
 +
      Preferred Cipher Suite:         
 +
        RC4-SHA                      128 bits      HTTP 200 OK                       
 +
 
 +
      Accepted Cipher Suite(s):       
 +
        CAMELLIA256-SHA              256 bits      HTTP 200 OK                       
 +
        RC4-SHA                      128 bits      HTTP 200 OK                       
 +
        CAMELLIA128-SHA              128 bits      HTTP 200 OK                       
 +
 
 +
      Undefined - An unexpected error happened: None
 +
 
 +
  * TLSV1_1 Cipher Suites :
 +
 
 +
      Rejected Cipher Suite(s): Hidden
 +
 
 +
      Preferred Cipher Suite: None   
 +
 
 +
      Accepted Cipher Suite(s): None 
 +
 
 +
      Undefined - An unexpected error happened:  
 +
        ECDH-RSA-AES256-SHA            socket.timeout - timed out       
 +
        ECDH-ECDSA-AES256-SHA          socket.timeout - timed out       
 +
 
 +
  * TLSV1_2 Cipher Suites :
  
[*] testing on 192.168.1.3:443 ..
+
      Rejected Cipher Suite(s): Hidden
  
[*] tesing for sslv2 ..
+
      Preferred Cipher Suite: None      
[*] sslscan 192.168.1.3:443 | grep Accepted  SSLv2
 
     Accepted  SSLv2  168 bits  DES-CBC3-MD5
 
    Accepted  SSLv2  56 bits  DES-CBC-MD5
 
    Accepted  SSLv2  40 bits  EXP-RC2-CBC-MD5
 
    Accepted  SSLv2  128 bits  RC2-CBC-MD5
 
    Accepted  SSLv2  40 bits  EXP-RC4-MD5
 
    Accepted  SSLv2  128 bits  RC4-MD5
 
  
 +
      Accepted Cipher Suite(s): None 
  
[*] testing for weak ciphers ...
+
      Undefined - An unexpected error happened:  
[*] sslscan 192.168.1.3:443 | grep  40 bits | grep Accepted
+
        ECDH-RSA-AES256-GCM-SHA384      socket.timeout - timed out       
    Accepted  SSLv2  40 bits  EXP-RC2-CBC-MD5
+
        ECDH-ECDSA-AES256-GCM-SHA384    socket.timeout - timed out       
    Accepted  SSLv2  40 bits  EXP-RC4-MD5
 
    Accepted  SSLv3  40 bits  EXP-EDH-RSA-DES-CBC-SHA
 
    Accepted  SSLv3  40 bits  EXP-DES-CBC-SHA
 
    Accepted  SSLv3  40 bits  EXP-RC2-CBC-MD5
 
    Accepted  SSLv3  40 bits  EXP-RC4-MD5
 
    Accepted  TLSv1  40 bits  EXP-EDH-RSA-DES-CBC-SHA
 
    Accepted  TLSv1  40 bits  EXP-DES-CBC-SHA
 
    Accepted  TLSv1  40 bits  EXP-RC2-CBC-MD5
 
    Accepted  TLSv1  40 bits  EXP-RC4-MD5
 
  
[*] sslscan 192.168.1.3:443 | grep  56 bits | grep Accepted
+
  * TLSV1 Cipher Suites :
    Accepted  SSLv2  56 bits  DES-CBC-MD5
 
    Accepted  SSLv3  56 bits  EDH-RSA-DES-CBC-SHA
 
    Accepted  SSLv3  56 bits  DES-CBC-SHA
 
    Accepted  TLSv1  56 bits  EDH-RSA-DES-CBC-SHA
 
    Accepted  TLSv1  56 bits  DES-CBC-SHA
 
  
 +
      Rejected Cipher Suite(s): Hidden
  
[*] testing for MD5 certificate ..
+
      Preferred Cipher Suite:         
[*] sslscan 192.168.1.3:443 | grep MD5WithRSAEncryption
+
        RC4-SHA                      128 bits      Timeout on HTTP GET               
  
[*] testing for SSLv3 Force Ciphering Bug/Renegotiation ..
+
      Accepted Cipher Suite(s):       
[*] echo R | openssl s_client -connect 192.168.1.3:443 | grep DONE
+
        CAMELLIA256-SHA              256 bits      HTTP 200 OK                       
depth=0 /C=DE/ST=Berlin/L=Berlin/O=XAMPP/OU=XAMPP/CN=localhost/emailAddress=admin@localhost
+
        RC4-SHA                      128 bits      HTTP 200 OK                       
verify error:num=18:self signed certificate
+
        CAMELLIA128-SHA              128 bits      HTTP 200 OK                       
verify return:1
 
depth=0 /C=DE/ST=Berlin/L=Berlin/O=XAMPP/OU=XAMPP/CN=localhost/emailAddress=admin@localhost
 
verify return:1
 
RENEGOTIATING
 
depth=0 /C=DE/ST=Berlin/L=Berlin/O=XAMPP/OU=XAMPP/CN=localhost/emailAddress=admin@localhost
 
verify error:num=18:self signed certificate
 
verify return:1
 
depth=0 /C=DE/ST=Berlin/L=Berlin/O=XAMPP/OU=XAMPP/CN=localhost/emailAddress=admin@localhost
 
verify return:1
 
DONE
 
  
 +
      Undefined - An unexpected error happened:
 +
        ADH-CAMELLIA256-SHA            socket.timeout - timed out       
  
[*] done
 
</pre>
 
  
'''Example 6.''' Testing common SSL flaws with SSL Server Test<br>
 
SSL Server Test (https://www.ssllabs.com/ssltest/index.html) is a free online service, provided by Qualys SSL Labs, that performs a deep analysis of the configuration of any SSL web server on the public Internet. It’s a very easy to use but powerful tool. You have only to provide to the tool the URL of the website that you have to test, and the tool returns a lot of information about the protocols and cipher suites support by the server, with details about any flaws found.
 
  
 +
SCAN COMPLETED IN 9.68 S
 +
------------------------
 +
</pre>
  
 
===Testing SSL certificate validity – client and server===
 
===Testing SSL certificate validity – client and server===
 +
Firstly upgrade your browser because also CA certs expire and, in every release of the browser, these are been renewed.
 +
Examine the validity of the certificates used by the application. Browsers will issue a warning when encountering expired certificates, certificates issued by untrusted CAs, and certificates which do not match namewise with the site to which they should refer. By clicking on the padlock which appears in the browser window when visiting an HTTPS site, you can look at information related to the certificate – including the issuer, period of validity, encryption characteristics, etc. If the application requires a client certificate, you probably have installed one to access it. Certificate information is available in the browser by inspecting the relevant certificate(s) in the list of the installed certificates.
 +
These checks must be applied to all visible SSL-wrapped communication channels used by the application. Though this is the usual https service running on port 443, there may be additional services involved depending on the web application architecture and on deployment issues (an HTTPS administrative port left open, HTTPS services on non-standard ports, etc.). Therefore, apply these checks to all SSL-wrapped ports which have been discovered. For example, the nmap scanner features a scanning mode (enabled by the –sV command line switch) which identifies SSL-wrapped services. The Nessus vulnerability scanner has the capability of performing SSL checks on all SSL/TLS-wrapped services.
  
Firstly upgrade your browser because also CA certs expire and, in every release of the browser, these are been renewed.<br>
+
Some tools, as in previous examples, check also for certificate validity.
Examine the validity of the certificates used by the application. Browsers will issue a warning when encountering expired certificates, certificates issued by untrusted CAs, and certificates which do not match namewise with the site to which they should refer. By clicking on the padlock which appears in the browser window when visiting an HTTPS site, you can look at information related to the certificate – including the issuer, period of validity, encryption characteristics, etc.
 
If the application requires a client certificate, you probably have installed one to access it. Certificate information is available in the browser by inspecting the relevant certificate(s) in the list of the installed certificates. <br>
 
These checks must be applied to all visible SSL-wrapped communication channels used by the application. Though this is the usual https service running on port 443, there may be additional services involved depending on the web application architecture and on deployment issues (an HTTPS administrative port left open, HTTPS services on non-standard ports, etc.). Therefore, apply these checks to all SSL-wrapped ports which have been discovered. For example, the nmap scanner features a scanning mode (enabled by the –sV command line switch) which identifies SSL-wrapped services. The Nessus vulnerability scanner has the capability of performing SSL checks on all SSL/TLS-wrapped services. <br>
 
  
'''Examples'''
+
====Example 7. Testing for certificate validity (manually)====
Rather than providing a fictitious example, we have inserted an anonymized real-life example to stress how frequently one stumbles on https sites whose certificates are inaccurate with respect to naming. <br>
+
Rather than providing a fictitious example, we have inserted an anonymized real-life example to stress how frequently one stumbles on https sites whose certificates are inaccurate with respect to naming.  
The following screenshots refer to a regional site of a high-profile IT company. <br>
+
The following screenshots refer to a regional site of a high-profile IT company.  
<u>Warning issued by Microsoft Internet Explorer</u>. We are visiting an .it site and the certificate was issued to a .com site! Internet Explorer warns that the name on the certificate does not match the name of the site. <br>
 
  
 +
We are visiting an .it site and the certificate was issued to a .com site! Internet Explorer warns that the name on the certificate does not match the name of the site.
  
 
[[Image:SSL Certificate Validity Testing IE Warning.gif]]
 
[[Image:SSL Certificate Validity Testing IE Warning.gif]]
 +
''Warning issued by Microsoft Internet Explorer''
  
<u>Warning issued by Mozilla Firefox</u>. The message issued by Firefox is different – Firefox complains because it cannot ascertain the identity of the .com site the certificate refers to because it does not know the CA which signed the certificate. In fact, Internet Explorer and Firefox do not come preloaded with the same list of CAs. Therefore, the behavior experienced with various browsers may differ.
+
The message issued by Firefox is different – Firefox complains because it cannot ascertain the identity of the .com site the certificate refers to because it does not know the CA which signed the certificate. In fact, Internet Explorer and Firefox do not come preloaded with the same list of CAs. Therefore, the behavior experienced with various browsers may differ.
  
 
[[Image:SSL Certificate Validity Testing Firefox Warning.gif]]
 
[[Image:SSL Certificate Validity Testing Firefox Warning.gif]]
 +
''Warning issued by Mozilla Firefox''
  
 
===Testing for other vulnerabilities===
 
===Testing for other vulnerabilities===
As mentioned previously there are other types of vulnerabilities that are not related with the SSL/TLS protocol used or the cipher suite. These vulnerabilities are possible when the server provide the website both with the HTTP and HTTPS protocols, and permit to an attacker to force a victim into using a non-secure channel instead of a secure one.<br>
+
As mentioned previously there are other types of vulnerabilities that are not related with the SSL/TLS protocol used, the cipher suites or Certificates. A part from others discussed in other parts of the Guide, the another one is possible when the server provide the website both with the HTTP and HTTPS protocols, and permit to an attacker to force a victim into using a non-secure channel instead of a secure one.
  
'''Surf Jacking'''
+
====Surf Jacking====
Surf Jackin attack [6] was first presented by Sandro Gauci and permits to an attacker to hijack an HTTP session even when the victim’s connection is encrypted using SSL or TLS.<br>
+
Surf Jacking attack [7] was first presented by Sandro Gauci and permits to an attacker to hijack an HTTP session even when the victim’s connection is encrypted using SSL or TLS.
The following is a scenario of how the attack can take place:<br>
+
The following is a scenario of how the attack can take place:
 +
 
 +
The following is a scenario of how the attack can take place:
 
* Victim logs into the secure website at https://somesecuresite/.
 
* Victim logs into the secure website at https://somesecuresite/.
 
* The secure site issues a session cookie as the client logs in.
 
* The secure site issues a session cookie as the client logs in.
Line 390: Line 558:
 
# Check if cookies do not have the “Secure” flag
 
# Check if cookies do not have the “Secure” flag
  
<br>
+
====SSL Strip====
 +
Often applications supports both HTTP and HTTPS. As for usability or because users do not use to type “https://www.example.com”. Often users go into an HTTPS website from link or a redirect. Typically also home banking site have a similar configuration with an iframed login or a form with action attribute over HTTPS but the page under HTTP.
 +
An attacker in a privileged position - as described in SSL strip [8] - can incercept traffic when user is into HTTP and manipulate it to get a Man-In-The-Middle attack under HTTPS.
 +
To test if application is vulnerable is sufficient the website supports both HTTP and HTTPS.
 +
 
 
== Gray Box testing and example ==
 
== Gray Box testing and example ==
<br>
 
  
===Testing for Weak SSL/TSL Ciphers===
+
===Testing for Weak SSL/TSL Cipher Suites===
<br>
+
Check the configuration of the web servers which provide https services. If the web application provides other SSL/TLS wrapped services, these should be checked as well.  
Check the configuration of the web servers which provide https services. If the web application provides other SSL/TLS wrapped services, these should be checked as well. <br>
+
 
'''Example 1:''' The following registry path in Microsoft Windows Server 2003 and Microsoft Windows Server 2008 defines the ciphers available to the server:  
+
====Example 8. Windows Server====
<pre>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\ </pre>
+
Check the configuration on a Microsoft Windows Server (2000, 2003 and 2008) using the registry key:
'''Example 2: ''' To check the cipher suites and protocols supported by Apache2 web server open the ''ssl.conf'' file and search for the <code>SSLCipherSuite</code> and <code>SSLProtocol</code> directives.<br>
+
<pre>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\</pre>
 +
which has some sub-keys like Ciphers, Protocols and KeyExchangeAlgorithms.
 +
 
 +
====Example 9: Apache====
 +
To check the cipher suites and protocols supported by Apache2 web server open the ssl.conf file and search for the SSLCipherSuite, SSLProtocol, SSLHonorCipherOrder,SSLInsecureRenegotiation and SSLCompression directives.
  
 
===Testing SSL certificate validity – client and server===
 
===Testing SSL certificate validity – client and server===
<br>
 
 
Examine the validity of the certificates used by the application at both server and client levels. The usage of certificates is primarily at the web server level; however, there may be additional communication paths protected by SSL (for example, towards the DBMS). You should check the application architecture to identify all SSL protected channels.
 
Examine the validity of the certificates used by the application at both server and client levels. The usage of certificates is primarily at the web server level; however, there may be additional communication paths protected by SSL (for example, towards the DBMS). You should check the application architecture to identify all SSL protected channels.
 
<br><br>
 
  
 
==References==
 
==References==
'''OWASP Resources'''<br>
+
'''OWASP Resources'''
* [[Transport_Layer_Protection_Cheat_Sheet]]
+
* [5] [OWASP Testing Guide - Testing for cookie attributes (OTG-SESS-002)|https://www.owasp.org/index.php/Testing_for_cookies_attributes_(OWASP-SM-002)]
 
+
* [4][OWASP Testing Guide - Test Network/Infrastructure Configuration (OTG-CONFIG-001)|https://www.owasp.org/index.php/Testing_for_infrastructure_configuration_management_(OWASP-CM-003)]
'''Whitepapers'''<br>
+
* [6] [OWASP Testing |https://www.owasp.org/index.php/Testing_for_cookies_attributes_(OWASP-SM-002)][Guide - Testing for Missing HSTS header (OTG-CONFIG-009)|https://www.owasp.org/index.php/Testing_for_Missing_HSTS_header]
* [1] RFC5246. The Transport Layer Security (TLS) Protocol Version 1.2 (Updated by RFC 5746, RFC 5878, RFC 6176) - http://www.ietf.org/rfc/rfc5246.txt
+
* [2] [OWASP Testing Guide - Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-007)|https://www.owasp.org/index.php?title=Testing_for_Sensitive_information_sent_via_unencrypted_channels_(OTG-CRYPST-007)&action=edit&redlink=1]
* [2] RFC2817. Upgrading to TLS Within HTTP/1.1 - http://www.ietf.org/rfc/rfc2817.txt
+
* [3] [OWASP Testing Guide - Testing for Credentials Transported over an Encrypted Channel (OWASP-AT-001)|https://www.owasp.org/index.php/Testing_for_Credentials_Transported_over_an_Encrypted_Channel_(OWASP-AT-001)]
* [3] RFC6066. Transport Layer Security (TLS) Extensions: Extension Definitions - http://www.ietf.org/rfc/rfc6066.txt
+
* [9] [OWASP Testing Guide - Test Content Security Policy (OTG-CONFIG-008)|https://www.owasp.org/index.php/Testing_for_Content_Security_Policy_weakness]
* [4] https://www.ssllabs.com/projects/best-practices/
+
* [22] [OWASP Cheat sheet - Transport Layer Protection|https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet]
* [5] https://www.ssllabs.com/projects/rating-guide/index.html
+
* [23] [OWASP TOP 10 2013 - A6 Sensitive Data Exposure|https://www.owasp.org/index.php/Top_10_2013-A6-Sensitive_Data_Exposure]
* [6] https://resources.enablesecurity.com/resources/Surf%20Jacking.pdf
+
* [24] [OWASP TOP 10 2010 - A9 Insufficient Transport Layer Protection|https://www.owasp.org/index.php/Top_10_2010-A9-Insufficient_Transport_Layer_Protection]
 +
* [25] [OWASP ASVS 2009 - Verification 10|https://code.google.com/p/owasp-asvs/wiki/Verification_V10]
 +
* [26] [OWASP Application Security FAQ - Cryptography/SSL|https://www.owasp.org/index.php/OWASP_Application_Security_FAQ#Cryptography.2FSSL]
  
 +
'''Whitepapers'''
 +
* [1] [RFC5246 - The Transport Layer Security (TLS) Protocol Version 1.2 (Updated by RFC 5746, RFC 5878, RFC 6176)|http://www.ietf.org/rfc/rfc5246.txt]
 +
* [33] [RFC2817 - Upgrading to TLS Within HTTP/1.1|]
 +
* [34] [RFC6066 - Transport Layer Security (TLS) Extensions: Extension Definitions|http://www.ietf.org/rfc/rfc6066.txt]
 +
* [11] [SSLv2 Protocol Multiple Weaknesses |http://osvdb.org/56387]
 +
* [12] [Mitre - TLS Renegotiation MiTM|http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3555]
 +
* [13] [Qualys SSL Labs - TLS Renegotiation DoS|https://community.qualys.com/blogs/securitylabs/2011/10/31/tls-renegotiation-and-denial-of-service-attacks]
 +
* [10] [Qualys SSL Labs - SSL/TLS Deployment Best Practices|https://www.ssllabs.com/projects/best-practices/index.html]
 +
* [14] [Qualys SSL Labs - SSL Server Rating Guide|https://www.ssllabs.com/projects/rating-guide/index.html]
 +
* [20] [Qualys SSL Labs - SSL Threat Model|https://www.ssllabs.com/projects/ssl-threat-model/index.html]
 +
* [18] [Qualys SSL Labs - Forward Secrecy|https://community.qualys.com/blogs/securitylabs/2013/06/25/ssl-labs-deploying-forward-secrecy]
 +
* [15] [Qualys SSL Labs - RC4 Usage|https://community.qualys.com/blogs/securitylabs/2013/03/19/rc4-in-tls-is-broken-now-what]
 +
* [16] [Qualys SSL Labs - BEAST|https://community.qualys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls]
 +
* [17] [Qualys SSL Labs - CRIME|https://community.qualys.com/blogs/securitylabs/2012/09/14/crime-information-leakage-attack-against-ssltls]
 +
* [7] [SurfJacking attack|https://resources.enablesecurity.com/resources/Surf%20Jacking.pdf]
 +
* [8] [SSLStrip attack|http://www.thoughtcrime.org/software/sslstrip/]
 +
* [19] [PCI-DSS v2.0|https://www.pcisecuritystandards.org/security_standards/documents.php]
  
 
'''Tools'''
 
'''Tools'''
 
+
* [21][Qualys SSL Labs - SSL Server Test|https://www.ssllabs.com/ssltest/index.html]: internet facing scanner
* https://www.ssllabs.com/ssldb/
+
* [27] [Tenable - Nessus Vulnerability Scanner|http://www.tenable.com/products/nessus]: includes some plugins to test different SSL related vulnerabilities, Certificates and the presence of HTTP Basic authentication without SSL.
 
+
* [32] [TestSSLServer|http://www.bolet.org/TestSSLServer/]: a java scanner - and also windows executable - includes tests for cipher suites, CRIME and BEAST
* Vulnerability scanners may include checks regarding certificate validity, including name mismatch and time expiration. They usually report other information as well, such as the CA which issued the certificate. Remember that there is no unified notion of a “trusted CA”; what is trusted depends on the configuration of the software and on the human assumptions made beforehand. Browsers come with a preloaded list of trusted CAs. If your web application relies on a CA which is not in this list (for example, because you rely on a self-made CA), you should take into account the process of configuring user browsers to recognize the CA.
+
* [33] [sslyze|https://github.com/iSECPartners/sslyze]: is a python script to check vulnerabilities in SSL/TLS.
 
+
* [28] [SSLAudit|https://code.google.com/p/sslaudit/]: a perl script/windows executable scanner which follows Qualys SSL Labs Rating Guide.
* The Nessus scanner includes a plugin to check for expired certificates or certificates which are going to expire within 60 days (plugin “SSL certificate expiry”, plugin id 15901). This plugin will check certificates ''installed on the server.
+
* [29] [SSLScan|http://sourceforge.net/projects/sslscan/] with [SSL Tests|http://www.pentesterscripting.com/discovery/ssl_tests]: a SSL Scanner and a wrapper in order to enumerate SSL vulnerabilities.
 
+
* [31] [nmap|http://nmap.org/]: can be used primary to identify SSL-based services and then to check Certificate and SSL/TLS vulnerabilities. In particular it has some scripts to check [Certificate and SSLv2|http://nmap.org/nsedoc/scripts/ssl-cert.html] and supported [SSL/TLS protocols/ciphers|http://nmap.org/nsedoc/scripts/ssl-enum-ciphers.html] with an internal rating.
* Vulnerability scanners may include checks against weak ciphers. For example, the Nessus scanner (http://www.nessus.org) has this capability and flags the presence of SSL weak ciphers (see example provided above).
+
* [30] [curl|http://curl.haxx.se/] and [openssl|http://www.openssl.org/]: can be used to query manually SSL/TLS services
 
+
* [9] [Stunnel|http://www.stunnel.org]: a noteworthy class of SSL clients is that of SSL proxies such as stunnel available at which can be used to allow non-SSL enabled tools to talk to SSL services)
* You may also rely on specialized tools such as SSL Digger (http://www.mcafee.com/us/downloads/free-tools/ssldigger.aspx), or – for the command line oriented – experiment with the openssl tool, which provides access to OpenSSL cryptographic functions directly from a Unix shell (may be already available on *nix boxes, otherwise see www.openssl.org).
 
 
 
* To identify SSL-based services, use a vulnerability scanner or a port scanner with service recognition capabilities. The nmap scanner features a “-sV” scanning option which tries to identify services, while the nessus vulnerability scanner has the capability of identifying SSL-based services on arbitrary ports and to run vulnerability checks on them regardless of whether they are configured on standard or non-standard ports.
 
 
 
* In case you need to talk to a SSL service but your favourite tool doesn’t support SSL, you may benefit from a SSL proxy such as stunnel; stunnel will take care of tunneling the underlying protocol (usually http, but not necessarily so) and communicate with the SSL service you need to reach.
 
 
 
* ssl_tests, http://www.pentesterscripting.com/discovery/ssl_tests
 
 
 
* Finally, a word of advice. Though it may be tempting to use a regular browser to check certificates, there are various reasons for not doing so. Browsers have been plagued by various bugs in this area, and the way the browser will perform the check might be influenced by configuration settings that may not be evident. Instead, rely on vulnerability scanners or on specialized tools to do the job.
 
 
 
* [http://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet OWASP Transport Layer Protection Cheat Sheet]
 
  
 
[[Category:Cryptographic Vulnerability]]
 
[[Category:Cryptographic Vulnerability]]
 
[[Category:SSL]]
 
[[Category:SSL]]

Revision as of 09:51, 24 August 2013

This article is part of the new OWASP Testing Guide v4.
Back to the OWASP Testing Guide v4 ToC: https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents Back to the OWASP Testing Guide Project: https://www.owasp.org/index.php/OWASP_Testing_Project


Brief Summary

Sensitive data must be protected when it is transmitted through the network. These data includes credentials and credit cards. As a rule of thumb if data must be protected when it is stored, it must be protected also during transmission.

HTTP is a clear-text protocol and it is normally secured via an SSL/TLS tunnel, resulting in HTTPS traffic [1]. Use of these protocols ensure not only confidentiality but also authentication. Servers are authenticated using digital certificates, and it is also possibile to use client certificate for mutual authentication.

Even if high grade ciphers are today supported and normally used, some misconfiguration in server can be used to force the use of a weak cipher - or at worst no encryption - permitting to an attacker to gain access to the supposed secure communication channel. Other misconfiguration can be used for a Denial of Service attack.

Description of the Issue

If control is missed and HTTP protocol is used to transmit sensitive information is a vulnerability [2] (e.g. credentials transmitted over HTTP [3]) and there are a specific OWASP Testing Guide v4’s test.

If SSL/TLS service is present it is good but it increments the attack surface and some vulnerabilities insist on it, such as:

  • SSL/TLS protocols, ciphers, keys and renegotiation must be properly configured.
  • Certificate validity must be ensured.

Other vulnerabilities linked to this is:

  • Software exposed must be updated due to possibility of known vulnerabilities [4].
  • Usage of Secure flag for Session Cookies [5].
  • Usage of HTTP Strict Transport Security (HSTS) [6].
  • The presence of HTTP and HTTPS both, which can be used to intercept traffic [7], [8].
  • The presence of mixed HTTP and HTTP content in the same page, which can be used to Leak information.

Sensitive data transmitted in clear-text

If the application transmits sensitive information via unencrypted channes - e.g. HTTP - it is a vulnerability. Typically it is possible to find BASIC authentication over HTTP, input password sent via HTTP and, in general, other information considered by regulations, laws or organization policy.

Weak SSL/TSL Ciphers/Protocols/Keys

Historically, there have been limitations set in place by the U.S. government to allow cryptosystems to be exported only for key sizes of at most 40 bits, a key length which could be broken and would allow the decryption of communications. Since then cryptographic export regulations have been relaxed the maximum key size is 128 bits. It is important to check the SSL configuration being used to avoid putting in place cryptographic support which could be easily defeated. To reach this goal SSL-based services should not offer the possibility to choose weak cipher suite. A cipher suite is specified by an encryption protocol (e.g. DES, RC4, AES), the encryption key length (e.g. 40, 56, or 128 bits), and a hash algorithm (e.g. SHA, MD5) used for integrity checking. Briefly, the key points for the cipher suite determination are the following:

  1. The client sends to the server a ClientHello message specifying, among other information, the protocol and the cipher suites that it is able to handle. Note that a client is usually a web browser (most popular SSL client nowadays), but not necessarily, since it can be any SSL-enabled application; the same holds for the server, which needs not to be a web server, though this is the most common case [9].
  2. The server responds with a ServerHello message, containing the chosen protocol and cipher suite that will be used for that session (in general the server selects the strongest protocol and cipher suite supported by both the client and server).

It is possible (for example, by means of configuration directives) to specify which cipher suites the server will honor. In this way you may control, for example, whether or not conversations with clients will support 40-bit encryption only.

  1. The server sends its Certificate message and, if client authentication is required, also sends a CertificateRequest message to the client.
  2. The server sends a ServerHelloDone message and waits for a client response.
  3. Upon receipt of the ServerHelloDone message, the client verifies the validity of the server's digital certificate.

SSL certificate validity – client and server

When accessing a web application via the HTTPS protocol, a secure channel is established between the client and the server. The identity of one (the server) or both parties (client and server) is then established by means of digital certificates. So, once the cipher suite is determined, the “SSL Handshake” continues with the exchange of the certificates, like follow:

  1.  The server sends its Certificate message and, if client authentication is required, also sends a CertificateRequest message to the client.
  2.  The server sends a ServerHelloDone message and waits for a client response.
  3.  Upon receipt of the ServerHelloDone message, the client verifies the validity of the server's digital certificate.

In order for the communication to be set up, a number of checks on the certificates must be passed. While discussing SSL and certificate based authentication is beyond the scope of this Guide, we will focus on the main criteria involved in ascertaining certificate validity:

  • Checking if the Certificate Authority (CA) is a known one (meaning one considered trusted);
  • Checking that the certificate is currently valid;
  • Checking that the name of the site and the name reported in the certificate match.

Let is examine each check more in detail.

  • Each browser comes with a preloaded list of trusted CAs, against which the certificate signing CA is compared (this list can be customized and expanded at will). During the initial negotiations with an HTTPS server, if the server certificate relates to a CA unknown to the browser, a warning is usually raised. This happens most often because a web application relies on a certificate signed by a self-established CA. Whether this is to be considered a concern depends on several factors. For example, this may be fine for an Intranet environment (think of corporate web email being provided via HTTPS; here, obviously all users recognize the internal CA as a trusted CA). When a service is provided to the general public via the Internet, however (i.e. when it is important to positively verify the identity of the server we are talking to), it is usually imperative to rely on a trusted CA, one which is recognized by all the user base (and here we stop with our considerations; we won’t delve deeper in the implications of the trust model being used by digital certificates).
  • Certificates have an associated period of validity, therefore they may expire. Again, we are warned by the browser about this. A public service needs a temporally valid certificate; otherwise, it means we are talking with a server whose certificate was issued by someone we trust, but has expired without being renewed.
  • What if the name on the certificate and the name of the server do not match? If this happens, it might sound suspicious. For a number of reasons, this is not so rare to see. A system may host a number of name-based virtual hosts, which share the same IP address and are identified by means of the HTTP 1.1 Host: header information. In this case, since the SSL handshake checks the server certificate before the HTTP request is processed, it is not possible to assign different certificates to each virtual server. Therefore, if the name of the site and the name reported in the certificate do not match, we have a condition which is typically signaled by the browser. To avoid this, IP-based virtual servers must be used. [33] and [34] describe techniques to deal with this problem and allow name-based virtual hosts to be correctly referenced.

Other vulnerabilities

The presence of a new service, listening in a separate tcp port may introduce vulnerabilities such as Infrastructure vulnerability if software is not up to date [4]. Futhermore for a correct protection of data during transmission Session Cookie must use the Secure flag [5] and some directives should be sent to the browser to accept only secure traffic (e.g. HSTS [6], CSP [9]).

Also there are some attacks can be used to intercept traffic if the web server exposes the application on both HTTP and HTTPS [6], [7] or in case of mixed HTTP and HTTPS resources in the same page.

Black Box testing and example

Testing for sensitive data transmitted in clear-text

Various typologies of information which must be protected can be also transmitted in clear text. It is possible to check if these information is transmitted over HTTP instead of HTTPS.

Please refer to specific Tests for full details, for credentials [3] and other kind of data [2].

Example 1. Basic Authentication over HTTP

A typical example is the usage of Basic Autentication over HTTP. Also because with Basic Autentication, after login, credentials are encoded - and not encrypted - into HTTP Headers.

$ curl -kis http://example.com/restricted/
HTTP/1.1 401 Authorization Required
Date: Fri, 01 Aug 2013 00:00:00 GMT
WWW-Authenticate: Basic realm="Restricted Area"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Length: 162
Content-Type: text/html

<html><head><title>401 Authorization Required</title></head>
<body bgcolor=white>
<h1>401 Authorization Required</h1>

Invalid login credentials!

</body></html>

Testing for Weak SSL/TSL Ciphers/Protocols/Keys vulnerabilities

Large number of available cipher suites and quick progress in cryptanalysis makes judging a SSL server a non-trivial task. At the time of writing these criteria are widely recognized as minimum checklist:

  • Weak ciphers must not be used (e.g. less than 128 bits [10]; no NULL ciphers suite, due to no encryption used; no Anonymous Diffie-Hellmann, due to not provides authentication).
  • Weak protocols must be disabled (e.g. SSLv2 must be disabled, due to known weaknesses in protocol design [11]).
  • Renegotiation must be properly configured (e.g. Insecure Renegotiation must be disabled, due to MiTM attacks [12] and Client-initiated Renegotiation must be disabled, due to Denial of Service vulnerability [13]).
  • No Export (EXP) level cipher suites, due to can be easly broken [10].
  • X.509 certificates key length must be strong (e.g. if RSA or DSA is used the key must be at least 1024 bits).
  • X.509 certificates must be signed only with secure hashing algoritms (e.g. not signed using MD5 hash, due to known collision attacks on this hash).
  • Keys must be generated with proper entropy (e.g, Weak Key Generated with Debian) [14].

A most complete checklist includes:

  • Secure Renegotiation should be enabled.
  • MD5 should not be used, due to known collision attacks, but it is ok the use with at least 128 bit key.
  • RC4 should not be used, due to crypto-analytical attacks [15].
  • Server should be protected from BEAST Attack [16].
  • Server should be protected from CRIME attack, TLS compression must be disabled [17].
  • Server should support Forward Secrecy [18].

Following standards can be used as reference while assessing SSL servers:

  • PCI-DSS v2.0 in point 4.1 requires compliant parties to use "strong cryptography" without precisely defining key lengths and algorithms. Common interpretation, partially based on previous versions of the standard, is that at least 128 bit key cipher, no export strength algorithms and no SSLv2 should be used [19].
  • Qualys SSL Labs Server Rating Guide [14], Depoloyment best practice [10] and SSL Threat Model [20] has been proposed to standardize SSL server assessment and configuration. But is less updated than the SSL Server tool [21].
  • OWASP has a lot of resources about SSL/TLS Security [22], [23], [24], [25]. [26].

Some tools and scanners both commercial - e.g. Tenable Nessus [27] - and free - e.g. SSLAudit [28] or SSLScan [29], and other used into examples - can be used to assess SSL/TLS vulnerabilities. But due to evolution of these vulnerabilities a good way is also to check them manually with openssl [30] or using tool’s output as an input for manual evaluation using the references on the bottom on the Test to stay updated.

Example 2. SSL service recognition via nmap

First step is to identify ports which have SSL/TLS wrapped services. Typically tcp ports with SSL for web and mail services are - but not limited to - 443 (https), 465 (ssmtp), 585 (imap4-ssl), 993 (imaps), 995 (ssl-pop). In this example we search for SSL services using nmap with “-sV” option, used for identify services and it is also able to identify SSL services [31]. Other options are for this particular example and must be customized. Often in a Web Application Penetration Test scope is limited to port 80 and 443.

$ nmap -sV --reason -PN -n --top-ports 100 www.example.com
Starting Nmap 6.25 ( http://nmap.org ) at 2013-01-01 00:00 CEST
Nmap scan report for www.example.com (127.0.0.1)
Host is up, received user-set (0.20s latency).
Not shown: 89 filtered ports
Reason: 89 no-responses
PORT    STATE SERVICE  REASON  VERSION
21/tcp  open  ftp      syn-ack Pure-FTPd
22/tcp  open  ssh      syn-ack OpenSSH 5.3 (protocol 2.0)
25/tcp  open  smtp     syn-ack Exim smtpd 4.80
26/tcp  open  smtp     syn-ack Exim smtpd 4.80
80/tcp  open  http     syn-ack
110/tcp open  pop3     syn-ack Dovecot pop3d
143/tcp open  imap     syn-ack Dovecot imapd
443/tcp open  ssl/http syn-ack Apache
465/tcp open  ssl/smtp syn-ack Exim smtpd 4.80
993/tcp open  ssl/imap syn-ack Dovecot imapd
995/tcp open  ssl/pop3 syn-ack Dovecot pop3d
Service Info: Hosts: example.com
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 131.38 seconds

Example 3. Checking for Certificate information, Weak Ciphers and SSLv2 via nmap

nmap has two scripts for checking Certificate information, Weak Ciphers and SSLv2 [31].

$ nmap --script ssl-cert,ssl-enum-ciphers -p 443,465,993,995 www.example.com
Starting Nmap 6.25 ( http://nmap.org ) at 2013-01-01 00:00 CEST
Nmap scan report for www.example.com (127.0.0.1)
Host is up (0.090s latency).
rDNS record for 127.0.0.1: www.example.com
PORT    STATE SERVICE
443/tcp open  https
| ssl-cert: Subject: commonName=www.example.org
| Issuer: commonName=*******
| Public Key type: rsa
| Public Key bits: 1024
| Not valid before: 2010-01-23T00:00:00+00:00
| Not valid after:  2020-02-28T23:59:59+00:00
| MD5:   *******
|_SHA-1: *******
| ssl-enum-ciphers: 
|   SSLv3: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|   TLSv1.0: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|_  least strength: strong
465/tcp open  smtps
| ssl-cert: Subject: commonName=*.exapmple.com
| Issuer: commonName=*******
| Public Key type: rsa
| Public Key bits: 2048
| Not valid before: 2010-01-23T00:00:00+00:00
| Not valid after:  2020-02-28T23:59:59+00:00
| MD5:   *******
|_SHA-1: *******
| ssl-enum-ciphers: 
|   SSLv3: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|   TLSv1.0: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|_  least strength: strong
993/tcp open  imaps
| ssl-cert: Subject: commonName=*.exapmple.com
| Issuer: commonName=*******
| Public Key type: rsa
| Public Key bits: 2048
| Not valid before: 2010-01-23T00:00:00+00:00
| Not valid after:  2020-02-28T23:59:59+00:00
| MD5:   *******
|_SHA-1: *******
| ssl-enum-ciphers: 
|   SSLv3: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|   TLSv1.0: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|_  least strength: strong
995/tcp open  pop3s
| ssl-cert: Subject: commonName=*.exapmple.com
| Issuer: commonName=*******
| Public Key type: rsa
| Public Key bits: 2048
| Not valid before: 2010-01-23T00:00:00+00:00
| Not valid after:  2020-02-28T23:59:59+00:00
| MD5:   *******
|_SHA-1: *******
| ssl-enum-ciphers: 
|   SSLv3: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|   TLSv1.0: 
|     ciphers: 
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - strong
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - strong
|       TLS_RSA_WITH_RC4_128_SHA - strong
|     compressors: 
|       NULL
|_  least strength: strong
Nmap done: 1 IP address (1 host up) scanned in 8.64 seconds

Example 4 Checking for Client-initiated Renegotiation and Secure Renegotiation via openssl (manually)

openssl [30] can be used for testing manually SSL/TLS. In this example we try to initiate a renegotiation by client [m] connecting to server with openssl - writing the fist line of an HTTP request, in a new line typing “R”, waiting for renegotiaion and completing the HTTP request - and check if secure renegotiaion is supperted looking server output. Using manual request it is also possible to see if Compression is enabled for TLS in order to check for CRIME [13], check for ciphers and other vulnerabilities.

$ openssl s_client -connect www2.example.com:443
CONNECTED(00000003)
depth=2 ******
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:******
   i:******
 1 s:******
   i:******
 2 s:******
   i:******
---
Server certificate
-----BEGIN CERTIFICATE-----
******
-----END CERTIFICATE-----
subject=******
issuer=******
---
No client certificate CA names sent
---
SSL handshake has read 3558 bytes and written 640 bytes
---
New, TLSv1/SSLv3, Cipher is DES-CBC3-SHA
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : DES-CBC3-SHA
    Session-ID: ******
    Session-ID-ctx: 
    Master-Key: ******
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: ******
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---

Now we can write the first line of an HTTP request and then R in a new line.

HEAD / HTTP/1.1
R

Server is renegotiating

RENEGOTIATING
depth=2 C******
verify error:num=20:unable to get local issuer certificate
verify return:0

And we can complete our request, checking for response.

HEAD / HTTP/1.1

HTTP/1.1 403 Forbidden ( The server denies the specified Uniform Resource Locator (URL). Contact the server administrator.  )
Connection: close
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 1792  

read:errno=0

Even if the HEAD is not permitted, Client-intiated renegotiaion is permitted.

Example 5. Testing supported Cipher Suites, BEAST and CRIME attacks via TestSSLServer

TestSSLServer [32] is a script which permits to check cipher suite and also BEAST and CRIME attacks. BEAST (Browser Exploit Against SSL/TLS) exploits a vulnerability of CBC in TLS 1.0. CRIME (Compression Ratio Info-leak Made Easy) exploits a vulnerability of TLS Compression, that sould be disabled. It is really interesting a first fix for BEAST was the usage of RC4, but this is discouraged due to a crypto-analytical attack to RC4 [15].

An online tool to check for these attacks is SSL Labs, but can be used only for internet facing servers. Also consider that target data will be stored on SSL Labs server and also will result some connection from SSL Labs server [21].

$ java -jar TestSSLServer.jar www3.example.com 443
Supported versions: SSLv3 TLSv1.0 TLSv1.1 TLSv1.2
Deflate compression: no
Supported cipher suites (ORDER IS NOT SIGNIFICANT):
  SSLv3
     RSA_WITH_RC4_128_SHA
     RSA_WITH_3DES_EDE_CBC_SHA
     DHE_RSA_WITH_3DES_EDE_CBC_SHA
     RSA_WITH_AES_128_CBC_SHA
     DHE_RSA_WITH_AES_128_CBC_SHA
     RSA_WITH_AES_256_CBC_SHA
     DHE_RSA_WITH_AES_256_CBC_SHA
     RSA_WITH_CAMELLIA_128_CBC_SHA
     DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
     RSA_WITH_CAMELLIA_256_CBC_SHA
     DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
     TLS_RSA_WITH_SEED_CBC_SHA
     TLS_DHE_RSA_WITH_SEED_CBC_SHA
  (TLSv1.0: idem)
  (TLSv1.1: idem)
  TLSv1.2
     RSA_WITH_RC4_128_SHA
     RSA_WITH_3DES_EDE_CBC_SHA
     DHE_RSA_WITH_3DES_EDE_CBC_SHA
     RSA_WITH_AES_128_CBC_SHA
     DHE_RSA_WITH_AES_128_CBC_SHA
     RSA_WITH_AES_256_CBC_SHA
     DHE_RSA_WITH_AES_256_CBC_SHA
     RSA_WITH_AES_128_CBC_SHA256
     RSA_WITH_AES_256_CBC_SHA256
     RSA_WITH_CAMELLIA_128_CBC_SHA
     DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
     DHE_RSA_WITH_AES_128_CBC_SHA256
     DHE_RSA_WITH_AES_256_CBC_SHA256
     RSA_WITH_CAMELLIA_256_CBC_SHA
     DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
     TLS_RSA_WITH_SEED_CBC_SHA
     TLS_DHE_RSA_WITH_SEED_CBC_SHA
     TLS_RSA_WITH_AES_128_GCM_SHA256
     TLS_RSA_WITH_AES_256_GCM_SHA384
     TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
     TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
----------------------
Server certificate(s):
  ******
----------------------
Minimal encryption strength:     strong encryption (96-bit or more)
Achievable encryption strength:  strong encryption (96-bit or more)
BEAST status: vulnerable
CRIME status: protected

Example 6. Testing SSL/TLS vulnerabilities with sslyze

sslyze [33] is a python script which permits also mass scan and XML output. Follows an example of a regular scan. Is one of the most complete and versatile tool for SSL/TLS testing.

./sslyze.py --regular example.com:443

 REGISTERING AVAILABLE PLUGINS
 -----------------------------

  PluginHSTS
  PluginSessionRenegotiation
  PluginCertInfo
  PluginSessionResumption
  PluginOpenSSLCipherSuites
  PluginCompression



 CHECKING HOST(S) AVAILABILITY
 -----------------------------

  example.com:443                      => 127.0.0.1:443



 SCAN RESULTS FOR EXAMPLE.COM:443 - 127.0.0.1:443
 ---------------------------------------------------

  * Compression :
        Compression Support:      Disabled

  * Session Renegotiation :
      Client-initiated Renegotiations:    Rejected
      Secure Renegotiation:               Supported

  * Certificate :
      Validation w/ Mozilla's CA Store:  Certificate is NOT Trusted: unable to get local issuer certificate
      Hostname Validation:               MISMATCH                           
      SHA1 Fingerprint:                  ******

      Common Name:                       www.example.com                     
      Issuer:                            ******
      Serial Number:                     ****                               
      Not Before:                        Sep 26 00:00:00 2010 GMT           
      Not After:                         Sep 26 23:59:59 2020 GMT   
       
      Signature Algorithm:               sha1WithRSAEncryption              
      Key Size:                          1024 bit                           
      X509v3 Subject Alternative Name:   {'othername': ['<unsupported>'], 'DNS': ['www.example.com']}

  * OCSP Stapling :
      Server did not send back an OCSP response.                                   

  * Session Resumption :
      With Session IDs:           Supported (5 successful, 0 failed, 0 errors, 5 total attempts).
      With TLS Session Tickets:   Supported

  * SSLV2 Cipher Suites :

      Rejected Cipher Suite(s): Hidden 

      Preferred Cipher Suite: None     

      Accepted Cipher Suite(s): None   

      Undefined - An unexpected error happened: None 

  * SSLV3 Cipher Suites :

      Rejected Cipher Suite(s): Hidden 

      Preferred Cipher Suite:          
        RC4-SHA                       128 bits      HTTP 200 OK                        

      Accepted Cipher Suite(s):        
        CAMELLIA256-SHA               256 bits      HTTP 200 OK                        
        RC4-SHA                       128 bits      HTTP 200 OK                        
        CAMELLIA128-SHA               128 bits      HTTP 200 OK                        

      Undefined - An unexpected error happened: None 

  * TLSV1_1 Cipher Suites :

      Rejected Cipher Suite(s): Hidden 

      Preferred Cipher Suite: None     

      Accepted Cipher Suite(s): None   

      Undefined - An unexpected error happened: 
        ECDH-RSA-AES256-SHA             socket.timeout - timed out         
        ECDH-ECDSA-AES256-SHA           socket.timeout - timed out         

  * TLSV1_2 Cipher Suites :

      Rejected Cipher Suite(s): Hidden 

      Preferred Cipher Suite: None     

      Accepted Cipher Suite(s): None   

      Undefined - An unexpected error happened: 
        ECDH-RSA-AES256-GCM-SHA384      socket.timeout - timed out         
        ECDH-ECDSA-AES256-GCM-SHA384    socket.timeout - timed out         

  * TLSV1 Cipher Suites :

      Rejected Cipher Suite(s): Hidden 

      Preferred Cipher Suite:          
        RC4-SHA                       128 bits      Timeout on HTTP GET                

      Accepted Cipher Suite(s):        
        CAMELLIA256-SHA               256 bits      HTTP 200 OK                        
        RC4-SHA                       128 bits      HTTP 200 OK                        
        CAMELLIA128-SHA               128 bits      HTTP 200 OK                        

      Undefined - An unexpected error happened: 
        ADH-CAMELLIA256-SHA             socket.timeout - timed out         



 SCAN COMPLETED IN 9.68 S
 ------------------------

Testing SSL certificate validity – client and server

Firstly upgrade your browser because also CA certs expire and, in every release of the browser, these are been renewed. Examine the validity of the certificates used by the application. Browsers will issue a warning when encountering expired certificates, certificates issued by untrusted CAs, and certificates which do not match namewise with the site to which they should refer. By clicking on the padlock which appears in the browser window when visiting an HTTPS site, you can look at information related to the certificate – including the issuer, period of validity, encryption characteristics, etc. If the application requires a client certificate, you probably have installed one to access it. Certificate information is available in the browser by inspecting the relevant certificate(s) in the list of the installed certificates. These checks must be applied to all visible SSL-wrapped communication channels used by the application. Though this is the usual https service running on port 443, there may be additional services involved depending on the web application architecture and on deployment issues (an HTTPS administrative port left open, HTTPS services on non-standard ports, etc.). Therefore, apply these checks to all SSL-wrapped ports which have been discovered. For example, the nmap scanner features a scanning mode (enabled by the –sV command line switch) which identifies SSL-wrapped services. The Nessus vulnerability scanner has the capability of performing SSL checks on all SSL/TLS-wrapped services.

Some tools, as in previous examples, check also for certificate validity.

Example 7. Testing for certificate validity (manually)

Rather than providing a fictitious example, we have inserted an anonymized real-life example to stress how frequently one stumbles on https sites whose certificates are inaccurate with respect to naming. The following screenshots refer to a regional site of a high-profile IT company.

We are visiting an .it site and the certificate was issued to a .com site! Internet Explorer warns that the name on the certificate does not match the name of the site.

SSL Certificate Validity Testing IE Warning.gif Warning issued by Microsoft Internet Explorer

The message issued by Firefox is different – Firefox complains because it cannot ascertain the identity of the .com site the certificate refers to because it does not know the CA which signed the certificate. In fact, Internet Explorer and Firefox do not come preloaded with the same list of CAs. Therefore, the behavior experienced with various browsers may differ.

SSL Certificate Validity Testing Firefox Warning.gif Warning issued by Mozilla Firefox

Testing for other vulnerabilities

As mentioned previously there are other types of vulnerabilities that are not related with the SSL/TLS protocol used, the cipher suites or Certificates. A part from others discussed in other parts of the Guide, the another one is possible when the server provide the website both with the HTTP and HTTPS protocols, and permit to an attacker to force a victim into using a non-secure channel instead of a secure one.

Surf Jacking

Surf Jacking attack [7] was first presented by Sandro Gauci and permits to an attacker to hijack an HTTP session even when the victim’s connection is encrypted using SSL or TLS. The following is a scenario of how the attack can take place:

The following is a scenario of how the attack can take place:

  • Victim logs into the secure website at https://somesecuresite/.
  • The secure site issues a session cookie as the client logs in.
  • While logged in, the victim opens a new browser window and goes to http:// examplesite/
  • An attacker sitting on the same network is able to see the clear text traffic to http://examplesite.
  • The attacker sends back a "301 Moved Permanently" in response to the clear text traffic to http://examplesite. The response contains the header “Location: http://somesecuresite /”, which makes it appear that examplesite is sending the web browser to somesecuresite. Notice that the URL scheme is HTTP not HTTPS.
  • The victim's browser starts a new clear text connection to http://somesecuresite/ and sends an HTTP request containing cookie in the HTTP header in clear text
  • The attacker sees this traffic and logs the cookie for later (ab)use.

To test if a website is vulnerable is sufficient to proceed like follow:

  1. Check if website supports both HTTP and HTTPS protocol
  2. Check if cookies do not have the “Secure” flag

SSL Strip

Often applications supports both HTTP and HTTPS. As for usability or because users do not use to type “https://www.example.com”. Often users go into an HTTPS website from link or a redirect. Typically also home banking site have a similar configuration with an iframed login or a form with action attribute over HTTPS but the page under HTTP. An attacker in a privileged position - as described in SSL strip [8] - can incercept traffic when user is into HTTP and manipulate it to get a Man-In-The-Middle attack under HTTPS. To test if application is vulnerable is sufficient the website supports both HTTP and HTTPS.

Gray Box testing and example

Testing for Weak SSL/TSL Cipher Suites

Check the configuration of the web servers which provide https services. If the web application provides other SSL/TLS wrapped services, these should be checked as well.

Example 8. Windows Server

Check the configuration on a Microsoft Windows Server (2000, 2003 and 2008) using the registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\

which has some sub-keys like Ciphers, Protocols and KeyExchangeAlgorithms.

Example 9: Apache

To check the cipher suites and protocols supported by Apache2 web server open the ssl.conf file and search for the SSLCipherSuite, SSLProtocol, SSLHonorCipherOrder,SSLInsecureRenegotiation and SSLCompression directives.

Testing SSL certificate validity – client and server

Examine the validity of the certificates used by the application at both server and client levels. The usage of certificates is primarily at the web server level; however, there may be additional communication paths protected by SSL (for example, towards the DBMS). You should check the application architecture to identify all SSL protected channels.

References

OWASP Resources

Whitepapers

Tools