A Stream-based Query System for Efficiently Detecting Abnormal System Behaviors for Enterprise Security

Peng Gao, Xusheng Xiao, Ding Li, Zhichun Li, Kangkook Jee, Zhenyu Wu, Chung Hwan Kim, Sanjeev R. Kulkarni, Prateek Mittal

Abstract

The need for countering Advanced Persistent Threat (APT) attacks has led to solutions that ubiquitously monitor system activities in each enterprise host and perform timely abnormal system behavior detection over the stream of monitoring data. However, existing stream-based solutions lack explicit language constructs for expressing anomaly models that capture abnormal system behaviors, thus facing challenges in incorporating expert knowledge to perform timely anomaly detection over large-scale monitoring data. To address these limitations, we build SAQL, a novel stream-based query system that takes as input a real-time event feed aggregated from multiple hosts in an enterprise and provides an anomaly query engine that identifies abnormal behaviors based on specified anomaly models. SAQL provides a domain-specific query language that uniquely integrates critical primitives for expressing major types of anomaly models. In this work, we demonstrate the complete usage scenario of SAQL by performing an APT attack in a controlled environment and using SAQL to detect the abnormal behaviors in real time.

Introduction

Modern enterprise security relies on "ubiquitous monitoring," where every system call, file access, and network connection is logged. While this provides a wealth of data, it creates two massive hurdles. First, there is an "Expert Knowledge" gap: advanced attacks are multi-stage and stealthy, yet existing tools lack the specialized language constructs needed to easily describe complex security behaviors. Second, there is a "Big Data" bottleneck: a 100-host enterprise can generate 50GB of logs daily, making real-time processing computationally expensive, especially when multiple analysts run concurrent queries.

SAQL (Stream-based Anomaly Query Language) is designed to help security analysts find "needles in a haystack" by querying massive streams of enterprise system monitoring data in real-time to detect Advanced Persistent Threats (APTs).

System Architecture and Methods

SAQL is a novel stream-based query system that allows security experts to express complex anomaly models using a unified domain-specific language. The system architecture is designed to handle high-velocity event streams while providing flexible querying capabilities.

Figure 1: The SAQL System architecture, illustrating the flow from system events and analyst queries through the Parser and Execution Engine to anomaly detection.

The SAQL Language

Built using ANTLR 4, the language provides explicit syntax for four major anomaly types:

  • Rule-based: Matching specific sequences of events (e.g., a shell starting a database utility).
  • Time-series: Using sliding windows and stateful variables to detect spikes or drops in activity.
  • Invariant-based: Learning "normal" behavior (like the set of child processes an Apache server usually spawns) and flagging deviations.
  • Outlier-based: Using algorithms like DBSCAN to find "odd one out" behaviors among peers.

The Execution Engine

Built on top of the Siddhi Complex Event Processing (CEP) engine, SAQL introduces a master-dependent query scheme. This optimization groups semantically similar queries together so they can share a single copy of the data stream, drastically reducing memory and CPU overhead. The system uses a Subject-Verb-Object (SVO) model to represent events (e.g., Process A writes File B), simplifying how analysts reason about system interactions.

Evaluation and Attack Simulation

The system was evaluated in a real-world environment at NEC Labs America, involving 150 hosts across Linux, Windows, and MacOS. To test the system's efficacy, the authors performed a controlled 5-step APT attack.

Figure 2: A multi-stage APT attack scenario used to evaluate SAQL, involving initial compromise, lateral movement, and data exfiltration.

As shown in the attack scenario, the simulation involved:

  1. Initial Compromise: An attacker sends a malicious email to a Mail Server.
  2. Malware Infection: A Windows Client downloads a malicious file (c1) and executes it (c2).
  3. Privilege Escalation: The attacker interacts with the Windows Domain Controller (c3).
  4. Database Penetration: The attacker accesses the DB Server (c4).
  5. Data Exfiltration: Sensitive data is sent back through the firewall to the attacker (c5).

Key Insights and Results

SAQL successfully demonstrated full lifecycle detection, identifying all five stages of the sophisticated APT attack in real-time. By leveraging the master-dependent query scheduler, the system handled high-velocity streams (~50GB/day per 100 hosts) without the performance hit typically associated with concurrent complex queries.

A core innovation of SAQL is the use of Unified Primitives. Most security anomalies can be boiled down to a few mathematical primitives (patterns, stateful windows, and peer comparisons). By integrating these into one language, SAQL replaces a fragmented toolkit with a single, context-aware interface. Furthermore, the use of Stateful Sliding Windows allows analysts to define "normal" over varying timeframes and detect shifts instantly.

Conclusion

SAQL provides a powerful and efficient framework for real-time anomaly detection in enterprise environments. By bridging the gap between expert knowledge and big data processing, it enables security analysts to define and detect complex attack patterns as they occur. Future work may involve expanding the data scope to include application-level logs and cloud-native telemetry to provide even broader visibility across the enterprise stack.

Summary updated

BibTeX
@inproceedings{gao2020stream,
  author = {Peng Gao and Xusheng Xiao and Ding Li and Zhichun Li and Kangkook Jee and Zhenyu Wu and Chung Hwan Kim and Sanjeev R. Kulkarni and Prateek Mittal},
  title = {{A Stream-based Query System for Efficiently Detecting Abnormal System Behaviors for Enterprise Security}},
  booktitle = {ICDE},
  year = {2020},
  doi = {10.1109/icde48307.2020.00167},
}
Figure