Network Forensic Analysis of SSL MITM Attacks

The big news this past week has been the [You must be registered and logged in to see this link.] where false certificates were created for popular domains like google.com, yahoo.com, live.com and skype.com.

Comodo is a Certificate Authority (CA) that your browser trusts, this means that these false certificates would be accepted by most browsers. But the attack was luckily discovered and the false certificates have now been revoked.

Someone performing a [You must be registered and logged in to see this link.] on HTTPS traffic (i.e. HTTP over SSL) would be able to see all content of the encrypted communication, including transmitted usernames and passwords. Such MITM attacks can be performed by someone at [You must be registered and logged in to see this link.], [You must be registered and logged in to see this link.], your ISP or [You must be registered and logged in to see this link.]

There are several ways users can detect MITM attacks, even when the certificate seems to be signed by a trusted CA. There are, for example, Firefox plugins available from [You must be registered and logged in to see this link.] as well as [You must be registered and logged in to see this link.] that can help users by alerting on “new” certificates that have not been seen beforeBut how would you go about doing forensic analysis of captured network traffic from a suspected MITM attack?

My suggestion is to load the pcap into [You must be registered and logged in to see this link.] which will automatically extract the [You must be registered and logged in to see this link.] certificates from the SSL streams to files with the “.cer” extension. These .cer files can be opened in MS Windows default certificate viewer for further inspection, simply right-click the extracted file in NetworkMiner and select “Open file”. I will in this blog post use the file “[You must be registered and logged in to see this link.]"from the “social nOtworking site” [You must be registered and logged in to see this link.][You must be registered and logged in to see this image.]SSL capture file test1.pcap opened in NetworkMiner Professional

The first thing to inspect in a possible MITM attack is to verify that the IP and DNS name of the server seem to be correct. The next step is to look closer at the server's certificate, for example by opening the .cer file in Windows.[You must be registered and logged in to see this image.]Extracted file mail.google.com.cer opened for inspection

Self signed certificates, revoked certificates and certificates that are signed by non-trusted CAs are generally not to be trusted. Finding such certificates in a pcap file can suggest that an SSL MITM attack has taken place. In this case, however, the certificate for mail.google.com seems to be signed properly by Thawte.

The recent attack on Comodo teaches us that even certificates signed by a trusted CA can be rogue, we can therefore not fully trust this certificate even though it is signed by Thawte. An attacker who has hacked into Thawte could have been able to apply a valid Thawte signature to his own fake certificate for mail.google.com. There is also the possibility that some governments might use MITM and false SSL certificates to inspect the contents of encrypted communications. Christopher Soghoian and Sid Stamm's paper “[You must be registered and logged in to see this link.]:does for example start out with the following abstract:

Quote :

“This paper introduces a new attack, the compelled certificate creation attack, in which government agencies compel a certificate authority to issue false SSL certificates that are then used by intelligence agencies to covertly intercept and hijack individuals' secure Web-based communications. We reveal alarming evidence that suggests that this attack is in active use. [...]”

This type of advanced MITM attack, where the certificate is signed by a trusted CA, can be detected by investigating whether or not other people across the internet are receiving the same certificate as you do for a particular website. The Perspectives Project, which is run by [You must be registered and logged in to see this link.] provides a [You must be registered and logged in to see this link.] that can be used to query their “network notary” servers to see what SSL certs they receive for a particular HTTPS website.

By submitting a [You must be registered and logged in to see this link.] I get the following response:

The 16-byte keys received from the four network notary servers are MD5 fingerprints for the certificates they have seen. The built in certificate viewer in Windows unfortunately only shows SHA1 fingerprints (20 bytes), we will therefore need to find some other way of computing an MD5 fingerprint of the certificate. I chose to do this by running OpenSSL in [You must be registered and logged in to see this link.] but installing [You must be registered and logged in to see this link.] works just as fine. Calculating the MD5 fingerprint of an SSL certificate with OpenSSL is done like this:

As you can see this fingerprint was also provided by all the four network notaries, so we can assume that no SSL MITM attack was performed on the session between 10.33.134.158 and mail.google.com in test1.pcap.

If you wanna learn more about sniffing and analyzing SSL/TLS encrypted network traffic then I suggest you also read our recent blog posts titled [You must be registered and logged in to see this link.] and [You must be registered and logged in to see this link.]