Detection Playbook: Virtualization/Sandbox Evasion (T1497)

T1497 · 2026-08-04

Virtualization/Sandbox Evasion

Stealth
Linux macOS Windows
MITRE ATT&CK →
Technique Virtualization/Sandbox Evasion (T1497)
Tactic Stealth
Platforms Linux, macOS, Windows

Overview

Virtualization/Sandbox Evasion (T1497) describes a class of techniques where malware actively probes its execution environment to determine whether it is running inside a virtual machine, sandbox, or security analysis platform. If the malware concludes it is being observed, it will suppress its malicious behavior, delay execution, or simply exit — preventing automated analysis tools and dynamic sandboxes from capturing its true capability.

Every security team needs visibility into this technique because it is a direct attack on your detection pipeline itself. Malware that successfully evades your sandbox never generates behavioral alerts, never produces network IOCs, and never gets flagged by your threat intelligence feeds — meaning a silent compromise can persist indefinitely. Detecting evasion attempts is often the only signal you will get before the real payload activates.

Attacker Perspective

Adversaries use sandbox evasion as a first-stage gate to ensure their tooling only executes in genuine victim environments, dramatically reducing their operational exposure and analyst visibility.

  • VM artifact enumeration via WMI: Malware queries WMI for hardware identifiers — for example, SELECT * FROM Win32_ComputerSystem WHERE Model LIKE '%VirtualBox%' or checking Win32_BIOS.SerialNumber for strings like VBOX, VMWARE, or QEMU — and aborts execution if a match is found.
  • Sleep-based timing evasion: Scripts or binaries call kernel32.dll!Sleep() with very long delays (e.g., 10+ minutes) or use tight CPU-burn loops to outlast sandbox analysis windows, since most automated sandboxes time out after 2–5 minutes.
  • Security tool enumeration: Malware enumerates running processes using tasklist.exe or ps aux and looks for known analysis tools such as wireshark.exe, procmon.exe, fiddler.exe, ollydbg.exe, or x32dbg.exe before proceeding.
  • User activity checks: Implants inspect mouse cursor movement history, recently accessed files, browser history length, or screen resolution (sandboxes commonly use 800×600 or 1024×768) to detect the absence of a real interactive user session before detonating a payload.

This technique is attractive to adversaries precisely because it costs them almost nothing — a few dozen lines of code — but can completely blind an entire tier of the defender’s detection stack.

Detection Strategy

Required Telemetry

  • Windows — Process Creation (Event ID 4688): Enable via GPO Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy → Detailed Tracking → Audit Process Creation = Success. Also enable command-line logging via GPO: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit → ProcessCreationIncludeCmdLine_Enabled = 1. Without command-line logging, Event ID 4688 is nearly useless for this technique.
  • Windows — PowerShell Script Block Logging (Event ID 4104): Enable via GPO: HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging → EnableScriptBlockLogging = 1. This captures deobfuscated PowerShell at execution time and will surface WMI queries embedded in scripts.
  • Windows — WMI Activity Log (Event ID 4688 + Microsoft-Windows-WMI-Activity/Operational): Enable the WMI Operational log via Event Viewer or: wevtutil sl Microsoft-Windows-WMI-Activity/Operational /e:true. Event ID 5857/5858/5861 in this channel captures WMI query execution and errors.
  • Windows — Sysmon (Event IDs 1, 10, 11, 12, 13): Deploy Sysmon with the SwiftOnSecurity or Olaf Hartong configuration. Event ID 1 (Process Create) provides hashes and parent GUID. Event ID 10 (Process Access) detects when processes enumerate other processes via OpenProcess. Event ID 11/12/13 capture file and registry access relevant to VM artifact checks.
  • Windows — Registry Access via Sysmon Event ID 13: Sysmon registry value queries against known VM-indicator keys such as HKLM\HARDWARE\DESCRIPTION\System\BIOS, HKLM\SOFTWARE\VMware, Inc., and HKLM\SYSTEM\CurrentControlSet\Services\VBoxGuest should be captured and alerted on when queried by non-system processes.
  • Linux — Auditd Rules: Add the following rules to /etc/audit/audit.rules: -a always,exit -F arch=b64 -S execve -k process_execution and -a always,exit -F arch=b64 -S open,openat -F dir=/proc -k proc_enumeration. The /proc rule captures processes reading /proc/cpuinfo, /proc/scsi/scsi, or /sys/class/dmi/id/ for VM artifact strings.
  • Linux — Sysdig or eBPF (Falco): Deploy Falco with rules targeting reads of /proc/cpuinfo, /sys/class/dmi/id/product_name, and /dev/vboxguest by non-root, non-system processes.
  • macOS — Unified System Log (via log stream or Endpoint Security Framework): Use an EDR with ESF integration or enable OpenBSM auditing (/etc/security/audit_control) to capture process execution and file access events. Key paths: /Library/Preferences/VMware Fusion/ and IOKit service enumeration for VBoxGuest.
  • EDR Telemetry (CrowdStrike, Defender for Endpoint, SentinelOne): All three platforms natively capture process trees, WMI queries, and registry reads with high fidelity. Where available, EDR telemetry should be your primary source for this technique — it is far richer than raw event logs alone.
  • Sandbox/Detonation Platform Logs: If you run an internal sandbox (Cuckoo, ANY.RUN, Joe Sandbox), collect its behavioral reports and feed evasion-detected flags into your SIEM as a data source.

Key Indicators

  • WMI queries targeting hardware model strings: In Sysmon Event ID 1 or WMI Operational logs, look for CommandLine or QueryString containing Win32_ComputerSystem, Win32_BIOS, Win32_VideoController, or Win32_NetworkAdapter combined with values like VBOX, VMWARE, VIRTUAL, QEMU, XEN, or BOCHS.
  • Process enumeration for analysis tools: In Sysmon Event ID 10 (ProcessAccess), look for TargetImage matching wireshark.exe, procmon.exe, procexp.exe, fiddler.exe, ollydbg.exe, x32dbg.exe, x64dbg.exe, ida.exe, pestudio.exe, or regshot.exe opened by an unusual or unsigned process.
  • tasklist or process enumeration from unusual parents: Event ID 4688 / Sysmon Event ID 1 showing Image = tasklist.exe or wmic.exe with CommandLine containing process list, and where ParentImage is not a known administrative tool (e.g., spawned from a macro-enabled Office document or a script interpreter).
  • Registry reads on known VM artifact keys: Sysmon Event ID 13 with TargetObject matching HKLM\HARDWARE\DESCRIPTION\System\BIOS\SystemManufacturer, HKLM\SOFTWARE\Oracle\VirtualBox Guest Additions, or HKLM\SYSTEM\CurrentControlSet\Enum\IDE\*VBOX* queried by a process outside of System, svchost.exe, or known inventory agents.
  • Extended sleep or tight CPU loops from scripts: PowerShell Script Block Logging (Event ID 4104) showing ScriptBlockText containing Start-Sleep -Seconds with a value greater than 300, or patterns like [System.Threading.Thread]::Sleep(600000) in an otherwise suspicious execution context.
  • CPUID instruction or RDTSC timing checks: EDR behavioral telemetry may flag inline assembly or use of __cpuid intrinsics by scripting engines or suspicious PE files — look for process anomaly flags in CrowdStrike or Defender for Endpoint around “hypervisor bit” checks.
  • Linux /proc and /sys reads for VM strings: Auditd SYSCALL records with key=proc_enumeration and name containing /proc/cpuinfo, /sys/class/dmi/id/sys_vendor, or /sys/class/dmi/id/product_name by a non-root process that was itself created by a network-facing service or script interpreter.
  • Screen resolution or user-activity checks via PowerShell/WMI: Event ID 4104 showing calls to Get-WmiObject Win32_DesktopMonitor or [System.Windows.Forms.Screen]::PrimaryScreen.Bounds, particularly in scripts that also contain payload download or injection logic elsewhere in the same session.

Detection Logic

Rule 1 — Broad: WMI or WMIC Hardware Enumeration by Non-Administrative Process
IF (process_name IN ["wmic.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe"]) AND (command_line CONTAINS_ANY ["Win32_ComputerSystem", "Win32_BIOS", "Win32_VideoController", "Win32_NetworkAdapter"]) AND (parent_process NOT IN ["sccm.exe", "ccmexec.exe", "msiexec.exe", "explorer.exe"]) AND (user NOT IN [known_admin_accounts]) THEN alert severity=medium

This broad rule catches any scripting engine or WMI client performing hardware discovery. Expect moderate volume — primary false positives come from legitimate asset management and software deployment tools. Use it to build a baseline before tightening. Expected volume: 10–50 alerts/day in an untuned environment.

Rule 2 — Medium: Process Enumeration Targeting Known Analysis Tools
IF (event_id = 4688 OR sysmon_event_id = 1) AND (command_line CONTAINS_ANY ["wireshark", "procmon", "procexp", "fiddler", "ollydbg", "x32dbg", "x64dbg", "pestudio", "regshot"]) AND (parent_process NOT IN ["explorer.exe", "cmd.exe" WHERE user IN [known_security_team_accounts]]) THEN alert severity=high

This catches malware explicitly searching for analyst tooling by name in process listings or command lines. Legitimate users rarely enumerate these tools programmatically. Expected volume: very low (fewer than 5/day), making this a high-confidence signal worth immediate triage.

Rule 3 — Narrow: Registry Read of Known VM Artifact Keys by Unsigned Process
IF (sysmon_event_id = 13) AND (target_object CONTAINS_ANY ["VBOX", "VirtualBox", "VMware", "QEMU", "Xen", "BOCHS", "Parallels"]) AND (process_signature_status != "Valid") AND (process_name NOT IN ["VBoxService.exe", "vmtoolsd.exe", "System"]) THEN alert severity=high

Unsigned processes reading VM-specific registry keys are a very strong indicator of malware performing environment checks. This rule is high precision with low false positive rate. Expected volume: fewer than 3 alerts/day even in large environments.

Rule 4 — Narrow: Suspicious Long Sleep in PowerShell With Outbound Network Context
IF (event_id = 4104) AND (script_block_text MATCHES REGEX "Sleep\s*[\(\-]\s*[3-9]\d{2,}|Sleep\s*[\(\-]\s*\d{4,}") AND (process_name = "powershell.exe") AND (within_last_15_minutes: network_connection_established = true WHERE process_guid = same_process_guid) THEN alert severity=high

This correlates an anomalously long sleep command in PowerShell with an outbound network connection from the same process, flagging the classic sandbox-outlasting pattern used by stagers. Low false positive rate when the network correlation is enforced. Expected volume: 1–5 alerts/week.

Tuning Guidance

  • Asset management and SCCM/Intune agents: Tools like ccmexec.exe, MicrosoftEdgeUpdate.exe, and hardware inventory agents legitimately query Win32_ComputerSystem and Win32_BIOS. Exclude parent_process IN ["ccmexec.exe", "sccm.exe", "ManagementAgent.exe"] and process_name IN ["ccmexec.exe"] from WMI enumeration rules.
  • Virtualization management software on hypervisor hosts: On ESXi hosts or Hyper-V management servers, vmtoolsd.exe, VBoxService.exe, and vmwaretray.exe will legitimately read VM artifact registry keys constantly. Exclude these by process_name IN ["vmtoolsd.exe", "VBoxService.exe", "vmacthlp.exe"] or by host tag asset_type = "hypervisor".
  • Security and IT operations teams running analysis tools: Your own SOC analysts legitimately run Wireshark, Process Monitor, and x64dbg. Create a named group of known security-team workstations or accounts and exclude them: hostname IN [soc_workstations_group] OR user IN [security_team_accounts]. Never exclude by username alone — use a combination of host and user.
  • Scripted automation with deliberate delays: CI/CD pipelines, deployment scripts, and monitoring agents sometimes include legitimate Start-Sleep calls. Tune the sleep-based rule by requiring the network connection correlation to fire, and add exclusions for parent_process IN ["jenkins.exe", "bamboo.exe", "deploy.ps1" signed by internal cert].
  • Developer workstations running VMs or emulators: Developers using Docker Desktop, WSL2, or Android emulators will trigger VM artifact registry reads. Suppress by asset_group = "developer_workstations" AND process_name IN ["docker.exe", "wsl.exe", "qemu-system*.exe"].

When the Alert Fires: Investigation Steps

  1. Confirm the alert is real and not a rule artifact. Pull the raw event from your SIEM (Splunk: index=windows EventCode=4688 filtered to the specific host and time; Sentinel: SecurityEvent | where EventID == 4688) and verify the CommandLine, ProcessId, and timestamp match what triggered the alert. Confirm the process actually executed — do not proceed on a parse error or field-mapping artifact.
  2. Identify the affected host and user account. Note the hostname, IP, OS version, and the account under which the suspicious process ran — flag immediately if the account has elevated privileges (local admin, domain admin, or service account). Check your asset inventory (CMDB or EDR console) to confirm whether this host is a known analysis machine, developer workstation, or production endpoint.
  3. Reconstruct the full process tree and command-line chain. In your EDR (CrowdStrike Process Tree, Defender for Endpoint Device Timeline, or Sysmon Event ID 1 joined on ParentProcessGuid) trace from the triggering process all the way back to the root parent. Look for suspicious ancestry: winword.exe → powershell.exe → wmic.exe or chrome.exe → cmd.exe → cscript.exe are immediate red flags indicating initial access via phishing or drive-by.
  4. Examine all file writes and network connections made by the process and its children. Use Sysmon Event IDs 11 (FileCreate), 3 (NetworkConnect), and 15 (FileCreateStreamHash) filtered on the same ProcessGuid. Look for files dropped to %TEMP%, %APPDATA%, or C:\Users\Public\, and for outbound connections to non-standard ports or newly registered domains. Run any dropped file hashes through VirusTotal, MalwareBazaar, or your threat intel platform immediately.
  5. Check for lateral movement originating from this host. In your SIEM, query for authentication events (Windows Event IDs 4624 type 3, 4648, 4768, 4769) sourced from this host’s IP in the 24 hours following the alert. Also query Sysmon Event ID 3 for SMB (port 445), WinRM (port 5985/5986), or RDP (port 3389) outbound connections. A compromised host running sandbox evasion checks may be an early-stage implant that has already moved — check before you contain to avoid losing visibility.
  6. Hunt for persistence mechanisms added on this host. Query Sysmon Event IDs 12/13 (Registry CreateKey/SetValue) for writes to HKCU\Software\Microsoft\Windows\CurrentVersion\Run, HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, or scheduled task XML paths under C:\Windows\System32\Tasks\. Cross-reference with Event ID 4698 (Scheduled Task Created) and 7045 (New Service Installed). On Linux, check auditd for writes to /etc/cron.d/, /etc/systemd/system/, or ~/.bashrc.
  7. Make the escalation decision. Escalate to a confirmed incident and engage IR if any of the following are true: the process tree shows a document or browser as an ancestor, a payload was dropped to disk and confirmed malicious by threat intel, outbound C2 connections were established, lateral movement is detected, or the account involved is privileged. If no payload drop, no network connections, and the process is signed by a known vendor, close as a false positive with documented tuning applied.

Response Playbook

Containment

  • Isolate the host at the network level — but leave it powered on. Use your EDR console (CrowdStrike: Network Containment; Defender for Endpoint: Isolate Device; SentinelOne: Network Quarantine) to cut off all network access while preserving volatile memory and running processes for forensic collection. Do not shut down — you will lose in-memory artifacts critical to understanding the full payload.
  • Disable the affected user account immediately if it is a domain account. In Active Directory, use Disable-ADAccount -Identity [username] or the ADUC console. If it is a local account, disable via net user [username] /active:no on the host through your EDR’s remote shell. If the account is a service account, coordinate with the application owner before disabling — but err on the side of disabling if a privileged account is involved.
  • Block identified C2 IPs and domains at the firewall and DNS layer. Submit any outbound IPs or domains identified in step 4 of the investigation to your firewall team for an immediate block rule. Also add them to your DNS sinkhole (Pi-hole, Infoblox, or Windows DNS RPZ). If using a CASB or proxy, block at that layer as well. Document the exact IPs and FQDNs blocked with timestamps for the incident record.
  • Kill the malicious process if it is still running. Use your EDR’s remote kill capability or taskkill /F /PID [pid] via remote shell. If multiple child processes were spawned, kill the entire process tree. Capture a memory dump of the process before killing if your EDR supports it — this can yield unpacked payloads and C2 configuration.
  • Revoke active authentication sessions and tokens. If the account authenticated to other systems during the investigation window, invalidate those sessions: in Azure AD/Entra ID use Revoke-AzureADUserAllRefreshToken; for on-prem Kerberos, reset the account password to force TGT invalidation (password reset triggers a new NTLM hash and invalidates existing Kerberos tickets after the ticket lifetime expires — consider a KRBTGT reset if a domain admin was involved).

Eradication

  • Remove all identified persistence mechanisms. Delete malicious scheduled tasks via schtasks /delete /tn "[task name]" /f or through the Task Scheduler MMC snap-in after confirming malicious intent. Remove malicious registry Run keys using reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v [ValueName] /f. Document every artifact removed with its full path and content for the incident record.
  • Find and delete all dropped payloads and staging tools. Using your EDR’s file search or a manual search via Get-ChildItem -Path C:\Users -Recurse -Include *.exe,*.dll,*.ps1,*.vbs,*.bat -ErrorAction SilentlyContinue, identify files written by the malicious process and confirmed malicious by hash lookup. Also check %TEMP%, %APPDATA%\Roaming, and C:\ProgramData\ for anomalous binaries.
  • Reset credentials for all accounts that executed or were accessed by the malicious activity. Reset passwords for the affected user account and any accounts whose credentials may have been visible in memory (e.g., accounts with active sessions on the compromised host at the time of compromise). Force MFA re-enrollment if the organization uses MFA, as MFA tokens may also be compromised.
  • Check all hosts the compromised account authenticated to within the incident window for backdoors. Pull authentication logs (Event ID 4624) for the account, identify every host it logged into during the window, and run a targeted hunt on those hosts for the same IOCs (file hashes, registry keys, scheduled task names). Sandbox evasion behavior often precedes a second-stage payload — those secondary targets may be infected even if they showed no evasion alerts.
  • Rotate any secrets or API keys that may have been exposed. If the compromised host had access to vaults, cloud provider credential files (~/.aws/credentials, %APPDATA%\.azure), or service account password files, rotate those credentials immediately in the respective platforms. Alert the cloud security team to review CloudTrail/Azure Activity Log for anomalous API calls using those credentials during and after the compromise window.

Recovery

  • Re-image the host if confidence in full eradication is less than certain. If any doubt exists about hidden persistence or rootkit-level compromise — especially given that sandbox evasion suggests a sophisticated actor — re-image from a known-good golden image rather than attempting to clean in place. Restore user data only from backups taken before the earliest confirmed indicator, not from files on the compromised disk.
  • Before reconnecting to the network, run a validation scan. Boot from a trusted endpoint protection medium or run your EDR’s offline scan against the drive to confirm no malicious artifacts remain. Only remove network isolation after this validation passes and is documented.
  • Re-enable the user account only after confirming no persistence remains on any host the account touched. Require the user to change their password, re-enroll MFA, and attend a brief security awareness touchpoint before resuming normal access. Notify the user’s manager of the incident per your organization’s HR and communication policies.
  • Implement enhanced monitoring on the recovered host and account for at least 72 hours post-reconnection. Create a temporary watchlist in your SIEM (Splunk notable, Sentinel watchlist, or EDR custom detection) that fires on any process execution, network connection, or registry write from this host or account. Review these alerts manually during the monitoring window rather than relying solely on automated triage.
  • Conduct a post-incident review and update your detection content. Document the full attack timeline from initial access through evasion attempt to containment, identifying any gaps in detection coverage. Add any new IOCs (hashes, domains, registry key names, command-line patterns) to your threat intelligence platform and update SIEM rules. Formally close the incident ticket with root cause, timeline, remediation actions, and a lessons-learned summary distributed to the SOC team.

Stay Ahead

Get daily threat intelligence and detection playbooks.

Free. No account. No email. Follow in Feedly, Inoreader, or any RSS reader.