Live data from Hacker News

Randomize your WiFi MAC address on Ubuntu

paulfurley.com

11–20 of 108 posts

Re: Randomize your WiFi MAC address on Ubuntu

#12
post #7

I've used https://github.com/feross/SpoofMAC in the past, which is a simple python tool for doing just this, cross-platform. Used it a lot in airports and can warmly recommend using it if you're usually dealing with multiple different OSes and don't want to remember how to do it for each.

Looks cool. I wish there was something like this for iPhone/iPad - which is much more likely to be with me everywhere and leak my MAC... side note/question: do I need to actively connect to a WIFI network for them to know my MAC or does it leak even when my phone scans for neighbouring SSIDs? EDIT: looks like MAC would leak even if I don't connect to any access point, but my Wifi is on... At least according to [0] ED…

I am pretty sure that when iPhone connects to an access point it uses the real mac, I don't know about android but it is probably the same.

Some access points need your real mac to connect because they use that to authorize you, I think schools/universities use this method a lot.

Re: Randomize your WiFi MAC address on Ubuntu

#15
post #13

I've found GNU macchanger to be the easiest way to do that kind of stuff. It's as simple as: macchanger -r Interesting article about macchanger on the Arch Wiki: https://wiki.archlinux.org/index.php/MAC_address_spoofing

I also used macchanger in the past but it seems that recent versions of NetworkManager overwrite the changes that macchanger makes.

Re: Randomize your WiFi MAC address on Ubuntu

#16
post #12

Earlier quoted context omitted.

Looks cool. I wish there was something like this for iPhone/iPad - which is much more likely to be with me everywhere and leak my MAC... side note/question: do I need to actively connect to a WIFI network for them to know my MAC or does it leak even when my phone scans for neighbouring SSIDs? EDIT: looks like MAC would leak even if I don't connect to any access point, but my Wifi is on... At least according to [0] ED…

I am pretty sure that when iPhone connects to an access point it uses the real mac, I don't know about android but it is probably the same. Some access points need your real mac to connect because they use that to authorize you, I think schools/universities use this method a lot.

I do not understand though. Whitelisting MAC addresses is something you can do, but 99.99% of the wifi spots out there don't have it enabled. Why should my phone leak my MAC address needlessly instead of just generating a new one every 5 minutes or so?

Re: Randomize your WiFi MAC address on Ubuntu

#17

This seems like a good idea until you realize that you are the only one using a random mac address. (There is a vendor prefix at the beginning of every mac) Better would be to take a bit more care in choosing a more realistic address.

Yep, feel free to modify to spoof a real hardware MAC address (as the original version of my blog post suggested: https://github.com/paulfurley/www.paulfurley.com/commit/bebc...)

As @_fink on Twitter pointed out, colliding with a real existing MAC address is not ideal.

Re: Randomize your WiFi MAC address on Ubuntu

#18
post #7

I've used https://github.com/feross/SpoofMAC in the past, which is a simple python tool for doing just this, cross-platform. Used it a lot in airports and can warmly recommend using it if you're usually dealing with multiple different OSes and don't want to remember how to do it for each.

Good tip, thanks for linking to this.

Re: Randomize your WiFi MAC address on Ubuntu

#19
post #12

Earlier quoted context omitted.

Looks cool. I wish there was something like this for iPhone/iPad - which is much more likely to be with me everywhere and leak my MAC... side note/question: do I need to actively connect to a WIFI network for them to know my MAC or does it leak even when my phone scans for neighbouring SSIDs? EDIT: looks like MAC would leak even if I don't connect to any access point, but my Wifi is on... At least according to [0] ED…

I am pretty sure that when iPhone connects to an access point it uses the real mac, I don't know about android but it is probably the same. Some access points need your real mac to connect because they use that to authorize you, I think schools/universities use this method a lot.

Or to be more precise, those access points probably need a consistent mac, not your real one. So it would be nice if you could configure those networks to receive their own mac, but that stays the same over time. This is what the NetworkManager 1.4.1+ "stable" setting does.

Re: Randomize your WiFi MAC address on Ubuntu

#20
Here is the code I use for my mac to randomize my mac address:

    interface="en0"
    new_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//; s/./0/2') # from stackoverflow
    sudo ifconfig $interface ether $new_mac
Edit: What's the advantage of the solution in the post? If I just change my mac address every time I join a network (even the same one), they can't track me with my randomized mac addresses. So why would I prefer to keep a stable but randomized mac address for each network I connect to for a day?
Post reply on HN