• Hello
Search Results for

    Show / Hide Table of Contents

    Desktop - Virtual Environment - Detector (Pro)

    A virtual machine is a computer simulated by software, such as VMware, VirtualBox, Hyper-V, QEMU, or Parallels. Inside one it is easier to inspect the game's memory, rewind the game, or run bots.

    This detector looks for signs that the game runs inside a virtual machine, so you can react.

    This detector needs the Pro version.

    Walkthrough: Protecting a desktop build.

    Warning

    This is the desktop check most likely to be wrong. Developers, testers, cloud gamers, and some work laptops use a virtual machine on purpose. Do not close the game on this check alone. Flag the session, or turn off a leaderboard.

    Do you need to add it?

    Most of the time, no. The predefined Anti-Cheat-Monitor prefab already includes it. The detector sits in the Desktop Environment Cheating Detector prefab, together with the debugger detector.

    If you use your own monitor prefab, drag the Desktop Environment Cheating Detector prefab onto the monitor in your prefab so it becomes a child.

    The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.

    The component is DesktopVirtualEnvironmentDetector (namespace GUPS.AntiCheat.Detector.Desktop). It does not need a monitor.

    Settings

    On the detector

    The DesktopVirtualEnvironmentDetector in the Inspector, shown with the debugger detector.

    • Is Active (isActive, bool, default on): Turns the detector on or off.
    • Possibility Of False Positive (possibilityOfFalsePositive, float, range 0 to 1, default 0.3): How likely a find is a false alarm. It is high on purpose, because many honest players use a virtual machine.
    • Threat Rating (threatRating, uint, default 125): How much one find adds to the threat score of the Anti-Cheat Monitor. It is low, because a virtual machine is a place where cheating is possible, not cheating itself. Raise it only if your game must not run in a virtual machine.
    • On Cheating Detection Event (OnCheatingDetectionEvent): Your own reactions. Assign a method here.
    • Check Only On Game Start (CheckOnlyOnGameStart, bool, default on): On means it checks once. A virtual machine rarely appears in the middle of a session.
    • Recheck Interval For Possible Cheating (RecheckIntervalForPossibleCheating, float, range 1 to 600, default 120): Seconds between two checks. Used only when Check Only On Game Start is off.

    In the project settings

    Open Edit > Project Settings > GuardingPearSoftware > AntiCheat. Select the Desktop tab and go to Desktop - Virtual Environment - Settings.

    The virtual machine settings.

    • Detect virtual machine (Desktop_DetectVirtualMachine, default on): The main switch. Off means the detector reports nothing.
    • MAC OUI prefixes (Desktop_VirtualMachine_MacOuis): Every network adapter has an address. The first six characters show who made it. This list holds the ones that belong to virtual machine makers. Write six hex digits without separators, such as 080027 for VirtualBox or 000C29 for VMware.
    • BIOS keywords (Desktop_VirtualMachine_BiosKeywords): Words to look for in the hardware description of the computer. The shipped list has VirtualBox, VMware, QEMU, Hyper-V, Parallels, and more. An empty list turns this check off.
    • Windows service keys (Desktop_VirtualMachine_WindowsServiceKeys): Windows only. Entries that exist only when the helper tools of a virtual machine are installed. The shipped list covers VirtualBox, VMware, and Parallels.
    Note

    The address prefix of Hyper-V is not in the shipped list on purpose. It also shows up on normal Windows computers that use Hyper-V or WSL, and would report honest players.

    What it reports

    When a virtual machine is found, the detector sends a DesktopCheatingDetectionStatus:

    public struct DesktopCheatingDetectionStatus : IDesktopCheatingDetectionStatus
    {
        // How likely this find is a false alarm, from 0 to 1.
        public float PossibilityOfFalsePositive { get; }
    
        // How much this find adds to the threat score.
        public uint ThreatRating { get; }
    
        // What kind of sign was found.
        public EDesktopCheatingType DesktopCheatingType { get; }
    
        // A short text that says what was found.
        public string Evidence { get; }
    }
    

    DesktopCheatingType is one of these:

    VIRTUAL_MACHINE_BIOS = 30,           // The hardware description names a virtual machine.
    VIRTUAL_MACHINE_MAC = 31,            // A network adapter belongs to a virtual machine maker.
    VIRTUAL_MACHINE_HYPERVISOR_BIT = 32  // The processor says it runs inside a virtual machine.
    

    Good to know

    • The detector checks when the game starts. With Check Only On Game Start off it checks again on the interval. You can also check yourself with ManualScan().
    • The three signs report on their own, each once per session. One virtual machine can so add up to three finds.
    • PossibleCheatingDetected stays true after the first find.
    • A find adds its Threat Rating to the threat score. A higher false-alarm chance makes it add less. With the default values, even all three signs together only reach a soft punisher.
    • The predefined monitor prefab has no punisher. A find only raises the threat score until you react yourself or add a punisher.

    Platforms and requirements

    • Windows, macOS, and Linux standalone builds.
    • The network adapter check runs on all three. The other signs are only available on some systems.
    • No extra plugin is needed.
    Note

    The detector skips the Unity Editor and development builds. Turn on Verify development builds on the Desktop tab to run it there too.

    React to a find

    In the Inspector. Add a method to On Cheating Detection Event. It runs when a virtual machine is found.

    In code. Ask the detector:

    var detector = AntiCheatMonitor.Instance.GetDetector<DesktopVirtualEnvironmentDetector>();
    
    if (detector != null && detector.PossibleCheatingDetected)
    {
        // The game runs inside a virtual machine.
    }
    

    Or listen, so your code runs at the moment of the find:

    using System;
    using GUPS.AntiCheat;
    using GUPS.AntiCheat.Core.Detector;
    using GUPS.AntiCheat.Detector.Desktop;
    using UnityEngine;
    
    public class VirtualMachineLogger : MonoBehaviour, IObserver<IDetectorStatus>
    {
        private void Start()
        {
            var detector = AntiCheatMonitor.Instance.GetDetector<DesktopVirtualEnvironmentDetector>();
            detector.Subscribe(this);
        }
    
        public void OnNext(IDetectorStatus status)
        {
            if (status is DesktopCheatingDetectionStatus desktopStatus)
            {
                Debug.LogWarning($"Virtual machine found: {desktopStatus.DesktopCheatingType} ({desktopStatus.Evidence})");
            }
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    Back to the Detector overview.

    In This Article
    Back to top GuardingPearSoftware documentation