Semantic embeddings for program behaviour patterns

Alexander Chistyakov, Ekaterina Lobacheva, Arseny Kuznetsov, Alexey RomanenkoWorkshops @ ICLR 2017

Introduction

This paper introduces a novel feature extraction technique for malware detection that transforms messy program execution logs into structured "behavior graphs." By training an autoencoder on these graphs, the researchers created semantic embeddings that not only improve detection accuracy on a massive real-world dataset but also capture "word2vec-style" logical relationships between system components (e.g., google - chrome + firefox ≈ mozilla).

The Challenge of Malware Detection

Detecting malware is a continuous cat-and-mouse game. Static analysis—examining a file without running it—is often defeated by encryption and obfuscation. Dynamic analysis, which involves watching a program run in a sandbox, is more robust but produces execution logs that are difficult for machines to parse effectively.

Traditional methods treat logs as sequences of events (like n-grams), but these are brittle. If a computer is running multiple processes at once, the log entries get shuffled. Furthermore, malware often uses randomized file names or URLs to evade simple pattern matching. The core challenge is to create a representation of program behavior that is order-independent and can generalize across near-infinite variations of file paths and network addresses.

Methodology: From Logs to Embeddings

The authors propose a three-step pipeline to transform raw logs into actionable features:

  1. Graph Representation: Instead of a sequential list, the log is represented as a bipartite graph. One set of nodes represents event types (e.g., Create, Modify, Delete) and the other represents arguments (e.g., notepad.exe, config.xml). An edge exists if an event acted on a specific argument.
  2. Behavior Pattern Extraction: Events that share the same arguments are grouped into "patterns." To handle the vast variety of arguments, they are tokenized. For example, a file path is broken down into its directory, filename, and extension.
Behavior graph extraction pipeline
  1. Semantic Embeddings: Each extracted pattern is converted into a sparse binary vector. The researchers then train an autoencoder—a neural network that learns to compress this data into a low-dimensional continuous space (the embedding) and then reconstruct it.
  2. Log Aggregation: To represent an entire program's execution, the embeddings of all its patterns are combined using element-wise min, max, and mean functions. This results in a fixed-size feature vector used for classification via XGBoost.

Dataset

The study utilizes a massive, proprietary dataset from Kaspersky Lab, consisting of 4,964,506 malicious logs and 3,145,853 benign logs. Sourced from a mix of in-lab sandboxes and real-world user-managed machines, the data was split 70% for training and 30% for testing. This scale is significantly larger than most academic malware datasets, providing high confidence in the real-world applicability of the results.

Key Insights

  • Structural over Sequential: By moving from sequences to graphs, the model becomes immune to the "noise" caused by multiprocessing or intentional event shuffling by malware.
  • The "Word2Vec" of Malware: Perhaps the most striking discovery is that the embedding space captures semantic logic. Just as King - Man + Woman = Queen in natural language processing, this model found that google - chrome + firefox resulted in mozilla. This proves the model isn't just memorizing strings; it's learning the functional roles of different software components.
  • Generalization through Tokenization: By breaking C:\Windows\system32\malware.exe into tokens like C, Windows, and exe, the model learns that "files in the Windows directory" are a meaningful category, even if the specific filename has never been seen before.

Results

The semantic embeddings (referred to as $f_2$ in the paper) significantly outperformed baseline methods that relied on simple binary indicators or event counters.

ROC curve comparing embedding performance against baselines

As demonstrated in the ROC curves above, the proposed method reduces the number of missed malicious samples (False Negative Rate) by several times compared to baselines, all while maintaining the extremely low false-alarm rate required for commercial antivirus software. Furthermore, the model automatically clustered similar tokens, demonstrating interpretability. For instance, the nearest neighbors for .jpg were .png, .gif, and .xml, showing the model inherently "understands" file type groupings.

Limitations and Future Work

  • Fixed Token Vocabulary: The model relies on the $K$ most frequent tokens observed in the training set. Extremely rare or brand-new tokens might be ignored or handled poorly.
  • Loss of Temporal Context: While graph representation solves the "shuffling" problem, it discards the actual timing of events. In some cases, the specific order of operations (e.g., "read then delete" vs. "delete then read") might be a critical indicator of malicious intent.
  • Computational Overhead: Extracting graphs and running autoencoder inferences for every log is more resource-intensive than simple n-gram counting, which may impact real-time performance in highly constrained environments.

Summary updated

BibTeX
@inproceedings{chistyakov2017semantic,
  author = {Alexander Chistyakov and Ekaterina Lobacheva and Arseny Kuznetsov and Alexey Romanenko},
  title = {{Semantic embeddings for program behaviour patterns}},
  booktitle = {Workshops @ ICLR},
  year = {2017},
}
Figure