Zero Day Threat Detection Using Metric Learning Autoencoders

Dhruv Nandakumar, Robert Schiller, Christopher Redino, Kevin Choi, Abdul Rahman, Edward Bowen, Marc Vucovich, Joe Nehila, Matthew Weeks, Aaron ShahaarXiv 2022

TL;DR

This paper introduces a dual-autoencoder framework enhanced by metric learning to detect zero-day threats (ZDTs) in network traffic. By using triplet loss to organize the model's latent space into distinct clusters of known attacks, the authors achieve superior detection performance and provide "Closest Attack Type Attribution" (CATA) to help human threat hunters interpret why an alert was triggered.

What Problem Does This Paper Address?

Detecting Zero-Day Threats—malicious activities using novel tactics, techniques, and procedures (TTPs)—is a cat-and-mouse game where the "cats" (security systems) are often one step behind. Traditional signature-based detection is useless against never-before-seen attacks. While standard machine learning anomaly detectors can flag "weird" behavior, they struggle with two major issues:

  1. Generalization: They often fail when moved to new network topologies.
  2. Ambiguity: They cannot distinguish between a known malicious anomaly and a truly novel ZDT, nor can they explain what an anomaly looks like.

The authors aim to build a system that not only flags ZDTs with high precision but also provides context to reduce the "alert fatigue" suffered by security operators.

Methods

The authors employ a two-stage pipeline, building on previous work that used asset-level graph features to represent host roles (e.g., whether a host acts as a server or a workstation).

Fig. 1: High-Level Architecture [15]
  1. Anomaly Detector (AD): An autoencoder trained exclusively on benign traffic. It acts as a first-pass filter; any flow with a high reconstruction error is flagged as "anomalous."
  2. Novelty Detector (ND): This is the core innovation. The ND is trained only on known malicious data. Unlike a standard autoencoder that just minimizes reconstruction error (MSE), this model uses Metric Learning via a triplet loss function.
Fig. 2: Novelty Detector Triplet Training Architecture

The triplet loss forces the encoder to map similar attack types close together in the latent space while pushing different attack types far apart. During inference, if an anomalous flow (from the AD) falls far from all known attack clusters in the ND's latent space, it is classified as a ZDT.

Datasets

The study utilizes a robust mix of public and proprietary datasets to ensure the model generalizes across different network environments:

  • Public: MAWI Archive (real Japanese university traffic), NCCDC (blue/red team simulations), ISOT Botnet, and ISCX IDS.
  • Proprietary: Organizational Internal Flow (OIF) and the "Codex" Malware Lab dataset (100 million+ flows from malware detonations).

Notably, the authors held out specific attack classes (like botnets) during training to simulate ZDTs during evaluation.

Key Insights and Ideas

  • Organizing the Chaos: Without metric learning, the latent space of an autoencoder is often chaotic, with different attack types overlapping. Metric learning creates a "structured" latent space. As shown in the UMAP visualizations, the metric-learned model (right) creates tight clusters, making it much easier to spot a ZDT that doesn't fit in.
Fig. 4: Characteristic UMAP representations of the latent space for the model trained with only reconstruction loss (left) and the model trained with metric learning (right). Botnet attacks were treated as ZDTs and held out during training. Note that we only included the four attack classes found in NCCDC to allow for easier viewing.
  • CATA (Closest Attack Type Attribution): By using a k-Nearest Neighbors (kNN) approach in the organized latent space, the model can tell an operator: "This is a ZDT, but it looks 30% like a Botnet and 20% like Interrogation." This provides a starting point for investigation.
  • Feature Abstraction: By using graph-based features rather than raw IP addresses, the model learns the behavioral role of a device, allowing it to generalize to entirely new networks without retraining.

Key Results

The addition of metric learning provided a measurable boost over the previous dual-autoencoder baseline:

  • Performance: Average precision improved from 0.82 to 0.85, and recall jumped from 0.65 to 0.71. While these gains seem modest, the authors note that in petabyte-scale enterprise environments, a 7% improvement in recall represents a massive number of previously undetected severe threats.
  • Stability: The kNN classification accuracy in the latent space remained high (around 0.93) even as the number of neighbors (k) increased, proving that the clusters formed by metric learning are robust and well-separated.
kNN classification performance over varying k

Limitations and Future Work

The authors identify a few hurdles for real-world deployment:

  • Latent Space Collapse: During training, the latent space can sometimes "collapse" into a smaller dimension, losing critical information. This requires careful monitoring and potentially exploring alternative loss functions like softmax-based metric learning.
  • Data Diversity: While they used diverse datasets, the real world contains even more attack variety. They suggest that "cyber terrain mapping"—providing models with more context about the risk level of specific assets—could further reduce false positives.
  • Future Directions: The team is looking into federated learning to allow models to learn from multiple organizations' data without compromising privacy, as well as few-shot learning to identify new threats with very few examples.

Summary updated

BibTeX
@misc{nandakumar2022zero,
  author = {Dhruv Nandakumar and Robert Schiller and Christopher Redino and Kevin Choi and Abdul Rahman and Edward Bowen and Marc Vucovich and Joe Nehila and Matthew Weeks and Aaron Shaha},
  title = {{Zero Day Threat Detection Using Metric Learning Autoencoders}},
  year = {2022},
  eprint = {2211.00441},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.00441},
}
Figure