Manuscript Offprint

arXiv:2608.24454

Defending Network Intrusion Detection Systems Based on Graph Neural Networks Against Structural Adversarial Attacks

Dimitri Galli, Andrea Venturi, Dario Stabili, Mauro Andreolini, Mirco Marchetti

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Dimitri Galli*, Andrea Venturi†, Dario Stabili*, Mauro Andreolini*, Mirco Marchetti*

*Department of Engineering “Enzo Ferrari”, University of Modena and Reggio Emilia, Modena, Italy

{dimitri.galli, dario.stabili, mauro.andreolini, mirco.marchetti}@unimore.it

†Department of Digital Security, Vicomtech, San Sebastián, Spain

aventuri@vicomtech.org

Abstract—Graph Neural Networks (GNNs) represent a promising solution for Machine Learning (ML) based Network Intrusion Detection Systems (NIDS), thanks to their ability to leverage both network flow features and topological patterns. While GNN classifiers demonstrate superior robustness against feature-based adversarial attacks compared to other ML detectors, they remain vulnerable to structural adversarial attacks, where an attacker perturbs the underlying network graph topology by injecting edges or inserting nodes. Such attacks pose a realistic and severe threat, undermining the reliability of GNN-based NIDS in practical deployments. While countermeasures have been proposed in the literature, they often rely on assumptions that are unrealistic in real-world cybersecurity scenarios. In this paper, we propose a defense framework based on adversarial training to strengthen GNN-based NIDS against structural attacks. We generate adversarial samples by strategically replacing the source and destination nodes in benign network flows, thereby efficiently mimicking edge injection attacks. We evaluate our approach on two widely used datasets (CTU-13 and TON-IoT) using E-GraphSAGE as the base GNN classifier. Experimental results show that our approach produces hardened detectors with superior detection performance on clean graphs and enhanced robustness against structural adversarial attacks.

Index Terms—adversarial training, graph neural networks, machine learning, network intrusion detection systems, structural attacks

I. INTRODUCTION

The exponential growth of network-based cyberattacks has increased the demand for accurate and adaptive Network Intrusion Detection Systems (NIDS) [1], [2]. In recent years, Machine Learning (ML) has emerged as a powerful paradigm for building these systems, enabling the automatic discovery of malicious patterns in network traffic and improving the detection of unknown attacks [3].

Despite these advances, ML-based NIDS remain highly vulnerable to adversarial ML attacks [4]. Such attacks carefully perturb input features to cause misclassifications, enabling malicious traffic to evade detection mechanisms. These manipulations provide attackers with a powerful means to conceal their activities while preserving the intended impact of their attacks [5]. The effectiveness of these attacks represents a concrete threat to the reliable deployment of ML-based NIDS in real-world environments.

Graph Neural Networks (GNNs) have emerged as a promising alternative for ML-based NIDS [6] due to the inherent graph-like structure of network traffic. GNN-based NIDS take network traffic in graph form as input data, modeling internal hosts as nodes and communication flows between them as edges. By analyzing both flow-level information (e.g., duration, byte count) and network topology, GNN-based NIDS have demonstrated superior detection performance compared to traditional ML detector [7], [8]. Empirical studies also show that GNNs exhibit stronger robustness against feature-based adversarial attacks due to their reliance on structural attributes [9].

However, incorporating network topology in the decision process can expose classifiers to a new class of threats known as structural adversarial attacks. These attacks manipulate the graph topology to induce misclassifications [10]. Since GNNs heavily rely on neighborhood structures, even small perturbations can dramatically degrade their detection performance. This is particularly concerning in cybersecurity scenarios, as such attacks can be launched by compromised hosts generating seemingly legitimate, and therefore hard-to-detect, network traffic [11]. While the scientific literature has proposed defenses against structural adversarial attacks, only a few have been explored in the cybersecurity domain. Moreover, many existing methods depend on prior knowledge of attack techniques or require computationally expensive resources, resulting in high latency and limiting their real-time deployment [12], [13].

Among traditional adversarial ML defenses, adversarial training stands out as a promising approach to enhancing classifier resilience by retraining ML models on an augmented training set that includes carefully crafted adversarial examples [14]. Nevertheless, its effectiveness in the specific context of GNN-based NIDS remains largely unexplored in prior literature. This work aims to fill this gap by introducing a new defensive method based on adversarial training. The key contribution lies in a novel strategy for generating ad-

© 2025 IEEE. This is the author's accepted manuscript. The Version of Record is available at https://doi.org/10.1109/NCA67271.2025.00043. This accepted manuscript is licensed under CC BY 4.0.

versarial examples, which considers the unique characteristics of the network intrusion detection domain and can be used to harden GNN-based NIDS against structural adversarial attacks. Specifically, we propose to generate synthetic adversarial flows by modifying both the source and destination endpoints of benign netflows with low-degree nodes. These nodes with few connections are structurally more vulnerable and therefore attractive to real-world attackers seeking to evade detection. Each modified record corresponds to a newly injected benign edge connecting low-degree nodes, thereby perturbing the graph topology.

We apply our approach to an extensive experimental campaign using two popular datasets of enterprise network flows. Our method targets various types of structural adversarial attacks, including those involving edge additions, node additions, or combinations of both. The results demonstrate the effectiveness of the proposed strategy, with absolute performance improvements of up to 90% in the best case against structural perturbations. Moreover, the hardened classifiers maintain high detection performance even in the absence of adversarial attacks.

The remainder of this paper is organized as follows. Section II provides background on ML-based NIDS, GNN-based NIDS, as well as adversarial ML attacks and corresponding defense mechanisms. Section III defines the threat model. Section IV describes the proposed defense strategy. Section V details the testbed. Section VI presents and discusses the experimental results. Section VII concludes the paper with final remarks.

References (45)