Detecting Mac Address

Created the Monday 11 March 2019. Updated 3 years, 6 months ago.

Virtualbox and VMware use specific virtual Mac address that can be detected by Malware.

  • The usual mac address used by Virtualbox starts with the following number: 08:00:27.
  • The usual mac address used by VMware starts with the following numbers: 00:0C:29, 00:1C:14, 00:50:56, 00:05:69.

Malware can use this simple trick to detect if it is running in a virtual environment and decide to not run properly.

Technique Identifier


Code Snippets

package main

import (

func getMacAddr() ([]string, error) {
    ifas, err := net.Interfaces()
    if err != nil {
        return nil, err
    var as []string
    for _, ifa := range ifas {
        a := ifa.HardwareAddr.String()
        if a != "" {
            as = append(as, a)
    return as, nil

func main() {
    // Blacklist VM mac address
    var macvm = []string{"08:00:27", "00:0C:29", "00:1C:14", "00:50:56", "00:05:69"}

    as, err := getMacAddr()
    if err != nil {

    for i, s:= range macvm {
        for _, a := range as {
            str := strings.ToUpper(a)
            if str[0:8] == s[0:8] {
                fmt.Println("VM detected!")
		fmt.Println(i, s)
using System.Net.NetworkInformation;

String[] vmMacAddresses =

var vmMacAddresses = new Dictionary<string, string>();

vmMacAddresses.Add("08:00:27", "VirtualBox");
vmMacAddresses.Add("00:0C:29", "VMWare");
vmMacAddresses.Add("00:1C:14", "VMWare");
vmMacAddresses.Add("00:50:56", "VMWare");
vmMacAddresses.Add("00:05:69", "VMWare");
// Add other ones bellow...

foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
    PhysicalAddress physicalAddress = netInterface.GetPhysicalAddress();
    if (physicalAddress == null)

    String mac = String.Join(":", (from b in physicalAddress.GetAddressBytes().Take(3) select b.ToString("X2")));

    if (vmMacAddresses.ContainsKey(mac))
        throw new Exception(
            String.Format("{0} Detected from its MAC Address.", vmMacAddresses.GetValueOrDefault(mac))            

    Console.WriteLine("No VM Detected :)");

Additional Resources

External Links

Subscribe to our Newsletter

The information entered into this form is mandatory. It will be subjected to computer processing. It is processed by computer in order to support our users and readers. The recipients of the data will be :

According to the Data Protection Act of January 6th, 1978, you have at any time, a right of access to and rectification of all of your personal data. If you wish to exercise this right and gain access to your personal data, please write to Thomas Roccia at

You may also oppose, for legitimate reasons, the processing of your personal data.