Abstract
Malware detection is a ubiquitous application of Machine Learning (ML) in security. In behavioral malware analysis, the detector relies on features extracted from program execution traces. The research literature has focused on detectors trained with features collected from sandbox environments and evaluated on samples also analyzed in a sandbox. However, in deployment, a malware detector at endpoint hosts often must rely on traces captured from endpoint hosts, not from a sandbox. Thus, there is a gap between the literature and real-world needs. We present the first measurement study of the performance of ML-based malware detectors at real-world endpoints. Leveraging a dataset of sandbox traces and a dataset of in-the-wild program traces, we evaluate two scenarios: (i) an endpoint detector trained on sandbox traces (convenient and easy to train), and (ii) an endpoint detector trained on endpoint traces (more challenging to train, since we need to collect telemetry data). We discover a wide gap between the performance as measured using prior evaluation methods in the literature -- over 90% -- vs. expected performance in endpoint detection -- about 20% (scenario (i)) to 50% (scenario (ii)). We characterize the ML challenges that arise in this domain and contribute to this gap, including label noise, distribution shift, and spurious features. Moreover, we show several techniques that achieve 5–30% relative performance improvements over the baselines. Our evidence suggests that applying detectors trained on sandbox data to endpoint detection is challenging. The most promising direction is training detectors directly on endpoint data, which marks a departure from current practice. To promote progress, we will facilitate researchers to perform realistic detector evaluations against our real-world dataset.
Introduction: The "Grim Reality" of Lab-Grown Models
Machine learning models for malware detection often boast over 90% accuracy in research papers. However, this study reveals a stark reality: when these models are deployed on real-world user endpoints, performance can plummet to as low as 17%. This massive gap is driven by significant distribution shifts in the detection pipeline and a reliance on "spurious features"—such as trace length—that models over-exploit in controlled laboratory settings.
The Detection Pipeline and the Problem
In the security industry, malware detection is a multi-stage pipeline. "Static" methods, such as file signatures, blocklists, and file reputation, catch the most obvious threats early. Machine Learning (ML) serves as the "last line of defense," tasked with analyzing the behavioral traces of programs that have already bypassed these initial checks.
Most academic research evaluates ML models using sandboxes—isolated, controlled environments where malware is "detonated" to observe its behavior. However, real-world user devices (endpoints) differ significantly from sandboxes. Malware often employs evasion techniques when it detects a sandbox environment, and the "background noise" of a typical user's PC is far more complex than a clean lab environment. This research quantifies the performance gap between these lab-grown models and their real-world utility.
Methodology and Datasets
The researchers evaluated three state-of-the-art deep learning architectures for behavioral detection: NGR (n-grams), HYB (Hybrid CNN/Attention), and ATT (Attention/Transformer). They tested two primary deployment scenarios: SB → EP (training on sandbox data and testing on real-world endpoint data) and EP → EP (training and testing directly on endpoint data).
The study utilized a massive, unique dataset including approximately 1 million execution traces from 26,000 samples captured from real Windows hosts across 100+ countries. These samples were specifically those that had bypassed static defenses at the time of capture.
Analysis of the Performance Gap
Several factors contribute to the observed "performance cliff":
- The Filtering Effect: ML models in the wild only encounter the "hardest" samples—those that have already tricked static signatures. Testing on a broad distribution of all malware drastically overestimates real-world performance.
- Spurious Features (The Trace Length Trap): In sandboxes, malware often terminates early to evade analysis, resulting in short traces. Lab-trained models learn that "short trace = malware." On a real user's PC, many benign background processes also have short traces, leading to high false-positive rates.
- Sandbox Artifacts: Models often learn to recognize the sandbox environment itself (e.g., pre-installed apps) rather than the malware.
Experimental Results
The study found that models achieving ~95% True Positive Rate (TPR) in sandbox-to-sandbox tests dropped to just ~17% TPR when applied to real endpoints at the same false-positive threshold. Training directly on endpoint data (EP → EP) improved performance to ~49% TPR.
To bridge this gap, the researchers introduced Invariant Learning to ignore environment-specific artifacts and Soft Labeling to handle samples where antivirus engines disagree. These techniques provided a relative performance boost of 5–30%, pushing EP → EP performance to approximately 52%.
Conclusion
The evidence suggests that applying detectors trained on sandbox data to endpoint detection is fundamentally challenging. The most promising direction is training detectors directly on endpoint data, marking a departure from current practice. To encourage community progress, the authors have released their sandbox dataset and established a public leaderboard for realistic evaluations against "in-the-wild" data.
Summary updated