TL;DR
This paper introduces a novel malware detection method that goes beyond just analyzing API call sequences by incorporating function parameters and their dependencies. By encoding these parameters and modeling their relationships, the method achieves state-of-the-art accuracy, outperforming existing techniques and offering a more robust defense against sophisticated malware.
What Problem Does This Paper Address?
The ever-evolving landscape of cyber threats means malware is constantly becoming more sophisticated. While traditional and deep learning methods have been applied to malware detection using API call sequences, they often overlook crucial information: the parameters passed to these API calls and the dependencies between them. Malware and benign software can use the same API calls, but malware often employs more dangerous parameters. Ignoring these parameters and their interdependencies leads to limited detection accuracy and makes it harder to distinguish between malicious and benign behavior, especially for unknown malware variants. This paper aims to bridge this gap by developing a method that leverages both function parameters and their functional dependencies for more effective malware detection.
Methods
The proposed method consists of two main stages: Function Parameters Encoding and Dependency Modeling.
- Function Parameters Encoding:
- Parameter Extraction: This stage extracts various types of API parameters (numerical, string, IP addresses, file paths, etc.) and encodes them into feature vectors. Techniques like numerical normalization, TF-IDF, and ordinal encoding are used, tailored to the specific characteristics of each parameter type. For instance, file paths are broken down into directory components, and IP addresses are analyzed for intranet/internet status.
- Discretization of Real-valued Parameters: To handle the vast parameter space and the semantic richness of string parameters, a clustering-based approach (specifically K-means++) is employed. This partitions parameters into clusters, effectively discretizing them and creating a more continuous representation for the subsequent deep learning model. This step helps in distinguishing homonymic API calls with different parameter behaviors.
- API Embedding: The discretized parameters are then used to create augmented API call sequences. Word2Vec is used to learn contextual dependencies and generate word embeddings that represent the APIs with their encoded parameters.
- Dependency Modeling:
- TCN-GRU Network: A deep neural network architecture combining Temporal Convolutional Networks (TCN) and Gated Recurrent Units (GRU) is designed. TCNs, with their causal and dilated convolutions, are adept at capturing long-range temporal dependencies in sequences without suffering from vanishing gradients. GRUs, a simplified version of LSTMs, are then used to further analyze these temporal features and model the dependencies between API calls.
- Classification: The output from the GRU layer is fed into a linear layer with a sigmoid activation function to classify the API call sequence as either benign or malicious.
Datasets
The study utilizes a publicly available dataset generated using a sandbox, which was also used in the DataCon2019 Big Data Security Analytics Competition.
- Total Samples: 60,000 software samples.
- Breakdown: 40,000 malware samples and 20,000 benign samples.
- Splitting: The dataset is divided into a training set (30,000 execution traces: 10,000 benign, 20,000 malware) and a test set (30,000 execution traces: 10,000 benign, 20,000 malware).
- API Count: The training set has approximately 99 involved APIs per trace, and the test set has approximately 101.
- Training Methodology: Five-fold cross-validation is employed for training and validation.
Key Insights and Ideas
- Parameters Matter: The core insight is that API parameters, often overlooked, carry significant security-relevant information that can differentiate malware from benign software, even when the same API calls are used.
- Clustering for Granularity: Discretizing API parameters using clustering (like K-means++) is crucial for creating distinct representations of API behaviors, especially for homonymic API calls. This allows the model to capture finer-grained security semantics.
- TCN-GRU Synergy: Combining TCN for capturing long-range temporal dependencies and GRU for sequential analysis provides a powerful architecture for modeling the complex relationships within API call sequences. This combination effectively addresses the limitations of traditional RNNs in handling long sequences.
- Robustness to Obfuscation: By focusing on parameter variations and dependencies, the method is better equipped to resist obfuscation techniques that might introduce meaningless API calls to confuse detection systems.
Key Results
The proposed method demonstrates superior performance across various metrics:
- Overall Performance: Achieved an accuracy of 98.62% and an F1-score of 98.40% on the test set.
- Comparison with Baselines: Outperformed traditional machine learning models (Naive Bayes, Decision Tree, Logistic Regression, SVM) and deep learning models (TextCNN, RNN, Attention_BILSTM) significantly. For instance, it improved F1-score by over 8% compared to the best machine learning model and over 2% compared to the best deep learning model.
- Ablation Study: The ablation study clearly shows the impact of each component. The F1-score increased from 90.45% (TextCNN with raw API) to 96.04% (TextCNN with augmented API), then to 96.37% (TCN-GRU with raw API), and finally to 98.40% (complete model). This highlights the effectiveness of both parameter encoding and the TCN-GRU architecture.
- Clustering Impact: K-means clustering with K=5 yielded the best performance, achieving an AUC of 0.9985, indicating excellent discrimination between malware and benign samples.
Limitations and Future Work
- Sandbox Reliance: The primary limitation is the reliance on sandbox software for dynamic analysis, which can be time-consuming and a bottleneck for large-scale analysis.
- Computational Overhead: Incorporating API parameter analysis adds computational complexity.
- Future Directions:
- Direct Integration: Embedding the detection approach directly into sandbox software to reduce computational complexity and identify malware during dynamic analysis.
- Broader Applications: Extending the method to other malware classification tasks beyond binary detection, leveraging its ability to model API and parameter behaviors.
- Improved Encoding: Exploring better methods for encoding function parameters and modeling functional dependencies.
Summary updated