Spoofing MAC addresses using fakemac

One of our customers uses a piece of software that depends on the MAC address of the running system. Unfortunately this application misbehaves when used on Amazon EC2 cloud computing, as each EC2 instance has an arbitrary MAC address that cannot be altered. Therefore we have written a small piece of software called fakemac.

fakemac acts as a wrapper around an application and uses LD_PRELOAD to load a small library that overloads the ioctl() function. When it sees requests to SIOCGIFHWADDR, it alters the returned data by overwriting the MAC address.

The fakemac program can be used as follows:

$ fakemac 42:42:42:42:42:42 ifconfig | grep HWaddr
eth0      Link encap:Ethernet  HWaddr 42:42:42:42:42:42
wlan0     Link encap:Ethernet  HWaddr 42:42:42:42:42:42

As always, the source code has been published on GitHub.

*Image source: https://unsplash.com/photos/xekxE_VR0Ec

Tags: , ,

Leave a Reply

Kumina helps companies innovate with the power of open source software. As specialists in managed IT operations since 2007, our mission is simple: building and managing the perfectly tailored technical infrastructures that allow our clients to thrive.

With fully managed solutions, we help our customers unlock the full potential of the cloud and Kubernetes. Our team also supports organisations with IT consulting and Kubernetes training courses. Learn more about our services or get in touch, we would love to hear about your business and projects.