← All posts

Catching Cloud-Native Cyber Attacks with Graphs in Real Time

A container that starts mining cryptocurrency looks, from the outside, much like a container doing its job: it runs processes, opens files and talks to the network. What gives the attack away is the shape of that activity: which process started which, what it touched, and in what order. At Cisco I worked on detecting attacks in cloud-native applications by turning system activity into graphs and classifying the graphs. That code became the basis of an ICDE 2025 paper with Tailai Song, whom I supervised during a PhD internship at Cisco, and colleagues from Cisco and Politecnico di Torino. A related patent application, with Lennart Gulikers and me as co-inventors, covers the real-time side.

This post walks through the whole system: why containers are hard to defend, how system calls become graphs, the features and embeddings we built, how they compared with eight deep learning models, what the evaluation does and does not prove, and how the pieces run in real time.

In short

  • Attacks on containers unfold in stages and leave traces in system activity. Written as triplets such as process → read → file, that activity forms one graph per time window, and attacks show up as shapes.
  • We turned each 500 ms graph into 2,895 hand-built features at five levels, kept 82, and trained XGBoost. Against eight deep models it tied for the best macro recall (0.57) and was the only one above 0.5 recall on ransomware; the best graph neural networks had higher precision and F1.
  • With one attack type withheld from training, at most 41 per cent of its graphs were called benign; the rest were still flagged as some attack.
  • The dataset is small and emulated, and the splits were random over windows, so treat the numbers as a direction. Grouping splits by attack run is the first thing I would change.
  • Real time needs more than a fast model: compact telemetry, short windows, separate training and serving, and a check that predictions stay stable across consecutive windows.

Why cloud-native attacks are hard to see

A cloud-native application runs as containers that Kubernetes starts, moves and stops all day. That is good for scaling and bad for the defender. Containers share the host kernel, so a container escape can reach everything on the node. Images ship with vulnerable packages. A misconfigured cluster lets an attacker who reaches one pod deploy new ones. Signatures of known malware catch little of this, because attackers mostly use tools already in the image: bash, curl, nc, kubectl.

The defender's advantage is that attacks take time. MITRE ATT&CK organises them into tactics, from initial access through discovery to impact, and keeps a matrix of techniques seen against containers. Each stage leaves traces in system calls, files and connections. We emulated four attacks against OWASP Juice Shop, an intentionally vulnerable web shop, running in Kubernetes. All four begin the same way, which is part of what makes them hard to tell apart:

StageWhat the attacker didClosest ATT&CK technique
Initial accessExploit a Juice Shop vulnerabilityT1190 Exploit Public-Facing Application
Discoveryenv, pwd, netstat, find, lsT1083 File and Directory Discovery, and related
Privilege escalation (some runs)Deploy pods with kubectl and continue inside themT1610 Deploy Container
Impact: crypto-jackingDownload and run a miner such as XMRigT1496 Resource Hijacking
Impact: data destructionDelete dataT1485 Data Destruction
Impact: data exfiltrationCompress data and send it out, for example with ncT1048 Exfiltration Over Alternative Protocol
Impact: ransomwareEncrypt dataT1486 Data Encrypted for Impact

Initial access, container deployment, resource hijacking and data destruction appear in ATT&CK's containers matrix; the discovery, exfiltration and encryption techniques come from the wider Enterprise matrix. Steps and targeted data varied between runs, so a model could not memorise one script. Automated browsing produced ordinary shop traffic as benign background, the "noise" class in the paper.

Four ways to catch an attack

Security teams already have three families of tools, and each fails in a known way. Supervised graph classification is a fourth, with failures of its own:

ApproachHow it decidesWhere it breaks
Rules and signaturesMatch known patterns, such as a Falco rule for a shell in a containerMisses new techniques and floods analysts with duplicate alerts
Anomaly detectionFlag what differs from normal behaviourUnusual is not malicious, and normal behaviour drifts between training and use
Threat huntingAn analyst writes and refines queries over recorded activityFlexible but manual, and too slow for a decision every second
Supervised graph classificationLearn the shapes of known attacks from labelled examplesNeeds labelled attacks, and is only as good as their variety

The anomaly row comes with evidence. Writing about a DARPA detection competition in 2017, IBM researchers reported that anomaly detection "mechanisms were limited due to the lack of training data and the variance of user behaviors between training and detection periods". Supervised learning answers that by emulating attacks to get labels, which is why our dataset, and its limits, matter so much later on.

From system calls to graphs

Raw system calls are too many to store or analyse: on a MySQL benchmark, IBM Research counted 156 million system call records. SysFlow, an open telemetry format whose collector is built on Falco's libraries, describes itself as "NetFlow for system events". It folds many calls into one flow record: a process, what it touched, how much it read or wrote, and when. The same MySQL workload produced 189 SysFlow records. Falco, a CNCF graduated project, applies rules to the same kernel events and raises alerts with context such as the container. SysFlow can also tag records with ATT&CK techniques: on a Kubernetes cluster with 12 worker nodes, over 100 minutes, its rate modulation cut such alerts from 108,546 to 2,853, which matters to anyone who has to read them.

A web server process downloads a file from an external address, writes it to /tmp, clones a Python process which reads a customer database and connects twice to a command-and-control address process: web server process: python /tmp/x.py 198.51.100.7:2345 network flow write /tmp/x.py file flow clone, exec read customers.db file 203.0.113.9:4444 network 203.0.113.9:4444 network Invented example. Each mark is one SysFlow record that summarises many system calls; each becomes one triplet.
Figure 1. An invented exfiltration traced the SysFlow way, with process, file and network flows on two process timelines.

Each record is a relation between two system objects, so we wrote it as a triplet, from_node → relation → to_node, with a timestamp. Nodes are one of 10 types, such as process, file and path. Edges are one of 17 relation types, such as create, open and update. Because SysFlow follows a process from start to exit, the object at the end of one triplet starts the next, and the triplets link into a graph. We cut each activity into consecutive 500 ms windows and built one directed graph per window, with 91 triplets on average. Every window inherits the label of the activity it came from.

A small graph: a network flow executes a process, which writes a file that belongs to a container and launches an xmrig process, which connects to the network and runs in the container network flow process file /tmp/x container process: xmrig network flow executes writes belongs to launches connects runs in Illustrative: each edge is one triplet, from_node → relation → to_node, with a timestamp.
Figure 2. One window as a graph. Every edge is one triplet.

Windows bring two benefits. A detector can answer every half second instead of waiting for an attack to finish, and graphs stay small enough to keep features cheap. The cost is the labelling assumption: a window from an attack run may contain only ordinary-looking steps and still carry the attack label.

Graphs as patterns of attack

Treating security data as a graph is an old and productive idea. Threat Intelligence Computing, from IBM Research at CCS 2018, modelled a system's whole history as a computation graph of entities and events. In that view, threat discovery "reduces to the graph query problem of iteratively computing the closure over the subset of security-relevant subgraphs". Hunters wrote patterns as graph queries; one example flags a data leak when "an entity labeled with SENSITIVE connects to an entity labeled NETFLOW within 10 hops". In the DARPA competition, a detector of a few lines flagged 17 DLL injections across two weeks of data, before any benign ones were whitelisted; the red team credited three as part of its attack.

A pattern like that is knowledge, and knowledge graphs are how security teams store it. Two kinds meet in a detector:

AspectKnowledge about threatsKnowledge about your system
ExamplesActors, malware, vulnerabilities, ATT&CK techniquesProcesses, files, sockets, pods and how they interacted
Built fromReports and advisories, often by text extractionTelemetry such as SysFlow, Falco and OCSF events
ChangesOver days and weeksEvery second
AnswersWhat to look forWhere to look, and whether it happened

Both use the same unit, the triplet of head, relation and tail, and both can be embedded. Knowledge graph embeddings learn vectors so that head plus relation lands near the tail, which TransE writes as h + r ≈ t; they are built to complete missing facts. Our task was different: label a whole small graph as benign or one of four attacks. That is graph classification, and it leaves two routes: hand-built features fed to a classic model, or a graph neural network (GNN) that learns its own features. We used both, in two stages.

Building the dataset

For the paper we recorded several runs of each attack type, with varied steps and targets, alongside separate benign runs. The result is small and imbalanced, as attack data usually is:

Benign 175 graphs from 12,253 triplets, crypto-jacking 70 from 3,480, data destruction 102 from 14,631, data exfiltration 69 from 7,956, ransomware 22 from 1,343 Graphs per class, 500 ms windows Benign 175 graphs, 12,253 triplets Crypto-jacking 70 graphs, 3,480 triplets Data destruction 102 graphs, 14,631 triplets Data exfiltration 69 graphs, 7,956 triplets Ransomware 22 graphs, 1,343 triplets
Figure 3. 438 graphs in total, with ransomware the rarest class.

In production, attacks never arrive alone: they run inside a busy cluster. The patent application describes how to train for that. An orchestrator deploys the application, a workload generator drives it, and a threat injector replays a list of attack steps, each tagged with its technique ID, with and without background load. Recorded background activity is then split into small "building blocks" and mixed into attack graphs, either inserted or replacing existing facts. Entity names are relabelled to avoid collisions, timestamps are reset, and the connecting facts are sampled from how often each relation appears in real data, because not every fact is plausible: the patent's example is that "process-findings-process" may be valid, but "file-parent_of-cluster" may not.

Attack runs injected into a test cluster and background runs split into building blocks feed an insert-or-replace step that relabels entities, fixes timestamps and samples valid facts, producing pure attack, attack plus noise and pure background examples Attack runs injected into a test cluster Background runs workload only Building blocks small background subgraphs Insert or replace relabel, fix timestamps, sample valid facts Pure attack Attack + noise Pure background Training mixes the same attack with background recorded at different times, in varying proportions.
Figure 4. Mixing recorded attacks with recorded background, as described in the patent application.

The training set then holds three kinds of example: pure attack, attack mixed with background in varying proportions, and pure background. The modelling assumption is stated plainly: an attack "can, in principle, be 'mixed' with any kind of background activity that has ever been recorded". Mixing multiplies scarce attack data cheaply and teaches the model that the attack, not the noise around it, is the signal.

Feature engineering in five levels

We started with hand-built features for four reasons, set out in the paper. Deep models are costly to retrain, and attack data changes often. Inference must be fast enough to act on. Analysts need to see why a window was flagged. And a classic model deploys with standard MLOps tools: XGBoost runs on KServe without a custom container.

Five feature levels, node, edge, triplet, graph and subgraph, feed 2,895 features, of which 82 are kept after dropping constant, low-variance and correlated ones Node types, degrees, centrality, clustering, keywords Edge 17 relation types, keywords Triplet source, relation, target combinations Graph Laplacian spectrum: eigenvalues, energy, rank Subgraph split at the cluster node: sizes, type frequencies 2,895 features 82 kept constant, low-variance and correlated features dropped
Figure 5. The feature levels, from single nodes to the whole graph.
  • Node level. Count and share of each node type as source, target and overall; degrees, centrality and clustering per type; and keywords attackers leave in node descriptions: bash, xmrig, busybox, tmp. A process creating a directory under /tmp is rare in a web shop.
  • Edge level. Count and share of each of the 17 relation types, and relation types next to keyword nodes.
  • Triplet level. Counts of each combination of source type, relation and target type. Attackers follow steps that benign traffic rarely repeats, so specific triplets are strong evidence.
  • Graph level. Ten features from the spectrum of the graph Laplacian: largest eigenvalue, sum, mean and variance of eigenvalues, spectral gap and radius, graph energy, Laplacian energy, rank and nullity.
  • Subgraph level. Processes in a window hang off a shared cluster node. Splitting there gives separate process subgraphs, whose sizes and type frequencies we summarise.

That gave 2,895 features per graph. Dropping constant, low-variance and highly correlated ones left 82, and only those 82 need computing in production. The spectral features are less exotic than they sound:

import networkx as nx
import numpy as np


def window_graph(triplets):
    """One directed graph per time window: nodes are system objects, edges are relations."""
    g = nx.MultiDiGraph()
    for src, rel, dst in triplets:
        g.add_edge(src, dst, relation=rel)
    return g


def spectral_features(g):
    """Laplacian spectrum of the undirected skeleton: shape, not names."""
    u = nx.Graph(g.to_undirected())
    lam = np.sort(np.linalg.eigvalsh(nx.laplacian_matrix(u).toarray().astype(float)))
    avg_degree = 2 * u.number_of_edges() / u.number_of_nodes()
    return {
        "largest_eigenvalue": lam[-1],
        "spectral_gap": lam[1] - lam[0],            # 0 if the graph is disconnected
        "laplacian_energy": np.abs(lam - avg_degree).sum(),
        "rank": int((lam > 1e-9).sum()),
        "nullity": int((lam <= 1e-9).sum()),         # number of connected components
    }


window = [
    ("process:web", "connect", "net:198.51.100.7"),
    ("process:web", "write", "file:/tmp/x.py"),
    ("process:web", "clone", "process:python"),
    ("process:python", "read", "file:customers.db"),
    ("process:python", "connect", "net:203.0.113.9"),
    ("process:python", "runs_in", "container:shop"),
]
for name, value in spectral_features(window_graph(window)).items():
    print(f"{name:20s} {value:.3f}" if isinstance(value, float) else f"{name:20s} {value}")

Run on two invented windows of the same size, the spectrum separates what simple counts cannot:

Left, a benign window shaped as a star around one web process; right, an attack window where the web process clones a child process that does the rest of the work. Both have 7 nodes and 6 edges; largest eigenvalue 7.00 against 5.26, spectral gap 1.00 against 0.40, Laplacian energy 10.57 against 10.35 Benign window: one busy process Attack window: work handed to a child clone Nodes, edges 7, 6 7, 6 Largest eigenvalue 7.00 5.26 Spectral gap 1.00 0.40 Laplacian energy 10.57 10.35
Figure 6. Same size, different shape. Values computed with the code above.

The benign window is a star: one process does everything, and its largest eigenvalue equals the number of nodes. The attack window hands work to a child process through a single clone edge. The spectral gap, which measures how well a graph holds together, drops from 1.00 to 0.40 because that edge is a bottleneck. Real windows are larger and messier, but the intuition holds: the spectrum summarises how activity is organised, not just how much of it there is.

The second stage: graph embeddings

Hand-built features see what we thought to count. The pipeline in the patent application adds a learnt view: a graph embedding network, trained in PyTorch, maps each window's graph to one point in Euclidean space. Its encoder and propagation layers compute vectors for nodes and edges, and an aggregator combines them into "a single point in Euclidean space". Those coordinates become topology features next to the hand-built graph features, and XGBoost does the classification. The model "may make the predictions based in part on how close the points are to those associated with a known attack type".

Kubernetes telemetry goes through SysFlow and Falco into per-window graphs, which feed both hand-built graph features and a learnt graph embedding; both go into XGBoost Kubernetes system calls, containers, pods SysFlow, Falco flows, events, rule tags Graphs triplets in one time window Graph features counts, spectra Graph embedding PyTorch, learnt XGBoost one label per window Stage 1 turns each graph into numbers; stage 2 classifies them. The paper evaluates the feature route alone.
Figure 7. The two-stage design: two views of each graph, one classifier.

Why embed whole graphs rather than entities? Entity-level embeddings, the kind TransE produces, suit entity tasks such as clustering files or spotting an odd process. The patent lists why they are awkward for whole graphs: they are "not necessarily unique", their total dimension "grows with the graph size", and graphs of different sizes end up with vectors of different sizes. A graph-level embedding has a fixed size, so windows of any size can be compared. The patent describes three ways to get one:

MethodIdeaTrade-off
Graph embedding networkPropagate along edges, aggregate into one vector, train on pairs of similar and dissimilar graphsLearns what matters for the task; needs training and retraining
Random graph neural featuresAverage many randomly parameterised, permutation-invariant functions of the graph; their expected squared difference is a metric between graphsNo training, but blind to the task, so class boundaries can be complex
Wasserstein embeddingCompare a graph's entity embeddings with a reference distribution through approximate optimal transportFixed size whatever the graph; the patent calls it less natural for these tasks

We used the first. It is trained on pairs, the Siamese set-up from Li et al. (2019): two graphs pass through the same network with shared weights, and the loss pulls same-class graphs together and pushes different-class graphs apart. Li et al. also propose graph matching networks, which compare two graphs jointly with cross-graph attention and scored higher in their experiments. The patent sets them aside for a practical reason: matching models "cannot directly be used to embed a single graph". At inference time there is one new window and no partner to match it with.

Two small graphs pass through the same encoder with shared weights into vectors, and the distance between the vectors is small for the same class and large otherwise graph Gᵢ graph Gⱼ Encoder, propagate, aggregate Same network, same weights shared vector f(Gᵢ) vector f(Gⱼ) d = ‖f(Gᵢ) − f(Gⱼ)‖ small if same class, large if not Each graph is embedded on its own, so a new window needs one forward pass, not a comparison with every stored graph.
Figure 8. Siamese training of a graph embedding network.

The two views meet in one table. Entity-level features describe each node of a window: its type, its keywords, whether a sensitive path or a miner name appears. Graph-level features are re-engineered from them as the presence and normalised frequency of each entity feature in the window, plus combinations that matter together, such as a path node and a miner keyword in the same window. The embedding adds a few coordinates. XGBoost reads the combined row and returns a probability per class.

A table of entity features with rows grouped by graph G1 to G4 is aggregated into one row per graph, two embedding columns are added, and XGBoost outputs probabilities such as 0.87 malicious and 0.03 benign Entity features x1 x2 x3 x4 1 0 0 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 G1 G1 G1 G2 G2 G3 G4 per graph Graph features + embedding x1g x2g x3g x4g e1 e2 1.0 0.7 0.0 1.0 0.5 0.2 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.0 0.0 1.0 0.5 1.0 1.0 0.0 1.0 1.0 1.0 1.2 G1 G2 G3 G4 re-engineered from GNN XGBoost G1: 0.87 malicious G2: 0.23 benign G3: 0.45 suspicious G4: 0.03 benign Invented values. Rows of entity features collapse to one row per graph; embedding coordinates join as extra columns.
Figure 9. From entity features to one row per window.

The split of work is deliberate. The network learns shape, the trees learn decisions and explain them through feature importance and SHAP values, and each half retrains on its own schedule.

Results against eight deep models

The paper tests the feature route alone, so its numbers isolate what feature engineering buys. Every model saw the same graphs with the same information: one-hot node types, and edge features for relation type, endpoint types and keywords. The deep models were four message-passing GNNs (GAT, GEN, GINE, UniMP), the Graphormer transformer, a graph matching network, FLASH, a GNN built for intrusion detection, and ECAL, built for imbalanced graph classification. We ran five trials with stratified 80/20 splits, weighted classes against the imbalance, and tuned XGBoost with Bayesian optimisation. The spectral baseline is XGBoost trained on the ten spectral features alone.

ModelMacro recallMacro precisionMacro F1Ransomware recall
XGBoost on features0.570.540.520.55
GEN0.570.680.570.25
UniMP0.550.690.560.25
FLASH0.520.620.520.30
ECAL0.480.620.490.35
Graphormer0.490.580.480.15
GAT0.470.560.470.30
GINE0.450.480.430.00
Graph matching network0.430.470.430.05
Spectral baseline0.350.370.350.00

Read the table as a trade, not a win. The two best GNNs reach a higher F1 and a much higher precision. XGBoost shares the best macro recall, and it is the only model above 0.7 recall on data destruction and above 0.5 on ransomware. In security, a missed attack usually costs more than a second look at a benign window, so recall on the rare, destructive classes matters most. The price is benign recall of 0.61: more benign windows get a second look, which is cheaper than a missed attack but still costs analyst time.

Grouped bars of recall per class for XGBoost, GEN, UniMP and FLASH Recall per class, mean of 5 trials XGBoost GEN UniMP FLASH 0 0.25 0.5 0.75 1 Benign Crypto-jacking Data destruction Data exfiltration Ransomware
Figure 10. Recall per class for XGBoost and the three strongest deep models.

Averages hide where the errors go. One test split shows it:

A five by five confusion matrix for XGBoost on one test split; diagonal 23, 10, 15, 6 and 1 out of 35, 14, 21, 14 and 4 XGBoost, one test split: true class (rows) against predicted class (columns) Ben. CJ DD DE Ra Benign (35) 23 6 5 1 0 Crypto-jacking (14) 2 10 0 1 1 Data destruction (21) 2 3 15 1 0 Data exfiltration (14) 1 3 2 6 2 Ransomware (4) 0 2 1 0 1 Diagonal: correct. 55 of 88 test graphs. Column CJ collects 14 errors: every model in the paper drifts towards crypto-jacking when unsure. Ransomware: 4 test graphs, none called benign.
Figure 11. Confusion matrix for XGBoost from the paper, one of the five trials.

The paper notes two patterns across models. When unsure, they lean towards crypto-jacking, plausibly because every attack shares its early discovery steps. And in the example splits, no ransomware graph was called benign by any model except the graph matching network. Each test split holds only about four ransomware graphs, which explains XGBoost's standard deviation of 0.24 on that class; treat those numbers as a direction, not a measurement.

Cost was the clearer difference. Deep models trained on a V100 GPU and slowed down as graphs and data grew; XGBoost trained on a CPU in negligible time regardless of graph size. Inference including feature construction was also cheapest for XGBoost. Graphormer, with nearly 50 million parameters, was too slow to include in the timing comparison. For very large graphs the advantage narrows, because Laplacian features get expensive, one more reason to keep windows short.

Attacks the model has never seen

A detector trained on four attacks will meet a fifth. To test this, we retrained XGBoost with one attack type removed each time and looked at where that type's graphs ended up.

For each withheld attack the share predicted benign: crypto-jacking 41 per cent, data destruction 15, data exfiltration 38, ransomware 5; the rest predicted as another attack Where a withheld attack type lands (% of its graphs) predicted benign: a miss predicted as another attack: still flagged Crypto-jacking 41% benign, 59% flagged as an attack Data destruction 15% benign, 85% flagged as an attack Data exfiltration 38% benign, 62% flagged as an attack Ransomware 5% benign, 95% flagged as an attack
Figure 12. Withheld attacks: what was missed and what was still flagged.

At most 41 per cent were called benign; most still landed in some attack class, because they share discovery steps and footprints with the attacks the model knew. Withheld graphs also got lower predicted probabilities than known classes, except for data destruction. The paper proposes a cheap safeguard: send low-confidence windows for a second look, or add a benign-versus-attack model next to the multi-class one and combine several models by vote.

Which features mattered

Instead of reading feature importance, we removed one level at a time and retrained.

Macro F1 is 0.52 with all features and falls to 0.49 without node, 0.48 without subgraph, 0.47 without edge, 0.44 without triplet and 0.41 without graph-level features Macro F1 when one feature level is removed All features 0.52 Without node level 0.49 Without subgraph level 0.48 Without edge level 0.47 Without triplet level 0.44 Without graph level 0.41
Figure 13. Removing any level hurts; the small spectral set hurts most.

Every level contributes. The ten graph-level spectral features are the smallest group and the most important: without them, crypto-jacking and data destruction get confused. Only the run without node-level features called ransomware benign, which points to the keyword features.

What the evaluation does and does not show

The paper argues that much published work reports "deceptively high performance (e.g., 99% accuracy)" on datasets too simple to generalise. Holding ourselves to that standard means listing our own limits:

AspectWhat we didWhat it leaves open
SplitsFive random, stratified 80/20 splits over windowsWindows from one run can sit in both training and test. Consecutive windows look alike, so scores are probably optimistic; splitting by run, or by time, is the stricter test.
DataOne application, emulated attacks with varied steps and targetsReal clusters run many applications, and benign variety drives false positives.
Size438 graphs, 22 of them ransomwareAbout four ransomware graphs per test split, hence wide error bars.
LabelsEach window inherits its run's labelQuiet windows in attack runs are noisy labels; they cap measured recall and blur training.
Unknown attacksOne known type withheld at a timeA truly new campaign may share less with the known ones than our four share with each other.

None of these overturns the comparison, since all ten models faced the same conditions. They do mean the absolute numbers are not production performance.

Training offline, serving online

The two halves of the system run on different clocks. Training is a batch job: we ran it as a Kubeflow pipeline whose steps load versioned data, preprocess graphs into training, validation and test sets per class, train the GNN embedding model, train XGBoost on the combined features, then evaluate and select the best models. Inference is a stream: telemetry arrives through Kafka, each window becomes a graph, and KServe serves the selected PyTorch embedding model and the classifier for real-time predictions.

Offline lane: load data, preprocess, train GNN, train XGBoost, evaluate and select, all in Kubeflow. Online lane: Kafka stream, window graph, KServe embedding, KServe XGBoost, stability check and alert. The best models flow from offline to online Offline: Kubeflow Pipelines Load data versioned runs Preprocess graphs per class, train/val/test Train GNN embedding model Train XGBoost combined features Evaluate, select metrics, SHAP Online: per time window Kafka telemetry stream Window graph triplets, 500 ms KServe GNN embedding KServe XGBoost Stability check then alert best models deployed Training runs as pipeline steps on the cluster; inference serves the selected models behind KServe.
Figure 14. One pipeline trains, the other serves.

Keeping them apart pays off both ways (more on Kubeflow itself in Kubeflow: Production-Grade ML on Kubernetes). Training can use more data, more hyperparameter trials and a GPU when needed, without touching the live path. The live path depends only on small, versioned model artefacts, so deploying a better model needs no code change. And because in real time the system sees only part of an attack, a few windows of it, the models are trained on windows rather than on whole attacks.

Making it real time

A good classifier is one part of a real-time detector. The patent application covers the rest of the loop:

  • Telemetry. The knowledge graph is built from collectors already common in Kubernetes: the Falco daemonset, eBPF, Fluent Bit, OpenTelemetry, and the Open Cybersecurity Schema Framework (OCSF) for a common event format, streamed through Kafka.
  • Slices. The graph is divided into slices by time frame, and each slice gets a prediction.
  • Stability. A prediction counts only if it agrees with its neighbours. The claims assess "a gradient between predictions for neighboring graph slices" and can reject a prediction whose gradient crosses a threshold.

The patent's example of an unstable sequence is 0.15, then 1.0, then 0.0: changes of +0.85 and −1.0, both steep, so the spike is treated as noise. A real attack rises and stays up.

Attack probability per graph slice over time: a single spike to 0.95 is rejected as unstable, while a sustained rise to above 0.9 is accepted as an attack 0 0.5 1 isolated jump: rejected sustained rise: attack consecutive graph slices (time) → attack probability per slice P(attack)
Figure 15. Slice stability, illustrated with invented values.

Then comes the threshold that turns a probability into an alert. Setting it is a business decision, because the errors cost different things:

ErrorWhat it costsLevers
Missed attackDamage continues: data leaves, files are encrypted, the bill growsA lower threshold; a separate benign-versus-attack model; review of low-confidence windows
False alarmAnalyst time and alert fatigue, until real alerts are ignoredThe stability check; a higher threshold; deduplication before alerting
Wrong attack typeThe right alarm with the wrong playbookAlert on "attack" first, then attach the type with its probability

The last part is change. Clusters change, services appear, attackers adapt, and models must keep up. Embedding models for whole knowledge graphs struggle here: DKGE, a dynamic knowledge graph embedding method, was built because static models must be retrained on the whole graph after every update. Its online updates were at least 6 and 20 times faster on two benchmarks, and on a 3.2 million entity graph they took about two hours against a week from scratch, though accuracy drifted with repeated updates and a full retrain was still needed from time to time. Classifying short windows avoids most of this: each window is a new small graph, the embedding network handles it in one forward pass, and retraining XGBoost is cheap.

Where deep learning and LLMs fit

None of this argues against deep models. The best GNNs had better precision, and graph embeddings are part of our own design. The argument is about where to start. With a few hundred labelled graphs, strong imbalance and frequent retraining, hand-built features and gradient boosting gave the best recall per unit of cost, and they explain themselves.

Language models already appear in this field. The paper's related work includes BERT applied to malicious Unix shell logs, and sequence models that rebuild attack steps from audit logs. Their natural place is on the other side of the alert: summarising a flagged window for an analyst, mapping it to ATT&CK, or drafting the hunting query that confirms it. They fit poorly in the per-window decision, which must be made every half second on every node.

What I would keep, and change

  • Compress before you model. Flow-level telemetry turns millions of calls into far fewer records, and windows of about a hundred triplets keep every later step cheap.
  • Count what an analyst would look for. Triplet types, keywords and the Laplacian spectrum carried the signal and remain readable.
  • Report recall per class, with spread. Macro averages hid the ransomware story, and four test graphs need their standard deviation shown.
  • Split by run, not by window. Consecutive windows are near duplicates. Grouped or time-ordered splits are the honest test, and the first thing I would change.
  • Test unseen attacks on purpose. Withholding one class at a time is the cheapest estimate of day one of a new campaign.
  • Mix attacks into real background. Training on attack plus noise teaches the model what to ignore.
  • Judge a window by its neighbours. One noisy prediction should not wake anyone up.

Tailai Song led the study as first author, building on my code, and is now an Assistant Professor at City University of Hong Kong (Dongguan). The authors are Tailai Song, me, Lennart Gulikers, Giulio Grassi, Giovanna Carofiglio and Michela Meo, from Politecnico di Torino and Cisco.

Sources