Remove All Ads from XDA

Wi-Fi MAC address changing

2,536 posts
Thanks Meter: 11,181
By Adam77Root, Inactive Recognized Developer on 9th September 2012, 06:52 PM
Post Reply Email Thread
24th September 2017, 05:54 PM |#31  
Junior Member
Thanks Meter: 0
Originally Posted by Adam77Root

Hello everybody!

I have managed to change the Wi-Fi MAC address of my device and now I share this technique with you. With this method, you can change your address permanently!

What is a MAC address?
A Media Access Control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. It may also be known as a burned-in address, an Ethernet hardware address (EHA), hardware address or physical address. (Source: Wikipedia)

Why would somebody change his/her MAC address?
- To access the internet where it is restricted to particular addresses.
- To hide his/her illegal activity. (Though this is not effective enough since the Android system sends product information and a lot of other things to the Google servers and I'm sure that previous IP addresses could be searched for if somebody does something really nasty.)

Is it legal to change the MAC address?
As far as I know, it is. However, I firmly discourage you on doing anything illegal with changed/unchanged MAC.

Let's do it!
What do you need?
- A rooted device.
- A kernel with MAC address changing support. (I include my ICS kernel (version 3.1.10) for those who want to try it out and the method of implementing it into other custom kernels.)
- A file manager that can explore the root filesystem.

How does this exactly work?
Normally, the Wi-Fi driver gets the MAC address from the built-in chip then it writes the address to '/efs/wifi/' and '/data/'. This is the original burned-in address. This cannot be changed with software modifications, but only by soldering off the chip from the motherboard and rewriting its contents. Our Wi-Fi device is a Broadcom BCM4330. It has very good built-in features and the open source driver can be found in our kernel sources.

There are two different options in the driver (READ_MACADDR and RDWR_MACADDR (actually, there is a WRITE_MACADDR option too, which stands for creating the two files I have mentioned before)), which enable us changing the address. I tested both and found READ_MACADDR better. By enabling it in the kernel, you get some options regarding MAC changing.

Before you change your MAC address in any way, turn off Wi-Fi! I recommend writing down your original address somewhere (just to be extra secured). You can always return to your original one using the second method (read further) or by flashing a kernel that doesn't have the patch.

- If you flash a patched kernel and delete the '/efs/wifi/' file, the driver will generate (!!) a custom MAC address based on some predefined rules (The first 24 bits are common in all generated addresses.).
- Of course you can set your own custom MAC address. Do this by editing the '/efs/wifi/' file with a file manager. If you change it to an incorrect address, the system will automatically use the original (burned-in) MAC.

For kernel developers who want to enable this:
Find '#define WRITE_MACADDR' after '#ifdef CONFIG_MACH_N1' in 'drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h' and insert '#define READ_MACADDR' after that line. This is for ICS kernels (version 3.1.10), but the patch must work on GB ones too. You just have to insert the define somewhere else (I didn't look into this.).
(I count on you guys in implementing this! )

I attach my prebuilt (secure, MMC_ERASE_CAP disabled) kernel for trying out this feature. It is an ICS kernel (version 3.1.10).

Every custom modification to devices have risks. Use this at your own risk!

Have fun and enjoy!

Hey !
I'm on cm12.1 on a lenovo zuk z1 and I can't find /efs folder.
Help !
Thank you anyway for this post.
25th September 2017, 05:35 AM |#32  
Senior Member
Flag Schöneiche bei Berlin
Thanks Meter: 1,369
Donate to Me
Originally Posted by thekingboloss

Hey !
I'm on cm12.1 on a lenovo zuk z1 and I can't find /efs folder.
Help !
Thank you anyway for this post.

As this is a thread for Samsung , Lenovo might have a different folder to store the Mac or it's in binary somewhere... You need to search manually for it.
17th December 2017, 05:23 PM |#33  
Junior Member
Thanks Meter: 0
Is there any chance we could get this to work with other devices who use the bcmdhd wireless driver?

I found out that reading the MAC address from /efs/ seems to be the default mechanism in many stock ROMs for other Galaxy devices. I can say that this file also resides there for my GT-I9505 ("jfltexx") and I've read somewhere else that this is also the standard mechanism in GT-I9506 ("ks01lte") stock ROMs.

While it seems that Adam77Root readded this functionality in the GT-I9103's ("n1") CM 10 kernel, it wasn't in the ks01lte's CM 12 kernel and it doesn't seem to be in the LOS 14.1 kernel for the JF device family.

Could anyone more knowledgeable than me have a look at the kernel sources?
5th May 2018, 09:29 PM |#34  
Junior Member
Thanks Meter: 0
Is it possible to change sony experia android mac address
Can you help me to change mac address of my Sony experia
Awiat oyhr faveroble response

Originally Posted by ardatdat


Just tried patching the kernel, it works! So, this feature will be included in my next kernel.

Before flashing the patched kernel, when I turn off wifi, delete file, re-enable wifi, the MAC address is not changed.

However, after flashing the patched kernel, after I turn off wifi, delete file and re-enable wifi, the MAC address is changed!

Thanks very much for the useful guideline from Adam77Root

Post Reply Subscribe to Thread

address, change, mac, wifi, wireless

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes