Live data from Hacker News

Randomize your WiFi MAC address on Ubuntu

paulfurley.com

31–40 of 108 posts

Re: Randomize your WiFi MAC address on Ubuntu

#31
post #28

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 pre…

Because maybe you had to pay to access the network and part of that involved binding your mac address. For example, calling the hotel desk to get your device to work.

Would be interested where that happens because I've never encountered something like this (binding the mac to the access) in public networks e.g. McDonald's, hotels and other shops. I did only get access codes which could be used for a specific time where I just changed my mac address.

I only know about mac whitelisting in protected networks managed by wary administrators.

Re: Randomize your WiFi MAC address on Ubuntu

#32

Will these new randomized MACs also be lookupable [1] to find the model? If I'm the feds running honeypot wifi and I see a different Dell Chromebook doing things interesting to me every day, this isn't a good cover. [1] https://www.macvendorlookup.com/

Not necessarily. However, if you're the only random MAC user on a network, it can be trackable.

Depending on implementation the MAC will have a specific bit set to indicate it is user supplied and not necessarily universally unique but I'm not sure if NM does that.

Re: Randomize your WiFi MAC address on Ubuntu

#33

Will these new randomized MACs also be lookupable [1] to find the model? If I'm the feds running honeypot wifi and I see a different Dell Chromebook doing things interesting to me every day, this isn't a good cover. [1] https://www.macvendorlookup.com/

No, because they use the 'locally administered' prefix [1]. This is deliberate in order not to collide with real existing MAC addresses. (The original version of the post used real, Intel MAC prefixes [2] and you can look in the gist revision for that code if you prefer.)

BTW if it's really the feds you're worried about, this article probably isn't for you.

[1] https://en.wikipedia.org/wiki/MAC_address#Universal_vs._loca...

[2] https://github.com/paulfurley/www.paulfurley.com/commit/bebc...

Re: Randomize your WiFi MAC address on Ubuntu

#35
post #27

Earlier quoted context omitted.

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?

If you connect to any hotspot with a captive portal, you would need to deal with the portal again every 5 minutes.

The MAC could remain unchanged for established connections while changing for new connection offers.

Re: Randomize your WiFi MAC address on Ubuntu

#36

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.

I think it's not a good idea to change your mac address as your only precaution against tracking. The DNS requests you'll make will reveal which sites you frequent.

I would advise to use a VPN connection. In this case it doesn't matter that you've randomized your mac address in a way which can be clearly identified as random. And even then you can see the VPN server IP in the logs so you should also make precautions and buy your VPN connection anonymously (and even then - you'll never know if you're really anonymous).

Changing your mac address seems to be sufficient (in addition to the VPN usage) to prevent easy tracking through something unique like your real mac address. But I agree that this is just 1-3 lines of code for realistic mac address generation so it should be unproblematic to add.

Edit: If you have fears of being uncovered by random-looking mac addresses without vendor prefixes, changing your mac address will probably not help you. Your threat model is different - maybe APT-level - and you have to do way more than changing your mac address.

Re: Randomize your WiFi MAC address on Ubuntu

#37
post #28

Earlier quoted context omitted.

Because maybe you had to pay to access the network and part of that involved binding your mac address. For example, calling the hotel desk to get your device to work.

Would be interested where that happens because I've never encountered something like this (binding the mac to the access) in public networks e.g. McDonald's, hotels and other shops. I did only get access codes which could be used for a specific time where I just changed my mac address. I only know about mac whitelisting in protected networks managed by wary administrators.

Airports do this all the time: Wifi is free for 1 hour, after that it's $X/hour. It's simply putting a "timer" on the MAC address.

Re: Randomize your WiFi MAC address on Ubuntu

#38
post #27

Earlier quoted context omitted.

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?

If you connect to any hotspot with a captive portal, you would need to deal with the portal again every 5 minutes.

Hopefully just the process of watching all connections break and seeing the internet go away as the client reassociates with the AP each time they foolishly tumble their MAC on an _active_ connection will be enough to keep this scenario from ever playing out.

Re: Randomize your WiFi MAC address on Ubuntu

#39
post #2

This seems like it should be a default indeed. It does make it harder to assign fixed addresses to your devices in your home network. At least openwrt only seems to have static DHCP leases based on MAC and not on the advertised DHCP name. For most devices this doesn't matter as it does add a DNS entry with whatever IP it assigned. But when you then want to add a firewall rule to port forward something to a device a f…

What makes it easier is having fixed goals in mind, because I am seeing a lot of people in this thread arguing because they're all solving different problems which is obviously going to mean different solutions.

If your only concern is passive tracking, then a randomized MAC being used for SSID probes (because whitelist-only hidden SSIDs are rare enough that those people can manually connect) will be sufficient.

If you're looking to keep an open Wifi provider from tracking you over the course of days, then using a different MAC for each connect is going to be sufficient.

If you're looking to avoid tracking by people doing traffic analysis to correlate by behaviour no amount of MAC trickery will help you.

If one is looking to avoid having to pay for overstaying their visit at a coffee house or similar capture portal, maybe what needs to be changed is one's sense of ethics, and changing a MAC won't help with that.

So, you can say "it should be a default" all you like, but everyone's going to have a different idea of what the default is for and they're going to throw a fit about it not being "the right default". Better to be conservative like Android and avoid inciting the newbs.

Post reply on HN