Abstract
Dynamic malware analysis generates extensive behavioral reports that are often noisy and high-dimensional. Traditional deep learning models, such as Convolutional Neural Networks (CNNs) and Long Short-Term Memory (LSTM) networks, struggle to capture long-range dependencies or handle the heterogeneity of these logs. This paper introduces Nebula, a Transformer-based framework designed for robust dynamic analysis. Nebula employs domain-specific data normalization, Byte Pair Encoding (BPE), and a modified self-attention mechanism to process long sequences efficiently. Our evaluation shows that Nebula achieves a state-of-the-art True Positive Rate (TPR) of 0.570 at a $10^{-3}$ False Positive Rate (FPR) on the Speakeasy dataset. Furthermore, self-supervised pre-training allows the model to maintain high performance even with an 80% reduction in labeled training data.
Introduction
Dynamic analysis involves executing a suspicious file in a controlled environment—such as a sandbox or emulator—to record its runtime behavior. This process yields detailed logs of API calls, file system modifications, and network activity. However, these logs present significant challenges for automated detection systems: they are often massive, unstructured, and contain "stochastic" noise like unique session IDs, timestamps, and randomized file paths.
Existing machine learning approaches typically utilize CNNs or LSTMs. CNNs are effective at capturing local patterns but fail to grasp global context across long sequences. LSTMs, while designed for sequences, suffer from vanishing gradients and computational inefficiency when processing the extremely long reports typical of modern malware. Nebula addresses these limitations by leveraging the Transformer architecture, which uses self-attention to model dependencies regardless of their distance in the sequence.
Methodology
The Nebula framework consists of a multi-stage pipeline optimized for behavioral report processing:
Data Cleaning and Normalization
To prevent overfitting on unique, non-repeating strings, Nebula applies a domain-specific normalization step ($\psi$). Stochastic values such as specific IP addresses, hex-sums, and randomized paths are replaced with generic placeholders (e.g., <sha256>, <domain>). This ensures the model learns behavioral patterns rather than specific indicators of compromise that may not generalize.
Feature Extraction
Nebula utilizes Byte Pair Encoding (BPE) for tokenization. Unlike standard whitespace splitting, BPE breaks down logs into sub-word units. This approach mitigates the "vocabulary explosion" problem and allows the model to handle previously unseen strings by decomposing them into known sub-components.
Model Architecture
The core of Nebula is a Transformer Encoder. To manage the $O(N^2)$ complexity of self-attention on long sequences, the authors implement a Reduced Self-attention Span. The input sequence is partitioned into independent spans, enabling the model to process long reports efficiently while maintaining the ability to correlate events across the sequence.
Self-Supervised Learning (SSL)
Nebula explores two pre-training strategies to leverage unlabeled data: Masked Language Modeling (MLM) and Autoregressive next-token prediction. These techniques allow the model to learn the underlying "language" of system behavior before being fine-tuned on specific detection or classification tasks.
Experimental Evaluation
Nebula was evaluated across three diverse datasets: the Speakeasy dataset (Windows kernel emulator logs), the Avast-CTU dataset (large-scale sandbox reports), and the Malicious Code Dataset (MCD) (API call sequences).
Performance Results
Nebula demonstrated superior performance compared to state-of-the-art (SOTA) models like Neurlux. On the Speakeasy dataset, it achieved a 0.570 TPR at a strict $10^{-3}$ FPR, representing a 12% improvement over previous benchmarks. In classification tasks, Nebula outperformed existing models in the majority of malware categories across both the Speakeasy and Avast-CTU datasets.
Data Efficiency and Explainability
A key finding was the impact of self-supervised pre-training. Using autoregressive pre-training, Nebula matched the performance of a fully supervised model while using only 20% of the labeled training data. This suggests that SSL is a viable path for training robust detectors in domains where labeled malware samples are scarce.
Furthermore, explainability analysis using Integrated Gradients confirmed that the model focuses on semantically meaningful tokens. For instance, the model prioritized tokens related to privilege escalation (advapi32) and specific UI parameters, indicating that it learns actual malicious intent rather than statistical artifacts.
Conclusion
Nebula represents a significant advancement in dynamic malware analysis by successfully adapting Transformer architectures to the cybersecurity domain. By combining domain-specific normalization with self-attention and self-supervised learning, Nebula achieves high accuracy and data efficiency. Future work will focus on enhancing robustness against adversarial evasion techniques and scaling the model to even larger unlabeled datasets to further refine its behavioral understanding.
Summary updated