3

Android has an option to use a randomized MAC address to connect to a Wi-Fi network:

IMG:

How can I regenerate the randomized MAC address on Android?

1

1 Answer 1

6

In short: If you have the default mode "Persistent randomization" you can't change the randomized MAC without a factory-reset if your device is not rooted. And with root permission you can only "fake" a factory-reset to regenerate the MAC of all saved Wifis.

What you could do is changing the randomization mode from "Persistent randomization" to "Non-persistent randomization" (I think that can be done in developer settings). But this will affect all Wifi networks. Or you change the Wifi network settings to use the original MAC address, that would allow you to change the MAC exactly one time for each network.

In "Persistent randomization" mode each network gets its own randomized MAC address which is not predictable but always the same for each network.

In reality the MAC address only seems to be random but it is more like a password generated by multiple input arguments in a way that if you just look at the generated MAC address you can not derive the original values:

Android generates a persistent randomized MAC address based on the parameters of the network profile including SSID, security type, or FQDN (for Passpoint networks). This MAC address remains the same until factory reset. The MAC address does not get re-randomized if the user forgets and re-adds the Wi-Fi network since the MAC addressed depends on the parameters of the network profile. source

What is missing in this list is that there is another secret that is saved in the your Android user profile data that is also included into the generation of the MAC address, otherwise all devices would generate the same MAC if only the network settings would be included in generation. And this secret is the reason why a factory reset changes all the randomized MAC addresses.

In detail this is a random key saved in your AndroidKeyStore, a hardware protected service that maintains private and secret keys. The code for building this HMAC-SHA key can be found in the method MacAddressUtil.generateAndPersistNewMacRandomizationSecret.

On a rooted device you may be able to delete or overwrite the entry but that would affect generate a new persistent randomized MAC for all Wifi networks, not just the one you want to generate. Without root you don't have access to that key, thus you can neither use nor delete it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .