TBDetector: Transformer-Based Detector for Advanced Persistent Threats with Provenance Graph

Nan Wang, Xuezhi Wen, Dalin Zhang, Xibin Zhao, Jiahui Ma, Mengxia Luo, Sen Nie, Shi Wu, Jiqiang LiuarXiv 2023 · DOI

Abstract

Advanced Persistent Threats (APTs) pose a significant challenge to cybersecurity due to their "low-and-slow" nature, often evading traditional detection by blending with normal system activities. TBDetector is a novel framework that leverages Transformer architectures and provenance graphs to identify these threats. By converting system logs into temporal feature sequences and employing a hybrid anomaly scoring mechanism, TBDetector effectively captures long-term dependencies and structural outliers. Evaluation on public datasets demonstrates that TBDetector significantly outperforms state-of-the-art detectors in precision and recall.

Introduction

Advanced Persistent Threats (APTs) are the "ninjas" of the cyber world. Unlike traditional "smash-and-grab" attacks, APTs are highly targeted, well-organized, and operate over months or years. They blend in with normal system activity, making them extremely difficult to detect.

Security researchers have turned to provenance graphs—which map causal relationships between system entities like processes, files, and network sockets—to track these attacks. However, distinguishing between benign and malicious activities within these complex graphs is a significant challenge, as illustrated by the overlap in system behaviors.

Comparison of benign activities and attacker activities within a system provenance graph.

Existing provenance-based detectors face three primary hurdles:

  1. Graph Explosion: Massive system logs lead to computationally unmanageable graphs.
  2. Long-Term Context: Correlating a current event with a suspicious action from weeks ago is difficult for standard models.
  3. Rule Dependency: Reliance on predefined patterns leaves systems vulnerable to zero-day exploits.

Methodology

TBDetector addresses these challenges through a three-stage pipeline designed to extract and analyze long-term contextual features from system logs.

The three-stage TBDetector pipeline: Feature Sequence Extraction, Long-Term Contextual Features Extraction, and Anomaly Detection.

1. Feature Sequence Extraction

System logs are first converted into a Directed Acyclic Graph (DAG). To manage the scale, the HistoSketch algorithm generates a sequence of fixed-length histograms (feature vectors). These vectors represent snapshots of system states over time, effectively compressing the graph data while preserving essential structural information.

2. Long-Term Contextual Feature Extraction

The core of TBDetector is a Transformer-based encoder-decoder model. Unlike Recurrent Neural Networks (RNNs), the Transformer’s self-attention mechanism allows it to weigh the importance of different past states simultaneously. This capability is crucial for identifying the long-term dependencies characteristic of the "low-and-slow" APT attack cycle.

3. Anomaly Detection

The model is trained exclusively on "normal" system behavior. To identify attacks, it calculates a hybrid Anomaly Score based on two complementary factors:

  • Similarity Score: Measures how close a state is to known "normal" clusters using K-means.
  • Isolation Score: Uses an Isolation Forest to identify structural outliers that are easily separated from the bulk of the data.

Evaluation and Results

TBDetector was evaluated on five public datasets, including StreamSpot, DARPA TC (ClearScope & CADETS), and the SC Dataset.

The framework consistently outperformed leading methods such as UNICORN, SeqNet, and StreamSpot. On the shellshock dataset, TBDetector achieved a Precision-Recall (PR) area of 0.9575, representing a 75.43% improvement over UNICORN. Furthermore, on the cadets dataset, the model maintained a perfect 1.0 PR area even when trained on only 10% of the available data, demonstrating exceptional data efficiency and adaptability to lengthy attack cycles.

Conclusion

By prioritizing temporal sequences over static structural analysis, TBDetector provides a robust solution for APT detection. The combination of Transformer-based reconstruction and hybrid anomaly scoring allows the system to learn the "rhythm" of a healthy environment and accurately flag deviations. Future work will focus on automating hyperparameter tuning and optimizing the pipeline for real-time monitoring in large-scale enterprise deployments.

Summary updated

BibTeX
@misc{wang2023tbdetector,
  author = {Nan Wang and Xuezhi Wen and Dalin Zhang and Xibin Zhao and Jiahui Ma and Mengxia Luo and Sen Nie and Shi Wu and Jiqiang Liu},
  title = {{TBDetector: Transformer-Based Detector for Advanced Persistent Threats with Provenance Graph}},
  year = {2023},
  eprint = {2304.02838},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.02838},
}
Figure