alobbs / macchanger

GNU MAC Changer
http://www.gnu.org/software/macchanger
GNU General Public License v3.0
581 stars 112 forks source link

failing to read random data, causing address to never change #40

Open lucianposton opened 7 years ago

lucianposton commented 7 years ago

The code that reads random data doesn't check read() errors causing the rand seed to be initialized with non-random data. This caused macchanger to set the address to the same value repeatedly.

This is particularly bad if you happen to have a /dev/hwrng that doesn't have a backing driver. In this case, open(/dev/hwrng) will always succeed, and read will always fail. I used the following patch to disable using /dev/hwrng since, in addition to not checking error codes, it is incorrectly using /dev/hwrng. See https://www.kernel.org/doc/Documentation/hw_random.txt

https://github.com/lucianposton/gentoo-patches/blob/master/net-analyzer/macchanger/0001-don-t-use-hwrng.patch