AIQL: Enabling Efficient Attack Investigation from System Monitoring Data

Peng Gao, Xusheng Xiao, Zhichun Li, Fengyuan Xu, Sanjeev R. Kulkarni, Prateek Mittal

TL;DR

AIQL is a domain-specific query system designed to make attack investigation over enterprise system monitoring logs orders of magnitude faster and easier to write. By pairing an expressive security query language with domain-aware query scheduling and spatio-temporal database partitioning, AIQL speeds up attack investigation queries by 124× over PostgreSQL and 157× over Neo4j, while cutting query specification complexity by more than half.

What Problem Does This Paper Address?

Investigating Advanced Persistent Threats (APTs) requires security analysts to trace suspicious activities backwards and forwards across enterprise systems using audit logs (e.g., Linux auditd, Windows ETW). However, existing investigation workflows face two main bottlenecks:

  1. Expressiveness: Standard tools (SQL, Neo4j’s Cypher, Splunk SPL) lack concise syntax for common attack patterns—such as multi-step causal dependencies across hosts, temporal ordering constraints, and sliding-window anomaly checks—forcing analysts to write verbose, join-heavy queries.
  2. Performance: System monitoring generates massive volumes of data (tens of gigabytes daily per 100 hosts). Because off-the-shelf relational and graph database optimizers are unaware of the spatio-temporal structure of system audit data, complex multi-step queries often take hours to execute, crippling the interactive, iterative workflow required for incident response.

Methods

The authors introduce AIQL (Attack Investigation Query Language) and a supporting execution engine built on top of relational databases (PostgreSQL and Greenplum):

  • Domain-Specific Language (AIQL): Uses a {subject-operation-object} event syntax (e.g., proc p read file f) with dedicated primitives for:
  • Multi-event correlation: Expressing temporal (before, after, within) and attribute relationships between events without explicit boilerplate joins.
  • Dependency tracking: Compact forward: and backward: graph traversal syntax to trace causality across processes and network boundaries.
  • Anomaly detection: Sliding time windows and built-in moving averages (SMA, EWMA) comparing current behaviors against historical states.
  • Context-aware shortcuts: Automatic inference of common security attributes (e.g., resolving process identifiers to executable names or files to file paths) and entity ID reuse.
  • Spatio-Temporal Data Partitioning: Stores events in daily database instances partitioned by agent/host groups, with dedicated indexing on high-frequency query attributes (process executable name, file path, IP).
  • Relationship-Based Query Scheduling: Instead of generating one massive multi-table SQL join, AIQL synthesizes individual queries per event pattern and schedules them using domain heuristics:
  • Calculates a pruning score based on constraints.
  • Prioritizes high-pruning events (process and network events ahead of noisy file events).
  • Uses the results of high-pruning queries to narrow the search scope of dependent queries before final joining.
  • Partitions long query time windows across days to parallelize execution.

Datasets

The authors deployed AIQL across 150 enterprise hosts (10 servers, 140 workstations) at NEC Laboratories America:

  • Enterprise Monitoring Logs: 857 GB of real system monitoring data collected over 16 days, comprising 2.5 billion events.
  • APT Attack Scenarios: Evaluated on an end-to-end APT case study orchestrated by white-hat hackers involving a 5-step kill chain (phishing email, backdoor execution, credential cracking via gsecdump, database penetration, and data exfiltration via osql.exe). A second APT attack was used for broader performance evaluation.
  • Malware Samples: 5 real-world malware samples from VirusSign representing common threat families (Autorun, Sysbot, Hooker).

Key Insights and Ideas

  • Attack investigation is inherently iterative: Analysts rarely issue a single monolithic query; they issue an initial probe, identify an artifact (e.g., a suspicious .dmp file), and expand the query incrementally. If individual query iterations take 30–60 minutes, investigations stall.
  • Domain heuristics beat generic database cost models: Relational optimizers frequently fail on deep multi-way joins across billions of time-series log rows. Simply scheduling process/network queries before file queries and feeding early candidate IDs into subsequent queries avoids massive full-table cross-joins.
  • Syntactic shortcuts drastically reduce cognitive load: Security analysts spend most of their effort manually writing joining conditions on PIDs and timestamps. Baking entity linkage and temporal sequencing directly into language grammar reduces human error and query verbosity.

Key Results

  • End-to-End Investigation Speed: Investigating the 5-step APT attack required 27 queries touching 119 GB / 422 million events:
  • AIQL: ~2.8 minutes total execution time (all queries completed in under 15 seconds).
  • PostgreSQL: ~5.9 hours (a 124× speedup for AIQL).
  • Neo4j: ~7.5 hours (a 157× speedup for AIQL).
  • Scheduler Effectiveness: Isolating the relationship-based query scheduler from data partitioning optimizations demonstrated a 40× speedup over PostgreSQL’s native query planner and a 16× speedup over parallelized Greenplum query execution.
  • Query Conciseness: Across 19 attack investigation queries, equivalent queries in SQL, Cypher, and Splunk SPL required at least 2.4× more constraints, 3.1× more words, and 4.7× more characters than AIQL.

Limitations and Future Work

  • Static Pruning Heuristics: The scheduler estimates pruning power using raw constraint counts rather than an adaptive, data-driven statistical model of attribute selectivity across hosts.
  • Uniform Time Splitting: Temporal sub-queries are split naively by day rather than dynamically balanced based on event volume.
  • System Entity Scope: Current modeling covers files, processes, and network sockets; it omits other operating system entities such as Windows registry entries or Linux named pipes.
  • Log Volume Scaling: The authors note that scaling to years of enterprise data will require pairing AIQL with aggressive audit log reduction techniques (e.g., execution partitioning or causality-preserving garbage collection).

Summary updated

BibTeX
@inproceedings{gao2018aiql,
  author = {Peng Gao and Xusheng Xiao and Zhichun Li and Fengyuan Xu and Sanjeev R. Kulkarni and Prateek Mittal},
  title = {{AIQL: Enabling Efficient Attack Investigation from System Monitoring Data}},
  booktitle = {USENIX ATC},
  year = {2018},
  url = {https://openreview.net/forum?id=KU3wcx8QnV},
}
Figure