Deep learning for malicious flow detection

Yun-Chun Chen, Yu-Jhe Li, Aragorn Tseng, Tsungnan Lin

TL;DR

Researchers have developed a novel deep learning framework to detect malware in network traffic, specifically designed to overcome the "needle in a haystack" problem where benign traffic vastly outnumbers malicious flows. By combining a hierarchical Tree-Shaped Deep Neural Network (TSDNN) with a custom Quantity Dependent Backpropagation (QDBP) algorithm, they achieved 99.63% detection accuracy and demonstrated the ability to identify new, unseen malware families in real-time.

What Problem Does This Paper Address?

In cybersecurity, real-world data is notoriously imbalanced. For every single malicious network flow, there might be thousands of benign ones. When training standard deep learning models on such data, a phenomenon called gradient dilution occurs.

Because the majority class (benign traffic) contributes so much more to the total gradient during training, the model's updates are dominated by it. The minority classes (malware) effectively "fade away," leading to a model that is highly biased toward predicting everything as benign. While such a model might boast high overall accuracy, its precision in actually catching malware is often dismal. The authors set out to build a robust, unbiased model that can learn effectively from these rare but critical minority samples.

Methods

The authors propose a two-pronged solution:

  1. Tree-Shaped Deep Neural Network (TSDNN): Instead of a single flat classifier, the TSDNN uses a hierarchical structure. It breaks the problem down into stages:
  2. Coarse Classification: Separates benign flows from malicious ones.
  3. Multi-class Classification: Categorizes malicious flows into broad attack types (e.g., Bot, Trojan, Ransomware).
  4. Fine-grained Classification: Identifies specific families within a category (e.g., different types of Ransomware).

    Crucially, the model uses feature concatenation: the learned features from one layer are combined with the original input and fed into the next, allowing the network to grow and expand its "knowledge" as classification becomes more specific.

The TSDNN architecture performs classification in three stages, growing dynamically.
  1. Quantity Dependent Backpropagation (QDBP): This is a modified training algorithm. It adjusts the sensitivity of the model by normalizing gradients based on class cardinality (the number of samples in a class). By weighting the updates, QDBP ensures that minority classes have a proportional impact on the model's parameters, preventing them from being "diluted" by the majority class.

Datasets

The authors collected their own dataset of malware traffic from September 2016 to May 2017, using VirusTotal sandboxes to record the first 6 minutes of malicious behavior.

  • Total Flows: 282,007
  • Classes: 12 (Benign + 11 malware types/families).
  • Imbalance Ratio: Extreme. For example, there were 246,015 benign flows compared to just 90 flows for the "Cryptomix" ransomware family.
Table I: Data Statistics showing the severe imbalance between benign and malicious flows.

Key Insights and Ideas

  • Hierarchy Balances Data: By splitting the classification into stages, the authors naturally reduced the disparity between classes at each step. The ratio of majority to minority class was shrunk by nearly 17 times in the hierarchical layers compared to the full dataset.
  • Behavior Over Signatures: The model relies on flow features like inter-arrival times and Markov transition matrices of packet sequences. This behavior-oriented approach is much more resilient than traditional signature-based methods, which fail if a malware's code changes slightly.
  • Real-time Potential: The authors discovered that they don't need to see an entire network flow to identify a threat. Most malicious clues appear very early in the connection.

Key Results

The TSDNN + QDBP approach significantly outperformed standard methods:

  • Accuracy & Precision: The proposed method reached 99.63% accuracy and 85.4% precision. In contrast, a standard DNN with vanilla backpropagation achieved only 59.08% accuracy and a useless 8.33% precision, essentially classifying almost everything as benign.
Comparison of confusion matrices: Vanilla DNN (left) fails to identify malware, while TSDNN (right) shows strong diagonal performance.
  • Partial Flow Detection: The model achieved 95% accuracy by analyzing only the first 5% of a flow (roughly the first 18 seconds). This proves the feasibility of real-time alerting before an attack is complete.
  • Zero-shot Learning: The model was tested on 14 malware families it had never seen during training (including WannaCry). It maintained high recognition rates, demonstrating excellent generalization capabilities.
Zero-shot learning results showing high recognition rates for unseen malware families.

Limitations and Future Work

  • Data Source: The malicious data was collected in a sandbox environment; real-world "in-the-wild" traffic might contain more noise or evasive maneuvers by attackers.
  • Feature Engineering: While the Markov transition matrices are effective, the authors suggest that further refinement of features could improve the precision of fine-grained classification even further.
  • Dynamic Expansion: While the TSDNN grows dynamically, the paper does not detail an automated way to determine when a new "branch" or layer should be added as new malware families emerge.

Summary updated

BibTeX
@inproceedings{chen2017deep,
  author = {Yun-Chun Chen and Yu-Jhe Li and Aragorn Tseng and Tsungnan Lin},
  title = {{Deep learning for malicious flow detection}},
  booktitle = {PIMRC},
  year = {2017},
  doi = {10.1109/pimrc.2017.8292316},
}
Figure