Detecting Mac Address

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.

U1335

Code Snippets

package main

import (
    "fmt"
    "log"
    "net"
    "strings"
)

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 {
        log.Fatal(err)
    }

    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)
            } 
         }
    }
}

Detection Rules

rule UNPROTECT_VM_Evasion_MACAddrComb {
    meta:
        author = "ditekSHen"
        description = "Detects executables referencing virtualization MAC addresses"
    strings:
        $s1 = "00:03:FF" ascii wide nocase
        $s2 = "00:05:69" ascii wide nocase
        $s3 = "00:0C:29" ascii wide nocase
        $s4 = "00:16:3E" ascii wide nocase
        $s5 = "00:1C:14" ascii wide nocase
        $s6 = "00:1C:42" ascii wide nocase
        $s7 = "00:50:56" ascii wide nocase
        $s8 = "08:00:27" ascii wide nocase
    condition:
         uint16(0) == 0x5a4d and 3 of them
}

Additional Resources

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 : contact@unprotect.it.

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 contact@unprotect.it.

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