How Malware Evades Sandboxes: Detection Techniques and Defense Strategies
Sandboxes have long moved beyond rare laboratory tools. Documents, archives, installers, and links arrive daily through email, websites, messengers, and cloud storage, often bypassing traditional defenses. An antivirus may not recognize a new sample. A mail filter can let through a file without obvious attack indicators. A firewall sees connections but does not always understand what an opened document is doing inside a workstation.
A sandbox solves the problem differently. It executes the suspicious file in an isolated environment and monitors behavior and system changes. Defenders receive a verdict and a detailed report at the end of the analysis.
In many cases the malware does not directly break the sandbox. Instead it tries to determine whether it is running on a real computer or in an analysis environment. If the program detects signs of inspection, the malicious payload may stay dormant or display only legitimate behavior.
How a Sandbox Analyzes a Suspicious File
A sandbox does more than simply launch a file. It combines several analysis types, each revealing different aspects of the threat. First it may check the file against known indicators such as checksums, signatures, and database matches. Modified or previously unknown programs can still slip past signature detection.
Static analysis follows. Without executing the file, the sandbox examines its structure and strings. This method helps locate threats quickly but may miss logic hidden until runtime.
Dynamic analysis executes the file in a controlled environment and tracks system changes. Code analysis reveals not only the file itself but also the consequences of execution.
Behavioral analysis correlates individual events into a coherent scenario. Creating a file in a temporary folder alone does not always indicate an attack. When the same process also launches a script and attempts to disable protection, the intent becomes clear.
Can Malware Evade a Sandbox?
Yes, malware can evade sandboxes. The approach usually involves evasion rather than direct compromise of the protective solution. The malware inspects its surroundings and decides whether to reveal real activity. If it detects a virtual machine, analysis tools, or an overly clean system, the main malicious component may remain inactive.
MITRE ATT&CK classifies this behavior as technique T1497. MITRE divides the methods into system checks, user activity checks, and timing checks. For defenders, attempts to recognize the sandbox themselves become suspicious behavior.
Recent data confirm the problem’s relevance. The Picus Red Report 2026 placed technique T1497 back in the top five most common techniques, reaching fourth place after two years outside the top ten. The return signals attackers shifting toward greater stealth and deliberate analysis evasion.
Evasion can appear simple. The file launches, performs no noticeable actions, and exits. Or it waits several minutes until automated inspection ends. Or it displays decoy activity such as opening a normal window without touching the system. The sandbox report shows an almost clean sample, yet on an employee’s real workstation the malware could have downloaded additional modules, stolen data, or started encryption.
How Malware Detects Virtual Environments
A sandbox must resemble an ordinary computer. The more the analysis environment differs from a real workstation, the easier it is for malware to recognize inspection. Authors of malicious programs examine many small details: device names, system parameters, virtualization traces, network indicators, and even user habits.
Checking files, directories, and the registry
Virtual machines and analyzers leave traces. The system may contain drivers, services, directories, and registry keys linked to VMware, VirtualBox, Hyper-V, QEMU, and other environments. For defenders these elements are normal. For malware they serve as warning signals.
The malware searches for characteristic names in services, checks driver paths, inspects registry branches, and compares found strings against known indicator lists. Too many matches cause the program to stop activity or postpone the main payload. This technique works especially well against typical, poorly masked virtual machines.
Checking system parameters
A real workstation rarely looks empty. An employee usually has documents, browser history, installed programs, cache, bookmarks, multiple windows, printers, messengers, and traces of normal work. An analysis environment is often minimal: little RAM, one or two CPU cores, a small disk, standard screen resolution, a fresh user profile, and an almost empty desktop.
The malware compares these signs against the expected image of a real computer. Small disk size, absence of user files, template computer name, suspicious account names such as “test” or “sandbox,” and short system uptime can reveal the analysis environment. One sign rarely decides everything, but a combination helps the malware reach a decision.
A recent example is Blitz, described by Unit 42 in 2025. The malware checked the number of processors, low screen resolutions, the ANY.RUN driver, and known registry keys associated with sandboxes and virtual machines. If the environment matched an analysis setup, the program terminated.
Checking hardware signatures
A virtual machine often emulates hardware but does not always look like a physical computer. Malware can inspect BIOS information, disk manufacturer, network adapter identifier, processor data, presence of audio devices, video card parameters, and other details. If the hardware appears too artificial, the program hides its real logic.
Absence of an audio device or a low number of connected devices can look suspicious for a workstation. Malware uses such details to determine whether it faces a real computer or a laboratory construct.
Checking the network
Malware examines network information. If the address belongs to research infrastructure, a security vendor, or a known analysis center, the program may avoid contacting its command-and-control server.
Sometimes the decision is made not by the file itself but by the attackers’ remote infrastructure. The first module sends system information, and the server decides whether to deliver the next stage. If the environment resembles a sandbox, the server returns an empty response, a benign file, or no reply at all. Defenders see only the outer shell while the real payload stays with the attackers.
Why Timing Helps Malware Hide
Automated analysis cannot run indefinitely. A sandbox must process many files without delaying email or web traffic for hours. Many environments therefore observe a sample for a limited time. Malware authors exploit this limitation by adding delays before dangerous actions.
The simplest method is “sleep.” The program launches and waits longer than a standard analysis lasts. More sophisticated samples check system time, uptime, date, day of the week, sandbox reaction to accelerated clocks, and behavior after reboot. If the environment tries to fast-forward time artificially, malware can notice discrepancies between different time sources.
A good example is GootLoader. The malware actively uses long pauses before dangerous actions, and the limited computing resources of sandboxes make prolonged analysis of many samples difficult.
Timing logic also helps in link-based attacks. On weekends a link may lead to a harmless page, while on Monday, when an employee opens the email, the address serves malicious content. The sandbox inspected the link earlier and saw no threat because the dangerous content was not yet being delivered.
How Malware Checks for a Live User
An automated environment often fails to imitate a human. Malware can check whether the mouse moved, whether clicks occurred, whether the user scrolled a document, opened browser tabs, closed windows, or interacted with buttons. If no activity is detected, the program concludes the file was opened by a machine rather than an employee.
Modern samples analyze not only the fact of activity but also its character. Some versions of LummaC2, starting with v4.0, checked cursor movement using trigonometry: the program calculated angles between mouse movement directions and looked for overly straight, sharp, or artificial movements. If the behavior appeared robotic, the malware did not reveal its main activity.
For documents the check can be especially subtle. A malicious document waits for scrolling, page navigation, closing of warnings, or clicking interface elements. Attackers sometimes add images, tables, or long pages to distinguish human reading from automatic file opening.
Buttons may also be hidden, invisible, or reduced to tiny size. A human will not click them, while an automated script that clicks every element reveals itself.
Why a Sandbox Can Produce Errors
False results often stem from successful evasion. A “no threats found” verdict only means that dangerous behavior did not appear under the given conditions. The file may simply not have received a command from its server or may be waiting for user action.
Weak points also arise from configuration. If the sandbox sits out-of-band and receives file copies after delivery, malware can reach the user before results arrive. If encrypted web traffic is not inspected, some downloads remain invisible. If the analysis environment is always identical, malware authors can accumulate indicators and evade that specific configuration.
NIST guidance on preventing and handling malware incidents emphasizes that fighting malicious code requires combining prevention, detection, response, and recovery rather than relying on a single control. The NIST approach aligns well with sandbox practice: dynamic analysis must work together with endpoint protection, mail filtering, event logging, and network control.
How to Defend Against Sandbox Evasion
The first rule is not to rely on a single analysis method. A sandbox should combine signature checking, static analysis, dynamic execution, network monitoring, and behavioral evaluation. If a file performs no malicious actions yet actively searches for virtual-machine indicators, debugging tools, analyzers, or an empty user profile, that behavior itself deserves attention.
The second rule is to make the analysis environment resemble a real workplace. Profiles should contain documents, action history, installed programs, varied hardware parameters, realistic network settings, and plausible user-interaction scenarios. Realistic digital clutter such as browser cache, recent documents, bookmarks, varied screen resolutions, multiple accounts, and traces of normal work is also important. Diversity of configurations reduces the chance that malware will recognize all company sandboxes by one set of indicators.
The third rule is to inspect suspicious objects before delivery to users. For mail and web traffic a sandbox is especially useful when placed inline rather than analyzing copies after the fact. Encrypted traffic must be inspected where permitted by law, internal policy, and technical architecture. Without such inspection a significant portion of downloads remains in a blind spot.
The fourth rule is to connect the sandbox with other security tools. Reports must feed into incident response systems, endpoint protection, mail gateways, logging platforms, and network rules. When a sandbox detects suspicious behavior, the organization must quickly block similar files, addresses, domains, and processes on other nodes.
How to Choose and Deploy a Sandbox
When selecting a sandbox, organizations should look beyond attractive interfaces and marketing claims. It is more important to understand where the solution sits in the file-delivery chain, how many object types it supports, how quickly it delivers verdicts, how detailed its behavioral explanations are, and whether it handles modern anti-analysis techniques.
Integrations are critical. The sandbox must receive files from mail, web traffic, network storage, and endpoint protection tools, and analysis results must automatically flow to places where threats can be blocked. Separate checks should verify support for archives, office documents, scripts, executables, and links.
Two main deployment models exist: on-premises infrastructure and service-based models. On-premises gives more control but requires hardware, configuration, updates, and specialists. A service model reduces internal-team load but requires careful review of contracts, data storage, file-transfer channels, and confidentiality requirements.
During integration companies often make mistakes by treating the sandbox as a magic filter. While it reduces risk, updates and endpoint protection must not be neglected. Another mistake is focusing only on the final verdict. Analysts need details: which checks were performed, which processes contacted which addresses, and what actions occurred.
A third mistake is failing to update configurations. If a sandbox runs files for years in the same virtual machine with an empty profile, malware quickly learns to recognize that environment. Profiles must change, user-activity scenarios must grow more complex, and analysis time for questionable objects must increase.
Questions and Answers
- Does a sandbox guarantee detection of any malicious file? No. A sandbox significantly raises the probability of detection but provides no 100 percent guarantee. Modern malware can recognize the analysis environment or receive commands from a remote server only after additional checks.
- How does sandbox evasion differ from breaking the sandbox? In most cases malware does not attack the sandbox itself. The program tries to determine whether it is running in an analysis environment and hides its activity. This is evasion. Breaking the sandbox occurs far less often and requires separate vulnerability-exploitation techniques.
- What indicators reveal a virtual environment? The most common indicators are traces of VMware, VirtualBox, and other virtualization systems, low RAM, few CPU cores, an empty user profile, absence of documents and browser history, and suspicious network parameters and addresses.
- Why does malware check user actions? An automated analysis environment differs from real human behavior. Malware can therefore check window handling. Some families even analyze cursor-movement patterns to distinguish a human from a script.
- How can organizations improve sandbox effectiveness against modern threats? The best approach combines multiple analysis methods and configurations and integrates the sandbox with other security tools. It is also important to analyze not only malicious actions but also attempts to evade the inspection environment itself.
Conclusion
Malware can indeed evade sandboxes. The core idea of evasion is to recognize the analysis environment and avoid showing real activity. A sandbox remains a powerful tool when used correctly. Defenders must remember that a clean sandbox report does not always mean the file is safe. Reliable protection is built not on a single verdict but on combined analysis and rapid response.
Related articles
Realtek Jungle SDK Flaw CVE-2021-35394 Fuels Cling Botnet Spread Across Routers
Researchers at Nozomi Networks have observed a sharp rise in exploitation attempts against CVE-2021-35394, a critical remote code execution vulnerability in the Realtek Jungle SDK. The flaw, rated 9.8 on the CVSS scale and disclosed five years ago, is being used to deploy the Cling botnet on routers and video recorders. The affected SDK is embedded in products from multiple vendors, leaving large numbers of devices exposed because firmware updates are rarely applied. Cling carries exploits for seven distinct vulnerabilities targeting Realtek, Linksys, MVPower, TBK, LB-LINK, FiberHome and China Mobile hardware. Once installed, the malware performs recursive scanning, spreads like a worm, manipulates TCP tunnels and proxies, and participates in DDoS attacks. Its command-and-control channel hides instructions inside STUN protocol transaction IDs, impersonating legitimate responses from Google public STUN servers. FortiGuard Labs has confirmed the findings and tracks the variant as ClingSTUN.
Attackers Abuse Legitimate Microsoft Defender Exclusions to Conceal Malware
Huntress researchers have detailed an evasion technique in which threat actors avoid disabling Microsoft Defender entirely. Instead, they create targeted exclusions for specific folders or file extensions, allowing malware to operate undetected while the protection status remains apparently active. These exclusions are configured through PowerShell commands, Windows Management Instrumentation, Group Policy, or direct registry modifications, all requiring administrator privileges after initial compromise. A registry key named HideExclusionsFromLocalAdmins can further conceal the list of exclusions from local administrators viewing the interface. The approach has been linked to campaigns involving GootKit in 2019, WhisperGate in 2022 that excluded the entire C: drive, and Muddled Libra in 2024. Defenders are advised to monitor registry changes directly, as this bypasses interface hiding, and to flag exclusions of entire drives or common directories such as temporary and downloads folders.
SC Malware on WordPress Restores Deleted Backdoors in Seconds via Eight Persistence Points
Researchers at Sucuri have analyzed the SC malware targeting WordPress sites, which rapidly restores any removed backdoor components through a minimum of eight interconnected persistence mechanisms. The infection hides across PHP configuration settings, hidden loaders, theme files, and plugins, with some elements executing before standard WordPress plugins load. Copies of the malicious code are also stored in the database and System V shared memory on supported servers, allowing full reinfection from surviving sources after file cleanup. The backdoor evades plugin listings, gathers site and administrator session data, deploys additional PHP code, and disables security plugins while injecting JavaScript for payment data theft in online stores. Command-and-control occurs through public Ethereum RPC gateways and smart contracts with multiple fallback channels. Sucuri warns that PHP caching of the loader directive can crash request handling if the referenced file is deleted without prior preparation, and recommends a sequenced cleanup process.
RATHat Trojan Leverages Google Gemini to Infect and Control Android Devices
The banking trojan RATHat has begun using Google Gemini as an assistant to infect Android smartphones and maintain persistence. Researchers at Cleafy report that the malware first disguises itself as a legitimate application and tricks users into granting Accessibility permissions. Once inside, RATHat activates wireless debugging, connects via ADB, and deploys a separate Go-based service running with system-level privileges. Gemini helps the trojan interpret unfamiliar Android interfaces across different versions, languages, and manufacturer skins by analyzing UI structures and suggesting the correct taps. On the attacker side, the same model processes intercepted SMS messages, evaluates bank balances, and ranks compromised devices by financial value. Since April, Cleafy has observed nearly 100 deployments of the command-and-control infrastructure, pointing to a possible malware-as-a-service model. Removing the original APK is insufficient because the Go service survives independently until reboot and can reinstall the dropped payload.