Saturday, March 1, 2014

How to spoof a MAC address

The Media Access Control address is a unique identifier assigned to network interfaces (For more details, see the ever reliable Wikipedia or ask Google). The MAC address is hard-coded on the Network Interface Controller (NIC). Consequently, it always remains the same, no matter where in the world you connect to the internet, and regardless of any VPN and / or proxys you might use.

You can, however, make your operating system (and subsequently the LAN you're connecting to) believe that your NIC has a MAC address of your choosing (or a randomly generated one, for that matter), rather then the one hard-coded on said NIC.

Perhaps the end user agreement of a web-based service you've subscribed to only allows you to connect a limited number of devices (or even just one), and you need to connect your new computer.

Perhaps you want to hide your identity (and that of your computer) in order to protect your privacy.

Perhaps the time-limit of the public hot spot you're using has expired (airports, public transport, coffee shops, etc), and you need to convince the public WLAN that you're connecting with an entirely new device.

Whatever your reasons may be, I won't judge you, I'm just going to show you how to do it.

Install MAC address change tool

A Google search for "MACChanger" lets you find the necessary tool for your operating system.

For Windows, you can download it here, for example.

On Ubuntu 12.04, install MAC changer using this command:

sudo apt-get install macchanger

Spoof a MAC address

Note The following process has been tested on a Ubuntu 12.04 system. For the procedure and syntax applying to your operating system, refer to the instructions on the download site you obtained MAC changer from.

First, you must stop the network manager service:
sudo service network-manager stop

Now, run MAC changer. This example generates a fully random MAC address for your wireless network interface:
sudo macchanger -r wlan0.

To spoof a MAC address for the ethernet network interface, use eth0 as the device identifier.

sudo macchanger -h lists the available options. They are:
-h Help Show summary of options
-V Version Show version of MAC changer
-e Ending Don't change the vendor bytes (e. g. your Cisco NIC will still show up as an Cisco NIC)
-a another Set random MAC address of the same kind
-A Another Set random MAC address of any kind
-p Permanent Reset to original, permanent hardware MAC address
-r Random Set fully random MAC address
-l List List known vendors
-m MAC Set MAC to specific MAC address: macchanger -m XX:XX:XX:XX:XX:XX

Finally, restart the network manager service:
sudo service network-manager start

Note that after shutting down and restarting your system, the operating system will once again broadcast the original, hard-coded MAC address of your NIC to the world.

To restore the original MAC address without rebooting, use
sudo macchanger -p wlan0.

Congrats, you're done

So there you have it. Never get bored to death again when the airport gives you a measly one hour of WiFi connectivity but your flight has just been delayed indefinitely. Now all you have to do is install MACChanger before you get kicked off the WLAN you're using, and Bob's your uncle.

No comments:

Post a Comment