Performing an Evil Twin Attack with a Router

Thursday, February 5, 2015

An evil twin is a common attack vector in any environment where wireless access is available. The attack consists of an attacker spoofing an access point to look as legitimate as its counterpart in attempts to harvest credentials.

With that being said let's take a look at how to set up an evil twin access point in an WPA2 Enterprise environment.

What you'll need:

Please remember, this is solely for educational purposes. 
The techniques mentioned below are not to be used for malicious purposes outside of a controlled research environment.

Why do we need a router?

We need a router because we are using the old school method! Scripts like hostapd-wpe or lootbooty can configure and perform the evil twin attack and much more with the presses of a few buttons. However, if you'd like to learn the fundamentals this is a great tutorial. I'm actually making this tutorial because I didn't find any on the web specifically with a physical router involved. I had to resort to this solution recently at a client site due to some unforeseen complications so I definitely recommend reading and trying out this tutorial. It could come in handy!

Setting up the Evil Twin

Since we're going to be intercepting enterprise communications we must first set up a radius server. We will be using freeradius-wpe in this example. Once we set up our radius server on kali then we will configure our access point/router appropriately and should be all set!
  1. Download freeradius-wpe to your Kali Linux virtual machine (vm). I will be using free radius 2.1.12 in this example.
  2. Download the freeradius-wpe patch.
  3. Untar the download:
  4. Change directory into the freeradius-server folder and apply the patch: 
  5. Configure, make and install:
  6. Make the certificates:

Great! We're now done with the radius server set up. To test it out run the radiusd -v command. Regardless of what version you installed, the output should look similar to the one below.

Alright. Now that we can confirm that our radius server installed correctly, let's make some changes to the configuration file.
  1. Let's change directories to the location of the configuration files: cd /usr/local/etc/raddb/
  2. Open radiusd.conf with your favorite editor and ensure that eth0 is uncommented. I've included a snippet of what this setting looks like below in order to facilitate finding it. This should be around line 290 of the configuration file.
  3. Next we're going to open clients.conf and add a new client with the address of our router and a secret phase (this can be anything). Below is the client I added to the configuration file.
  4. Create a log file named freeradius-server-wpe.log under the /usr/local/var/log/radius/ directory. This log file will store any credentials we capture during the test.
  5. Alright, now for the fun part. Let's configure our router to use WPA2 Enterprise and use the IP address of our Kali VM as the radius server. Enter the secret previously saved within the client.config file. I've included a screenshot of how my router settings looked like below. Note that the router's SSID is set to "eviltwin_test", attackers will usually set this to whatever SSID they are trying to spoof.

We are all set! Let's start up the radius server with the radiusd -X command and let's test it out. I will be using my phone to authenticate to the evil twin....annnnnddd success!! It worked!! Here are some screenshots on what the radius server should be outputting as well as the logfile containing the username and password I just entered.

A quick note. Not all clients who authenticate to the radius server will succeed. Additionally, not all passwords will be in clear-text, in fact most of the time hashes are the ones obtained.

Hope you guys learned something new. Remember this is an old school technique that can be used to learn or as a Plan B. Before you go check out how to prevent this from happening in your environment with some mitigation tips below.

Go Mitigation!

The example above depicts how to successfully spoof an access point and capture user credentials. An attacker can use these credentials to infiltrate a network and possibly obtain sensitive information. This is bad news for any environment. Let's explore some ways to protect against this attack:
  • Ensure your environment is using a secure protocol such as EAP-TLS
  • Implement client side certificates for authentication and validate those certificates
  • Do not self-sign certificates
  • Implement a Security Awareness program for employees

Additional Reading

For more detailed information on evil twin attacks and recommendations check out the following:

No comments :

Post a Comment