Go Back

WiFi Security: Dispelling myths of using public networks

October 23, 2019
WiFi Security: Dispelling myths of using public networks

We have all seen many articles, blogs, endless Twitter commentary, and so on about the risks of using public WiFi networks. While they may be an oasis of connectivity for the weary traveller, we are bombarded with cautionary tales about all the terrible things that might befall you and your data should you be naive enough to use a public WiFi network. Often this statement is sold alongside a requirement to use a commercial VPN provider in order to stay secure online. As we have seen with the recent breach of NordVPN, adding a VPN provider into the mix introduces more complexity and can, but not necessarily, imperil your security. In general, we like to keep things as simple as possible (but no simpler!), so it is worth considering the cost/benefit of a VPN. 

In this blog we are going to review where this view of dangerous public WiFi networks came from, how close it comes to reality, and how to actually protect yourself from the real dangers which can occur on a public WiFi network.

 

Interception – SSL Stripping and ARP Spoofing

Let’s first step back in time to the heady days of 2009, when Avatar and Farmville were unleashed on an unsuspecting world. On top of all of this,  a dreadlocked hacker by the name of Moxie Marlinspike (who would later go on to release an app called Signal for end-to-end encrypted messaging) released a tool at Black Hat called “sslstrip” (https://moxie.org/software/sslstrip/). This tool quickly became a favorite of hackers of all types of hats as it allowed an attacker to intercept a target’s web browsing and remove the SSL encryption.

How was that possible?  

The devil, as always, is in the details: sslstrip relies completely on a website using HTTP for serving content and HTTPS only for “secret” information such as passwords or keys. The sslstrip tool would then intercept the HTTP traffic, rewrite any HTTPS URLs it found within to be HTTP and send them on their way. Hopefully the target will not notice that their browser no longer displays the padlock, or any other visual indicator, that the connection is no longer secured.

But how does the attacker get the traffic to sslstrip in the first place? To answer that we need to go even further back in time to 1999, The Matrix hit the cinemas, and Britney Spears was all the rage. Dug Song, of the hacker collective L0pht, released a tool called arpspoof (https://fossies.org/dox/dsniff-2.4b2/arpspoof_8c_source.html). This tool took advantage of how computers on the same network figure out how to communicate with each other at layer 2 of the TCP/IP stack. By constantly advertising a mapping between a target for spoofing and the attacker’s machine (see diagram below), the attacker can trick a target into sending all their traffic through the attacker’s machine. Once this has been achieved, an attacker can spoof DNS replies, sniff the traffic for credentials and, of course, use sslstrip!

 

interception diagram blog 

Mitigations

The astute reader will have noticed that these tools are ten to twenty years old this point; what has happened since then?

The answer is: TLS.

Specifically, TLS as the default for all communications between a web browser or app and the destination website. TLS, or Transport Layer Security, is the cryptographic protocol responsible for enforcing confidentiality and integrity of your data in transit between your web browser or app and the service you are using. As devices, including mobile devices, became more powerful, it became feasible to use TLS for all traffic, rather than only the credentials. The upshot of this is the protection of confidentiality, so no-one can read the data in transit, and the protection of integrity, so no-one can modify the data in transit. Using TLS to protect all traffic effectively mitigates these SSL stripping attacks which rely on mixed content, that is, both plain and encrypted content.

Diligent websites will also implement HSTS (HTTP Strict Transport Security) which forbids clients from connecting via HTTP. Many browsers have a preload list of HSTS sites which means these sites can never be connected to over HTTP, thereby preventing downgrade attacks from HTTPS (that is, HTTP protected by TLS) to HTTP. An intriguing side note is that HTTP/2 and HTTP/3, the successors of the venerable HTTP/1.1, are all TLS-only.

 

Impersonation

Now that we have established that a well-configured website or app will enforce TLS for all communications to ensure confidentiality and integrity of the data in transit, we can turn our attention to authentication. How does a web browser or app know that it is talking to the right website? The answer is that the website has to provide a certificate (conforming to the X509 standard) which identifies itself.

As an attacker, you have two options, maybe three if you’re particularly capable!

  1. Make your own certificate
  2. Impersonate a legitimate certificate
  3. (Steal a legitimate certificate – professionals only!)

 

Rolling your own

One common method to impersonate a website is simply to make your own certificate for that website, for example, fluffypinkunicorns.example.com. However, this certificate will not be accepted as valid by any modern web browser or app. Highly skilled attackers may be able to get their certificate trusted, but that is out-of-scope for this blog. If you look with a network sniffer such as Wireshark, you may well see a TLS alert message sent by the browser as it refuses to authenticate to the rogue site:

Wireshark wifi security blog 

If you do this you can spoof DNS replies to the client so they connect to your fake server rather than the correct server:

spoof DNS replies wifi security blog

 

Mitigations

Using well-configured applications or websites from well-known vendors with a good reputation for security goes a long way towards mitigating these impersonation attacks. We have tested these attacks against applications that we use at Digital Shadows and found that they consistently do the right thing in the face of impersonation attacks and do not permit any connection or exchange of credentials.

 

Responder

One issue that continues to plague Windows systems is legacy authentication and discovery mechanisms, in particular LLMNR (Link-Local Multicast Name Resolution) and NBT-NS (NetBios over TCP/IP – Name Service). A wily attacker may be able to abuse these services to trick your Windows operating system into connecting to it. The well-known Responder tool automates these attacks and more. It is recommended to disable these legacy systems if they are not in use (https://cccsecuritycenter.org/remediation/llmnr-nbt-ns).

However, one weakness does remain on Windows, and that is the proxy authentication feature built into web browsers through the WPAD (Web Proxy Auto Discovery) feature. This feature sends the NTLMv2 hash of the user’s password over the network if a WPAD file has been served up by a web proxy which instructs the browser to authenticate via NTLM. This is on by default on Windows and is supported, but not enabled by default, on MacOS and Linux. The upshot of this is that an attacker can receive the NTLMv2 hash from a target and then crack the hash offline in order to recover the plaintext or reuse the hash with a “Pass the Hash” attack. These types of attacks are predicated on there being a place where Active Directory credentials are accepted from the Internet, e.g., via RDP or some SSO providers or where hashes are accepted, e.g., via psexec or WMI.

 

wifi security blog image 2 

Mitigations

Attack surface reduction is critical and for Windows systems, we recommend disabling or reconfiguring the following legacy Windows features as long as they are not required:

  1. WPAD: If the WPAD protocol is in use, a static DNS entry can be used to ensure that no-one can spoof the hostname of the proxy and proxy auto discovery can be disabled in all installed browsers if it is not being used
  2. LLMNR (Link Layer Multicast Name Resolution): this can be disabled via GPO if not in use
  3. NBT-NS (NetBIOS over TCP/IP-Name Service): this can be disabled via GPO if not in use

The ever-excellent AD Security blog has a good article on securing your Windows build which touches on the three protocols above: https://adsecurity.org/?p=3299. Disabling the usage of NTLM authentication by browsers can be performed by following the instructions here: https://sso.cisco.com/autho/msgs/disable_IWA.htm.

In general, Firewalls around public-facing Internet-connected servers and host-based firewalls for roaming devices can be used to prevent the reuse of these credentials even if they are captured.

 

Conclusions

VPNs are often considered a panacea for many security ills, but after careful investigation, we have often observed that they are used instead of proper configuration, that is, attack surface reduction on a device and exclusive usage of TLS by a website or service. VPNs often introduce fragility issues such as problems with captive portals and/or other connectivity issues.

While a VPN can be useful for protecting network traffic on public WiFi networks, the risk to an endpoint is low if the legacy features for Windows mentioned above have been disabled. Other platforms such as MacOS, Linux, iOS and Android do not have these features enabled by default. This is particularly an issue for Windows endpoints. We are not suggesting that anyone disables their VPN without any additional thought, but rather, with careful configuration – reducing attack surface – and only connecting to well-configured websites or services, public WiFi can be used without significant increase in risk.

 

To learn more about how to manage your attack surface and reduce the ways that an attacker can target your organization, check out our resources at https://resources.digitalshadows.com/attack-surface-reduction.

Tags: