Abstract
Machine learning (ML)-based Intrusion Detection Systems (IDS) have become a key defence against advanced cyberattacks targeting Industrial Control Systems (ICS) in modern smart grids. Among these threats, Man-in-the-Middle (MITM) attacks are especially dangerous because they compromise the trust and privacy of communication between the control systems and other critical components within the interconnected smart grid. Although ML models have demonstrated a good ability to detect MITM attacks, they remain highly vulnerable to adversarial attacks, where small, carefully crafted changes can deceive the system and allow harmful traffic to go unnoticed. Even though adversarial machine learning is becoming increasingly important, its impact on ML-based MITM detection in smart grids remains inadequately explored. This paper examines the robustness of several widely used ML models against various adversarial attack methods using the RESLab smart grid dataset, an emulated testbed that produced network traffic containing MITM attack scenarios and is suitable for evaluating ML-based intrusion detection under adversarial conditions. To strengthen the models, we propose an adversarial training method that incorporates these hard-to-detect samples into the retraining process. Experiments show that adversarial attacks substantially degrade model performance. For example, fast-gradient sign method (FGSM)-perturbed MITM attacks can reduce the detection accuracy of the Random Forest (RF) classifier by 17.48 percentage points for binary classification and 14.86 percentage points for multiclass classification, demonstrating the vulnerability of conventional ML-based detection models. In contrast, when retrained with adversarial samples, the RF classifier achieves 81.59% detection accuracy for binary classification and 81.31% for multiclass classification, respectively, under fixed-source FGSM attacks, while maintaining strong performance on clean, unperturbed data. These results show that adversarial retraining greatly improves the robustness and reliability of ML-based MITM attack detection for protecting critical smart grid systems.