Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

18 June 2026

28 Pages

Topology-Independent SHAP-Based Explainable Intrusion Detection for ROS Networks

and
1
Department of Database, Network Design and Management, Plato Vocational School, Istanbul Topkapi University, Istanbul 34020, Türkiye
2
Department of Computer Technologies, Information Technologies Vocational School, Sakarya University of Applied Sciences, Sakarya 54500, Türkiye
*
Author to whom correspondence should be addressed.

Abstract

The Robot Operating System (ROS) is widely used in modern robotics, but its open architecture makes it vulnerable to numerous cyber threats. Although machine learning (ML)-based intrusion detection systems (IDSs) demonstrate strong classification performance on ROS-specific datasets, reliance on topology-dependent identifiers such as source and destination IP addresses, port numbers, and Flow IDs remains a critical limitation in current research. This reliance may encourage algorithms to exploit scenario-specific endpoint signatures instead of relying primarily on transferable behavioral patterns. Consequently, classification scores may be artificially inflated due to data leakage. This study addresses this issue by quantitatively measuring the impact of data leakage and introducing a topology-independent, explainable ROS framework that provides a more realistic, leakage-aware, and topology-independent evaluation framework. The evaluation involved testing the LightGBM, XGBoost, and CatBoost algorithms on ROSIDS23. Additionally, Random Forest and Gradient Boosting were included to verify the presence of data leakage. In our ablation study, models that included topology features achieved near-perfect Macro-F1 values of 0.999 to 1.000. In contrast, removing topology-dependent features reduced the Macro-F1 score to about 0.66. This finding shows that topology descriptors, rather than just transferable attack behaviors, can significantly influence the near-perfect scores seen with topology-preserving protocols. Even without topology data, ML models effectively captured temporal behavioral patterns and detected DoS attacks with nearly perfect performance, reaching F1 scores of 0.99 or higher. However, semantic attacks like Unauthorized Subscribe remained tough to classify, with F1 scores of 0.43 or lower. Additionally, SHapley Additive exPlanations (SHAP) analysis improves the interpretability of IDSs by identifying the main behavioral features that drive model decisions and suggesting feature-level directions for rule-based defense configurations in ROS environments.

1. Introduction

In real-world robotic applications, ROS is actively used to control robots across various sectors with its open-source library ecosystem and broad community support. This widespread use extends beyond research and development; it is becoming increasingly effective in security-critical areas such as industrial automation, surgical robotics, and autonomous infrastructure control. However, this development also brings several security challenges. In particular, it is exposed to cyber threats from a security perspective, due to its reliance on open topic channels and unencrypted message transmission, and the absence of built-in authentication mechanisms [1].
These attacks include DoS and Subscriber Flood attacks, which disrupt operational continuity, as well as semantic attacks like Unauthorized Publish and Unauthorized Subscribe. While these attacks differ according to various cybersecurity targets, they require IDS solutions that can differentiate between attack types.
During the ROS deployment phase, rule-based security measures, including access control policies, allowed communication patterns, rate limiting, and signature-based IDS logic, remain necessary [2,3]. However, these mechanisms must be highly protected. While they work well in detecting protocol violations and fixed attack patterns, they are highly vulnerable to structures using valid ROS channels that exploit unknown patterns, flood strategies, and syntactic errors. In particular, attacks such as Unauthorized Subscribe can leave the application intent vulnerable while preserving syntax; this renders a signature-based response insufficient. This situation highlights the importance of machine learning-based intrusion detection systems (IDSs) as a security layer, capable of detecting anomalies in packet timing, session dynamics, and transport state patterns in scenarios where static rules alone are inadequate.
The ROSIDS23 dataset published by Değirmenci et al. [4] is one of a number of publicly available datasets designed to evaluate intrusion detection approaches in ROS-based environments. Karamollaoğlu [5] investigated the comparative classification performance of fifteen machine learning and deep learning architectures on this dataset, reporting an F1-score of 99.51% with Gradient Boosting, as well as 99.80% accuracy with both Gradient Boosting and LightGBM. Although these results appear impressive at first glance, a closer methodological analysis reveals a critical limitation. The feature sets used in these studies include network topology-specific identifiers, such as source and destination IP addresses, port numbers, flow IDs, and timestamps. In a closed simulation environment, such features do not necessarily represent meaningful behavioral patterns; rather, they may directly encode the identity of the simulated attacking nodes.
This dependency also creates a significant robustness problem, as the model may become overly reliant on a limited set of topology-specific variables. When these variables are removed from the dataset, become unavailable, or cannot be collected reliably in practical scenarios, the model performance may decrease substantially [6]. To address this limitation, the present study proposes a more generalizable machine learning-based IDS framework that reduces feature dependency and improves robustness against missing or unavailable variables.
The contributions of this study can be summarized as follows:
  • First, we introduce a same-metric ablation setting that directly compares topology-inclusive and topology-independent feature configurations. The results show that topology-dependent identifiers, including IP addresses, port numbers, and Flow ID, can strongly inflate benchmark performance and lead to near-perfect results that do not necessarily reflect genuine behavioral learning.
  • Second, we quantify the effect of potential data leakage across multiple model families. The consistent 0.33–0.34 point decrease in Macro-F1 observed for LightGBM, XGBoost, CatBoost, a reconstructed Gradient Boosting baseline, and a non-boosting Random Forest diagnostic model suggests that the performance degradation originates from systematic leakage-prone features rather than from the limitations of a particular classifier.
  • Third, we enforce a strict data separation protocol throughout the experimental pipeline. Preprocessing parameters are fitted only on the training data, Optuna-based hyperparameter optimization is performed using cross-validation within the training set, and the test set is used only once for final evaluation.
  • Fourth, we conduct a SHAP-based explainability analysis to identify the behavioral discriminators associated with each attack class. This analysis helps move the IDS framework beyond black-box prediction and provides interpretable evidence about the features that drive model decisions.
  • Finally, we discuss feature-level implications that may support rule-based attack mitigation in ROS environments, thereby linking the empirical findings with practical security configuration strategies.
In summary, this study first identifies and quantifies the potential of topology-dependent variables to overstate the performance of models on ROSIDS23. Then, it investigates a leakage-aware, topology-agnostic IDS pipeline through several tree-based models. The next sections relate this contribution to previous work in the ROS and IDS literature, detail the proposed experimental protocol, and present predictive performance results together with SHAP-based explanations to clarify what the models learn under the topology-agnostic setting.

2. Related Work

The ROSIDS23 dataset by Değirmenci et al. [4] represents a ML-based IDS research tool for ROS environments. Karamollaoğlu [5] conducted a comprehensive benchmark study with ensemble methods (Gradient Boosting, XGBoost, LightGBM, Random Forest, CatBoost, Extra Trees, AdaBoost), traditional classifiers (SVM, KNN, Decision Tree, Logistic Regression, Gaussian NB), and deep learning architectures (LSTM, GRU, 1D-CNN), and reported almost perfect accuracy of 99.80% with Gradient Boosting. Zafar et al. [7] proposed a hybrid architecture combining 1D-CNN with a multi-head attention mechanism for high-throughput robot data streams. Another study by Değirmenci et al. [8] developed adversarially robust detection approaches combining epistemic, aleatoric uncertainty, and entropy metrics.
From a broader network security perspective, ML-based IDS research has largely focused on general-purpose datasets such as CICIDS2017 [9] and UNSW-NB15 [10,11]. However, these datasets do not capture the unique traffic patterns arising from ROS’s publisher–subscriber communication stream. Among deep learning-based IDS approaches, Kim et al. [12] proposed LSTM-based classification and Mirsky et al. [13] proposed online anomaly detection via autoencoder ensembles (Kitsune); neither has been validated in ROS-specific scenarios. Early work on behavior-based anomaly detection of cyber–physical attacks on robotic vehicles [14] is foundational in this area, though it does not cover ROS-specific protocols.
Despite these contributions, a closer examination of existing studies reveals a methodological limitation. None of these works explicitly evaluates the generalizability risk introduced by topology-dependent features. Retaining variables such as IP address and port numbers in model input may allow classifiers to recognize specific simulation endpoints rather than learning actual behavioral patterns associated with cyberattacks.
The integration of explainability into machine learning-based security systems has increasingly become a key requirement for operational trust, auditability, and compliance [15]. Within the Explainable Artificial Intelligence (XAI) literature, two widely used paradigms are LIME and SHAP. LIME, introduced by Ribeiro et al. [16], explains individual predictions through local linear approximations in a model-agnostic scheme. SHAP, proposed by Lundberg and Lee [17], builds on Shapley values from cooperative game theory and provides additive feature attributions with desirable theoretical properties, including local accuracy, consistency, and missingness. Molnar [18] further presents a comprehensive taxonomy of explainable machine learning methods.
However, in network security applications, the use of XAI requires additional methodologically important considerations. Local surrogate explanations may be sensitive to perturbation strategy, architecture-specific saliency methods are not directly suitable for tabular tree-based ensembles, and feature importance scores alone do not guarantee that the model has learned behaviorally meaningful attack patterns. In leakage-prone datasets, high attribution values may simply reflect shortcut variables rather than transferable security-relevant signals. For this reason, SHAP is adopted in the present study due to its efficient TreeExplainer implementation for tree-based models and its theoretically grounded additive attribution framework.
The main gap addressed in this study is therefore not limited to the use of explainability itself. Rather, this work combines SHAP-based interpretation with topology-independent feature engineering to ensure that the reported importance scores reflect transferable attack behavior instead of simulation-specific identifiers. To the best of our knowledge, existing research has only limitedly explored the joint use of SHAP and topology-independent feature design in ROS-specific intrusion detection.
Data leakage in network security datasets arises when features that are irrelevant to attack behavior but statistically correlated with attack labels in a specific experimental environments are included in model training. Sommer and Paxson [19] identified this as a fundamental problem in applying ML to network security. This problem is particularly evident in Karamollaoğlu’s study [5], where each attack type in the ROSIDS23 simulation environment originates from simulated nodes operating with fixed IP addresses and consistent port assignments.
A second leakage risk appears during hyperparameter optimization. If Optuna or similar frameworks use test-set scores during hyperparameter selection, the test set becomes part of the model selection. This biases the final evaluation. This study avoids this risk by running Optuna only on the training set with stratified 3-fold cross-validation. The test set is reserved only for final evaluation.
Several studies document the security weaknesses of the ROS 1 architecture [20,21]. Dieber et al. [3] performed systematic penetration testing on ROS nodes and reported weaknesses in authentication, authorization, and encryption. White et al. [2] proposed the SROS framework to secure ROS communication at the kernel, graph, and wire levels. These studies offer direct security mechanisms. They also show why ML-based IDS approaches should serve as a complementary defense layer. Behavior-based detection is especially important for zero-day attacks and new attack vectors absent from known signature databases.

3. Materials and Methods

This section presents the overall workflow of our proposed topology-independent intrusion detection framework. Figure 1 illustrates the end-to-end methodological pipeline from data preprocessing through model training to SHAP-based explainability analysis.
Figure 1. Overall workflow of the proposed topology-independent intrusion detection framework.
As shown in Figure 1, the framework follows a pipeline. First, it removes topology-dependent identifiers from raw CICFlowMeter features and fits preprocessing parameters, including median imputation values and IQR clipping bounds, but only on the training set to prevent information leakage. Then, Optuna searches hyperparameters with stratified 3-fold cross-validation on the training set and evaluates final models on the held-out test set. Finally, SHAP TreeExplainer produces post hoc explanations for model interpretation. This workflow keeps the test partition outside model development at every stage and supports a reliable evaluation setting.

3.1. Problem Formulation

ROS intrusion detection is formulated as a multi-class supervised classification problem. Let D = { ( x i , y i ) } i = 1 N be the labeled training set, where x i ∈ R d is the d-dimensional feature vector of a network flow and y i ∈ Y = { 1 , 2 , … , K } ( K = 5 ) is the corresponding attack class label. The objective is to learn a decision function f : R d → Y minimizing expected risk:
f * = arg min f ∈ H   E ( x , y ) ∼ P l y , f ( x )
where l ( · ) denotes the multi-class cross-entropy loss function.
The complete feature set F a l l is partitioned into topology-dependent and topology-independent subsets:
F a l l = F t o p o ∪ F i n d e p ,   F t o p o ∩ F i n d e p = Ø
where F t o p o = { Flow   ID ,   Src   IP ,   Dst   IP ,   Src   Port ,   Dst   Port ,   Timestamp } . The topology-independent feature set F i n d e p = F a l l ∖ F t o p o contains a total of d = 77 features. The primary deployment-oriented experiments are conducted using only the topology-independent feature set, F indep . In contrast, the topology ablation analysis additionally evaluates the same learners on the full feature set, F all , in order to quantify the extent to which topology-dependent identifiers inflate classification performance.
Within the Gradient Boosting framework, a model is expressed as a sum of T sequential trees [22]:
y ^ i = ∑ t = 1 T f t ( x i ) ,   f t ∈ H
where H represents the regression tree space. At each step t, the t-th tree is trained to correct the residual error of the previous step. The regularized objective function is defined as:
L ( t ) = ∑ i = 1 n l y i , y ^ i ( t − 1 ) + f t ( x i ) + Ω ( f t )
where the regularization term Ω ( f t ) = γ T L + 1 2 λ ∥ w ∥ 2 controls model complexity via the number of leaves T L and leaf weights w . LightGBM [23] improves computational efficiency via leaf-wise growth, XGBoost [24] employs a level-wise strategy, and CatBoost [25] offers ordered boosting with categorical feature support.
To address model-family dependence in the leakage estimate, this procedure also includes two auxiliary same-split diagnostics in the topology ablation. First, Gradient Boosting (GB) baseline [22] is reconstructed because GB was the most accurate model reported by Karamollaoğlu [5]. Second, a non-boosting Random Forest (RF) diagnostic [26] is added to test whether the topology-induced Macro-F1 drop is confined to greedy boosting. RF uses 100 trees, square-root feature subsampling, and balanced subsample class weighting under the same train/test split and preprocessing protocol for primary models. These auxiliary diagnostics are used only for leakage validation; primary optimized models, SHAP analysis, and edge-device benchmarks remain based on LightGBM, XGBoost, and CatBoost.

3.2. ROSIDS23 Dataset and Class Distribution

This research utilizes the ROSIDS23 dataset presented by Değirmenci et al. [4]. ROSIDS23 represents the first publicly available Network Intrusion Detection Data Set developed for the use of ROS-based environments. It has been made openly available in Zenodo. The data collection was performed using tcpdump within a TRL-5 level robotics laboratory environment (IFARLab-DIH, Eskişehir Osmangazi University), and CICFlowMeter was utilized to obtain 83 feature-based flow-level attributes as well as one class attribute [4].
There are 695,812 total labeled network flow records contained within the ROSIDS23 data set. These have been categorized into five different levels of traffic: DoS (600,015 or 86.2%); Subscriber Flood (46,599 or 6.7%); Benign (21,416 or 3.1%); Unauthorized Publish (14,791 or 2.1%); and Unauthorized Subscribe (12,991 or 1.9%). Of these, while DoS represents a broad network security risk, the other three forms of attack (Subscriber Flood, Unauthorized Publish, Unauthorized Subscribe) represent ROS-specific attacks directed at identifying and exploiting the gaps in authentication and authorization within ROS middleware [4]. The severe class imbalance—DoS comprising over 86% of all records and the remaining four classes accounting for less than 14%—creates classification challenges; consequently, macro-averaged metrics (Equation (8)) are adopted as the primary evaluation measure throughout the study, and class-balanced weighting is applied during training.
The primary justification for selecting ROSIDS23 is that none of the widely used network intrusion detection datasets—KDDCup99, NSL-KDD, CICIDS-2017 [9], UNSW-NB15 [10]—contain ROS-specific attack types. ROSIDS23 is among the few publicly available datasets that provide ROS-specific attack traffic collected from a real robotics environment [4].
The numerical class identifiers in Figure 2 correspond to the encoded labels used during preprocessing. Specifically, class 0 represents Benign traffic, class 1 represents DoS, class 2 represents Subscriber Flood, class 3 represents Unauthorized Publish, and class 4 represents Unauthorized Subscribe. This explicit mapping is provided to avoid ambiguity when interpreting the logarithmic class-distribution plot.
Figure 2. Class distribution of the ROSIDS23 dataset on a logarithmic scale.
The logarithmic scale in Figure 2 is necessary to visually resolve the extreme class imbalance. Since the class imbalance is substantial, with 600,015 samples in the DoS class and 12,991 samples in the Unauthorized Subscribe class, corresponding to an approximate ratio of 46:1, a majority-class classifier that predicts only DoS would achieve 86.2% accuracy. This shows that overall accuracy is a misleading performance metric. Therefore, Macro-F1, defined in Equation (8), is used as the primary performance measure throughout this study.
The central methodological decision of this study is the systematic exclusion of topology-dependent features before any modeling activity. As summarized in Table 1, six features are identified as topology-dependent and removed: Flow ID, Src IP, Dst IP, Src Port, Dst Port, and Timestamp. The remaining feature set consists of packet-level metrics, IAT statistics, TCP flag counts, window parameters, active/idle time distributions, and header length indicators. These features capture the statistical signature of network communication behavior in a topology-independent manner.
Table 1. Topology-dependent and representative behavioral features used in the feature selection protocol.
The proposed anti-leakage strategy is not simply a cosmetic feature-pruning step. It demarcates the boundary from identifier memorization to behavioral learning. The pruned features can be used to reconstruct the experiment-specific endpoint identity, whereas the retained features can be used to describe packet timing and burstiness as well as transport-layer and session-layer state features and dynamics. These features are more likely to generalize across ROS deployments with different node addresses, ports, and graph structures. Once the feature space is restricted to behavioral variables, model improvements are more plausibly associated with transferable attack-related patterns rather than with environment-specific endpoint identifiers.
The exclusion of Timestamp needs special elucidation. Absolute timestamps in ROSIDS23 are not stand-alone behavioral representations; rather, they are linked to the predefined execution order of a single laboratory scenario and may encode when specific attack scenarios were launched. Keeping absolute time or simple derivations thereof such as elapsed collection time would enable the classifier to make use of the experimental schedule. Real temporal behavior is not thrown away, because topology-independent timing metrics extracted from packet-level dynamics—Flow IAT, Fwd/Bwd IAT, Active, and Idle statistics—are kept. Further deployment-stable timestamp-based features might be achievable using multiple independently scheduled sessions and train-only calibration; this is beyond the current single-dataset design and hence not considered in the leakage-free benchmark.
To test if redundancy among near-duplicate statistics justified the retained behavioral variables, a Pearson correlation screen was run prior to fitting the models. This screen was run on the topology-independent training subset only. Of the total features, only 10 pairs showed correlation of | r | ≥ 0.95 . These pairings were largely the result of deterministic redundancy from CICFlowMeter or were related window aggregates. Redundant pairs in the analyses were: Tot Bwd Pkts and Subflow Bwd Pkts, Tot Fwd Pkts and Subflow Fwd Pkts, and Idle Mean and Idle Max. No correlation-based redundancy removal was performed in the main pipeline. The models tested in this study were tree-based models making multicollinearity less of a concern compared to with a linear model; they were also less sensitive to redundancy. A focused ablation of these eight features was performed in the analyses to verify the impact of redundancy. This reduction in redundancy caused the following changes to Macro-F1: in LightGBM, from 0.6585 to 0.6579, in XGBoost, from 0.6654 to 0.6648, and a slight increase in CatBoost, from 0.6532 to 0.6542. This confirmed that the performance of the models was not due to a small redundant feature set. The main SHAP signals reported in later sections, Fwd IAT Min, Active Mean, and Bwd IAT Min, do not line up with the same redundant family of packet counters. Thus, the findings of this study are not based on redundant features.
During the study, strict data separation methods are implemented. Stratified sampling is used to create training and test partitions, resulting in 80% (556,649 samples) in the training set and 20% (139,163 samples) in the test set, with respect to the original data class distributions [27]. Three levels of leakage prevention are implemented: (1) topology leakage: before modeling, Flow ID, IP, Port, and Timestamp are removed; (2) preprocessing leakage: median imputation and IQR clipping values that transform X test are derived strictly from X train ; and (3) hyperparameter leakage: Optuna is performed on X train with 3-fold CV, and the test set remains untouched.

3.3. Model Selection and Hyperparameter Optimization

The most important optimized classifiers are LightGBM, XGBoost, and CatBoost. As evidenced by their notable performance, these classifiers are preferred for their proven track record with respect to tabular data [23,24,25]. To deal with the significant class imbalance, all the models employ balanced class weights. Optuna [28], utilizing the TPE sampler, is performed for hyperparameter tuning with stratified 3-fold cross-validation. Balanced class weights are incorporated in the training set only. The first 15 optimization trials are shown per model, and convergence diagnostics are performed in an extended 50-trial set for all three optimized models to determine if the budget of trials is balanced class weights.
Figure 3, Figure 4 and Figure 5 present the initial Optuna optimization histories for LightGBM, XGBoost, and CatBoost, respectively. All three models converge to approximately 0.65 Macro-F1.
Figure 3. Optuna optimization history for LightGBM (15 trials).
Figure 4. Optuna optimization history for XGBoost (15 trials).
Figure 5. Optuna optimization history for CatBoost (15 trials).
The fact that all three optimization trajectories led to around 0.65 Macro-F1 (Figure 3, Figure 4 and Figure 5) is important. The models hit a performance ceiling even though the tree construction techniques are fundamentally different: LightGBM uses leaf-wise growth, XGBoost uses level-wise growth, and CatBoost uses ordered boosting. This shows that the ceiling is more likely set by the structure of the feature space and not by the model design or by the hyperparameter settings. The 50-trial diagnostics of Table 2 support this line of reasoning. For all models, after trial 15, the best-so-far Macro-F1 is improved by less than 0.001.
Table 2. Extended 50-trial Optuna convergence diagnostic for the three primary models (training-only 3-fold CV Macro-F1).

3.4. Hyperparameter Search Space

Table 3 presents the hyperparameter search space optimized with the Optuna TPE sampler [28] for each model, along with the selected values used in the primary reported experiments. Bayesian optimization (TPE) is preferred over random search [29] for more efficient convergence within a limited trial budget. Hyperparameter optimization is formulated as in Equation (5):
θ * = arg min θ ∈ Θ   1 3 ∑ k = 1 3 L v a l ( k ) ( θ )
where θ is the hyperparameter vector, Θ the search space, and L v a l ( k ) the validation loss of the k-th fold.
Table 3. Hyperparameter search space optimized with Optuna and selected best values.
Table 3 illustrates that competitive validation performance can be achieved by the three boosting families without requiring high parameterization or high model complexity. LightGBM fits best with a low learning rate and few leaves, which supports incremental fitting on heterogeneous statistics. XGBoost, however, achieves the best performance at test time later in the manuscript, and in spite of a lower best CV Macro-F1 score in this instance, XGBoost’s regularized tree construction seems to provide better generalization to the held-out split. CatBoost seems to require a construction that is both deeper and more compact. This construction suggests ordered boosting can take advantage of the limited nonlinearity of the reduced, topology-independent feature space without introducing overfitting.

3.5. Evaluation Metrics

Macro-F1 is used as the primary metric to prevent class imbalance from distorting evaluation. The formal definitions of class-wise and macro metrics for K classes are given below:
Precision k = T P k T P k + F P k ,   Recall k = T P k T P k + F N k
F 1 k = 2 · Precision k · Recall k Precision k + Recall k
Marco-F 1 = 1 K ∑ k = 1 K F 1 k
where T P k , F P k , and F N k denote the true positives, false positives, and false negatives of class k, respectively. Macro averaging assigns equal weight to each class, providing support-independent evaluation. Overall accuracy Acc = ∑ k T P k   /   N is also reported. SHAP TreeExplainer [17] is applied to the LightGBM model on a randomly selected visualization subset of 500 test instances, and the stability of global SHAP rankings is checked on an additional stratified 5000-instance subset.

4. Results

4.1. Quantitative Measurement of Data Leakage

The main contribution of this research is measurement of topology-induced data leakage in ROS intrusion detection. In order to simplify the definitions of metrics, we restrict our comparison in Table 4 by using the same train/test data split, same data preprocessing, same families of models, same evaluation of models using the Macro-F1 metric, and same model evaluation involving two feature sets, one of which is topology-inclusive ( F a l l ) and other of which is topology-independent ( F i n d e p ). In the ablation study for topology inclusion, Flow ID, source and destination IP addresses, source and destination ports, and timestamps are kept in the dataset, and the other variables in the dataset are subjected to deterministic numeric/categorical encoding. Identifier-like variables are not subjected to IQR clipping because clipping endpoint identifiers is not semantically meaningful.
Table 4. Same-metric topology ablation using Macro-F1 for both topology-inclusive and topology-independent settings. Δ topo = Macro-F1( F a l l ) − Macro-F1( F i n d e p ).
As shown in Figure 6, the same-metric performance drop corresponds consistently to a 0.33–0.34 decrease in Macro-F1 across all tested models. To quantify this topology effect, the following cross-model drop metric is defined:
Δ topo ( m ) = Marco-F 1 ( m ) ( F a l l ) − Marco-F 1 ( m ) ( F i n d e p )
Here, m indexes the five evaluated learners: LightGBM, XGBoost, CatBoost, the reconstructed Gradient Boosting baseline, and Random Forest. The low cross-model variability of this metric indicates that the performance drop is a systemic phenomenon—originating from the feature set rather than a peculiarity of one estimator family.
Figure 6. Visual representation of the same-metric topology ablation. Removing topology features reduces Macro-F1 by approximately 0.33–0.34 across the primary models, the reconstructed Gradient Boosting baseline, and the non-boosting Random Forest diagnostic.
The results reveal a highly consistent pattern: Δ topo LGBM = 0.3415 , Δ topo XGB = 0.3331 , Δ topo Cat = 0.3441 , Δ topo GB = 0.3419 , and Δ topo RF = 0.3340 . The mean same-metric drop across five models is Δ ¯ topo = 0.3389 with a standard deviation of only σ Δ = 0.0045 . This does not prove universality across all possible learners, but it directly addresses the concern that the finding might be an artifact of a single optimized boosting implementation. The previously reported weighted-F1 values in Karamollaoğlu [5] are therefore used only as literature context in this manuscript, not as the basis for the leakage magnitude calculation.

4.2. Class-Wise Performance Analysis

Table 5 presents the per-class classification report for all three models. Figure 7, Figure 8 and Figure 9 compare these results visually on a per-model basis.
Table 5. Per-class classification report (topology-independent, test set n = 139,163).
Figure 7. Per-class performance for LightGBM (Precision, Recall, F1 Score).
Figure 8. Per-class performance for XGBoost (Precision, Recall, F1 Score).
Figure 9. Per-class performance for CatBoost (Precision, Recall, F1 Score).
A distinct performance ordering can be identified across the five traffic classes (Table 5; Figure 7, Figure 8 and Figure 9). Denial of Service (DoS) traffic is recognized almost entirely by all models (F1 = 0.99, Precision = 1.00), with the signature of temporal congestion completely separating DoS flood traffic from other traffic classes. Subscriber Flood attained an F1 score of 0.85 with Precision scores of 0.97–0.98 and Recall of 0.75. This indicates that the volumetric traffic signature becomes discriminative when above a certain threshold; however, a significant proportion of SubFlood flows is below the threshold, and thus will not be detected. Benign traffic showed the opposite pattern with low Precision (0.44–0.46) and moderate Recall (0.69–0.71). This indicated that benign flows are identified; however, they are often confused with attack classes that are semantically similar. Unauthorized Publish is situated in a middle position with an F1 score of approximately 0.50, reflecting a partial flow level overlap with both Benign and Subscriber Flood classes. Across all models, Unauthorized Subscribe was the most difficult class for which to achieve good performance (F1 ≤ 0.43), with even lower Recall (0.39–0.40), indicating that about 60% of Unauthorized Subscribe samples were misclassified and that topology-independent flow-level features alone are insufficient to separate this semantic attack reliably.

4.3. Class Imbalance Mitigation Check

Since Unauthorized Subscribe is the smallest and weakest class, two complementary mitigation checks of LightGBM were applied: (1) class-specific threshold tuning for Unauthorized Subscribe on a validation split, and (2) SMOTE oversampling of minority classes to 10% of the DoS majority count. Table 6 displays the results for the held-out test set.
Table 6. Complementary imbalance mitigation checks for LightGBM under the topology-independent protocol.
The different imbalance treatments show only slight improvements for Unauthorized Subscribe, with the largest F1 gain being only ( + 0.0046 ). However, the overall error structure remains unchanged. Threshold tuning improved recall from ( 0.3899 ) to ( 0.4192 ), but it also worsened precision and Macro-F1. The best overall Macro-F1 score of (0.6610) was achieved by SMOTE, with only a marginal improvement in the F1 score of Unauthorized Subscribe. Therefore, the difficulty of detecting Unauthorized Subscribe cannot be explained solely by using balanced class weights.
To directly test multi-flow-context hypothesis, LightGBM was used in a preliminary short-window context augmentation to include the mean, standard deviation, and delta of the previous five flows to key temporal features. The same train/test split produced a large increase in Macro-F1 from 0.6585 to 0.7598. The same was seen for Unauthorized Subscribe, in which precision/recall/ F 1 improved from 0.4465 / 0.3899 / 0.4163 to 0.4917 / 0.6405 / 0.5563 . The magnitude of the improvement obtained with temporal context was larger than that achieved by class-weight adjustments, suggesting that the absence of temporal-session context is an important limitation of the single-flow feature representation. The Benign–Unauthorized Subscribe confusion was substantial under single-flow features, whereas the preliminary context-augmentation result suggests that multi-flow temporal context can reduce this ambiguity.

4.4. Confusion Matrix Analysis

Figure 10, Figure 11, and Figure 12 present the confusion matrices for LightGBM, XGBoost, and CatBoost, respectively.
Figure 10. Confusion matrix for LightGBM.
Figure 11. Confusion matrix for XGBoost.
Figure 12. Confusion matrix for CatBoost.
The confusion matrices (Figure 10, Figure 11 and Figure 12) reveal systematic misclassification patterns that are consistent across all three models and similar errors are found in the classification matrices. In each case, the main classification error was between Unauthorized Subscribe flows and Benign flows. This is because flows that exhibit Unauthorized Subscribes create traffic that is almost identical to legitimate flows. This overlap makes it difficult, if not impossible, to identify the flow as being a legitimate subscription. To help identify flows as being legitimate subscriptions, it is suggested that flow statistics be augmented with multi-flow aggregates, and with a ROS-aware DPI of the negotiation metadata for XML-RPC/TCPROS. The DoS flows that were misclassified as Subscriber Flood were caused by a similar flooding effect, in that both DoS and Subscriber Flood attacks exhibit high packet rates. However, the DoS flood attack was more congested. In the classification of the unauthorized Publish flows and the Benign flows, more of the unauthorized Publish flows were predicted. Accuracy, in this case, was low. This suggests that flows classified as Benign may exhibit similar authenticated Publish flow patterns. The same misclassification patterns were found in each model (LightGBM, XGBoost, and CatBoost). This suggests that the misclassification patterns are from the feature space rather than the models themselves.

4.5. Statistical Validation

To validate the reproducibility of the results, all experiments were independently repeated with ten different random seeds: 42, 123, 456, 789, 1024, 2048, 4096, 8192, 16,384, and 32,768. Data partitioning, preprocessing (median imputation, IQR clipping), and model training were performed from scratch in each run. Table 7 presents Macro-F1 scores across all three models per seed.
Table 7. Macro-F1 scores obtained with ten different random seeds.
Results demonstrate high consistency: standard deviations across three models range from 0.0019 to 0.0030, indicating that performance is only weakly sensitive to random seed selection even under ten independent repetitions. XGBoost achieved the highest mean Macro-F1 ( 0.6668 ), followed by LightGBM ( 0.6589 ) and CatBoost ( 0.6539 ).
The statistical significance of performance differences between model pairs was assessed with the Wilcoxon signed-rank test. With ten seeds, all three pairwise comparisons became statistically significant: CatBoost versus LightGBM ( W = 0.0 , p = 0.001953 ), CatBoost versus XGBoost ( W = 0.0 , p = 0.001953 ), and LightGBM versus XGBoost ( W = 0.0 , p = 0.001953 ). Because the sign of the paired difference was consistent across all ten repetitions, the Wilcoxon result supports the rank ordering observed in the descriptive means.
The rank ordering across the ten runs (XGBoost > LightGBM > CatBoost) is therefore supported both descriptively and inferentially within the present protocol. At the same time, the practical differences remain modest in absolute terms (mean Macro-F1 deltas: XGBoost–LightGBM ≈ 0.0079 , LightGBM–CatBoost ≈ 0.0050 ), so the main reproducibility message remains the low dispersion across seeds rather than a large performance gap.

4.6. Inference Time Analysis

We present the inference times of three models under different batch sizes on three platforms. Before the test, the original notebook was timed in a Google Colab CPU runtime for a cloud-runtime reference (Table 8). Since Colab is a shared resource and dynamically allocates resources, and the exact CPU was not retained in logs, these values are not considered as embedded deployment evidence alone. Subsequently, exported models were run on two embedded robot platforms: an NVIDIA Jetson Nano (Table 9) and a TurtleBot3 Burger/Raspberry Pi platform (Table 10).
Table 8. Model inference times in Google Colab CPU runtime used for the original notebook (ms: milliseconds, μs: microseconds).
Table 9. Jetson Nano edge-device inference times.
Table 10. TurtleBot3 Burger/Raspberry Pi edge-device inference times.
CatBoost is the fastest model for batch inference in this cloud runtime (full test set: 303 ms, 2.2 μs per sample). XGBoost shows intermediate performance (19.2 μs/sample), while LightGBM has the slowest inference time (80.6 μs/sample). These values indicate low software-level prediction overhead, but hardware-specific edge measurements are required before making real-time deployment claims for resource-constrained robots.
Edge-device inference experiments were conducted on two embedded platforms. The Jetson Nano tests were performed on an NVIDIA Jetson Nano running L4T R32.7.6 with a 4-core ARM Cortex-A57 CPU, 3.9 GB RAM, and Python 3.8. The TurtleBot3 Burger/Raspberry Pi tests were performed on Ubuntu Linux 5.4.0-1129-raspi with a 4-core ARM Cortex-A72 CPU, 1.8 GB RAM, and Python 3.8.10. For batch sizes of 1, 100, and 1000, inference times are reported as mean ± standard deviation over 30 repetitions after three warm-up runs. Full-test timings were measured using one complete pass over the test set.
The results for the embedded devices demonstrate that all three topology-independent models are capable of single-flow inference within a 10 ms control-cycle budget on both robot platforms: 0.67–1.15 ms on the Jetson Nano and 2.79–3.80 ms on the TurtleBot3 Burger/Raspberry Pi platform. For full-test batch inference, CatBoost is still the most efficient choice on both platforms (2.3 μs/sample on Jetson Nano and 5.4 μs/sample on TurtleBot3), followed by XGBoost (14.3 and 28.1 μs/sample) and LightGBM (91.1 and 338.9 μs/sample). Therefore, the original Colab timings are to be regarded as only indicative for reference purposes, while Table 9 and Table 10 present concrete edge-device results on two low-resource robotic platforms.

5. Explainability Analysis

This section presents model explainability analysis based on the SHAP (SHapley Additive exPlanations) [17] framework. SHAP computes the marginal contribution of each feature to prediction based on Shapley values from cooperative game theory. The Shapley value of the j-th feature is defined as:
ϕ j ( f , x ) = ∑ S ⊆ F ∖ { j } | S | !   ( | F | − | S | − 1 ) ! | F | ! f ( S ∪ { j } ) − f ( S )
where S denotes all possible feature subsets excluding the j-th feature, and f ( S ) gives the model output when only features in S are present. Shapley values are the only attribution method simultaneously satisfying local accuracy ( ∑ j ϕ j = f ( x ) − E [ f ( x ) ] ), consistency, and missingness axioms [18]. Due to the K = 5 -class structure, separate SHAP values are computed per class; global importance is reported as E x [ | ϕ j | ] . Computations are performed with the polynomial-time TreeExplainer algorithm [17] specific to tree-based models.

5.1. Global Feature Importance

Figure 13 shows the global SHAP feature importance for the LightGBM model. Even though XGBoost yielded a slightly better Macro-F1 score (Table 4), LightGBM was chosen for further investigation with SHAP due to its native TreeExplainer optimizations as well as its performance being comparable with the other two models (see Section 4.5). The dominant features are packet inter-arrival time and activity metrics on sessions, which capture the temporal behavior of network communication without using topology information.
Figure 13. SHAP global feature importance (mean |SHAP value| over 500 visualization samples, all classes).
Temporal packet inter-arrival time features dominate the model decision process in the global feature importance ranking shown in Figure 13. Fwd IAT Min ranks first because DoS attacks, which constitute 86% of the dataset, compress forward inter-packet intervals to the sub-millisecond range, making this feature one of the most stable discriminative indicators across classes. Active Mean and Active Max, ranked second and third, respectively, represent temporal activity patterns within a session and help distinguish brief attack flows from long-lasting genuine sessions. The relatively low ranking of packet-size-related features, such as Fwd Pkt Len Mean and Tot Fwd Pkts, suggests that ROS attack behavior is characterized more by temporal patterns than by volumetric patterns. Init Bwd Win Byts, which reflects anomalous TCP initial window size behavior, contributes more strongly to the separation between UnauthSub and Benign traffic and is therefore discussed in the following subsections.
Representativeness of the 500-sample visualization subset: global SHAP importance was recalculated on a stratified 5000-sample test subset (3.6% of the entire test set) The two rankings were virtually indistinguishable: Spearman’s ρ = 0.9999 ( p < 10 − 100 ), and top-20 feature sets were identical (20/20). The top five features were Fwd IAT Min, Active Mean, Bwd IAT Min, Active Max, and Fwd IAT Max, which again confirmed that the findings of the interpretability is not a result of the smaller visualization subset.

5.2. DoS Attack Behavioral Signature

Figure 14 presents the SHAP beeswarm plot for DoS classification. The plot reveals a clear and interpretable behavioral signature: low Fwd IAT Min values strongly trigger DoS classification.
Figure 14. SHAP beeswarm plot for DoS attack classification.
The beeswarm plot in Figure 14 clearly shows a monotonic pattern, with lower Fwd IAT Min leading to a higher probability of DoS classification (blue points moving leftward on the x-axis, SHAP values increasing sharply to the right, and narrowing sequence of positive DoS classification values along y-axis). The trend mirrors the physical working principle of DoS attacks—at the highest packet rate, inter-arrival times are compressed below the operating points of the normal functioning of the system, flooding the victim. A secondary effect is from Bwd IAT Min, which measures the temporal congestion that a victim node is experiencing on its responding side while being flooded. Hence the fact that a singular, physically interpretable feature axis accounts for nearly all F1 for DoS (0.99), which strongly indicates that the model learns the true behavioral signature of volumetric flooding, rather than some artefactual effect of topology. A motivated attacker might try to defeat this logic by adding jitter or by pacing the packets to move the dominant temporal feature away from the extreme DoS extremes. However, it would cut into throughput of the attack and the corresponding temporal signals would be disturbed as well, i.e., those created by Bwd IAT Min and Active Mean. What this means for deployment is that you should not rely on Fwd IAT Min as a single hard-block rule; you should use it in conjunction with at least one corroborating rate/activity metric, and you should stress-test against adversarial timing perturbations on a semi-regular basis.

5.3. Unauthorized Subscribe Behavioral Ambiguity

Figure 15 presents the SHAP beeswarm plot for Unauthorized Subscribe attack classification. The UnauthSub plot reveals a more diffuse feature importance pattern with lower absolute SHAP values.
Figure 15. SHAP beeswarm plot for Unauthorized Subscribe detection.
In contrast to the concentrated DoS signature, the UnauthSub beeswarm plot (Figure 15) is scattered with no leading factor in terms of importance. Maximum absolute SHAP values for UnauthSub are roughly an order of magnitude smaller than those for DoS. Init Bwd Win Byts is the best—still weak—indicator, representng very subtle TCP handshake abnormalities in an Unauthorized Subscribe attempt. Active Mean and Flow Duration are negligible contributors, but their SHAP distributions are highly overlapping with the Benign one. This multiple-feature, low-confidence decision surface accounts for the poor F1 ≤ 0.43 of UnauthSub and suggests that detecting this kind of attack effectively calls for richer features than flow-level statistics, e.g., multi-flow session context, or application-layer ROS topic metadata. Two concrete extensions emanate directly from this ambiguity. First, multi-flow aggregation needs to include repeated subscription attempts, grouped by source/topic pair, during short windows, with retry counts, inter-flow burstiness, and fan-out over end. Second, XML-RPC and TCPROS negotiation headers should be subject to DPI to verify the caller identity, topic name, and message-type conformance with the anticipated ROS communication graph. These stateful ROS-aware signals may provide a more suitable basis for reducing the Benign–UnauthSub confusion observed in the confusion matrices.

5.4. Single-Instance Explanation

Figure 16 presents the SHAP feature attribution plot for a single DoS instance. Temporal features dominate the attribution while no topology feature contributes.
Figure 16. SHAP feature attribution for a single DoS instance.
The single-instance explanation in Figure 16 demonstrates the practical utility of SHAP at the individual prediction level. For this DoS instance, Fwd IAT Min alone accounts for approximately 60% of the prediction confidence, with Active Mean and Bwd IAT Min providing supporting evidence. The additive Shapley decomposition ( ∑ j ϕ j = f ( x ) − E [ f ( x ) ] ) guarantees that each feature’s contribution is mathematically exact and non-redundant. This level of detail enables security operators to verify whether individual alerts stem from genuine behavioral anomalies rather than statistical noise, directly supporting trust in automated IDS decisions.

5.5. Feature Distribution Analysis

Figure 17 presents the kernel density estimation distributions of key SHAP features by traffic class.
Figure 17. Featurevalue distributions by traffic class.
The KDE plots are also in agreement with an independently drawn visual hierarchy of class separability. The distribution of Fwd IAT Min for DoS is several orders of magnitude lower than for all other classes, which accounts for the almost ideal detection rate. In contrast, the Benign and Unauthorized Subscribe distributions show a significant overlap when plotted across all the features presented here, which again confirm the very limited flow-level discriminability that causes the Benign↔UnauthSub confusion in the confusion matrices (Section 4.4). Subscriber Flood has a medium spread, with a long right tail of the Tot Fwd Pkts for this DoS attack, which is expected due to the volumetric nature of the attack. These distribution characteristics best align with the SHAP conclusions and serve as independent evidence that the topology-agnostic space of features is rich with, yet bounded by, discriminative power and sufficient for volumetric attacks, however, limited for semantic attacks.

5.6. Operationalization of SHAP Findings

SHAP-derived feature attributions provide directly actionable guidance for network security engineering in ROS deployments. The following examples are stated in raw CICFlowMeter units on the held-out test partition and should be interpreted as deployment-specific starting points rather than universal constants:
  • Flows satisfying Bwd IAT Min < 300 together with Active Mean > 1.0 × 10 7 correspond to a region dominated by DoS instances in the held-out data. This pattern can therefore be used as an early operational indicator for rate limiting, quarantine, or sandbox-based inspection before more computationally intensive analysis is applied.
  • Init Bwd Win Byts > 6.4 × 10 4 provides a practical admission-control indicator for Subscriber Flood traffic since the held-out median value for Subscriber Flood is 64,240 bytes, whereas the corresponding Benign median is only 501 bytes. This separation suggests that the feature can support lightweight pre-filtering of high-risk flows.
  • No reliable univariate blocking threshold was observed for Unauthorized Subscribe based on Init Bwd Win Byts because the Unauthorized Subscribe median value of 506 bytes lies within the Benign interquartile band of 501–507 bytes. Therefore, the operational recommendation for this class is not direct threshold-based blocking, but ROS-aware deep packet inspection and allow-list verification of XML-RPC/TCPROS subscription negotiation before session admission.

6. Discussion

The core result of this work is the consistent 0.33–0.34 same-metric Macro-F1 decline observed after removing topology-dependent features, with Δ ¯ topo = 0.3389 and σ Δ = 0.0045 , across three primary models, a re-implemented Gradient Boosting baseline, and a non-boosting Random Forest diagnostic model. This finding indicates that evaluation protocols in ROS intrusion detection should explicitly account for topology-dependent leakage when reporting and interpreting benchmark performance. Since the size of the drop stays constant for LightGBM, XGBoost, CatBoost, Gradient Boosting, and Random Forest, the effect should not be taken as an artifact of model choice but rather as an indication that system-wide data leakage occurs due to topology-based IDs. Models trained on Flow ID, IP addresses, ports, and timestamps are not really learning the attack; instead, they are latching on to the environment-specific endpoint signatures that almost certainly would fall apart if they were deployed outside a given ROS graph. This observation concretizes the more general closed-world caution of Sommer and Paxson [19] in a ROS-specific context and implies that future benchmark works may require a minimum methodological commitment to reporting topology-agnostic results rather than as a discretionary ablation.
Table 11 places this work in the context of the growing ROSIDS23 field by outlining what each paper in the literature explicitly reports with respect to topology-independent evaluation, leakage ablation, and explainability. The table is meant as a descriptive reporting map, not an assertion that prior authors entertained and dismissed these dimensions. Instead of focusing on methodological validity under simulation-based, deployment-oriented constraints as prior works had done, they focused on maximizing headline classification performance. In that regard, this work’s contribution is not merely a lower but more realistic score; it is rather the definition of a more stringent evaluation that separates behavioral learning from simulation memorization.
Table 11. Descriptive comparison of explicitly reported evaluation properties in ROSIDS23 studies.
The F1 scores stated in Karamollaoğlu [5] are calculated by weighted-average F1. Since the DoS class has a high F1 value (≈0.99) and accounts for 86% of the test set, it dominates the weighted average and hides the poor results on minority classes such as Unauthorized Subscribe. Macro-F1, which gives equal importance to each class, is also preferred in this work, as the presented overview is based on a more transparent comparison baseline that is not influenced by the bias that weighted F1 introduces due to class imbalance. N/R: A topology-independent Macro-F1 score directly comparable to the current protocol was not reported in these studies; hence, these records are included for methodological context only and not for numerical F1 comparison. “Not reported” indicates that a score for the given setting was not included in the public document, not that the authors did not evaluate the setting.
Simultaneously, the results do not imply that topology-independent IDS is not viable. On the positive side, the models maintain near-perfect discrimination for DoS and good performance for Subscriber Flood, suggesting that volumetric attacks have strong temporal and packet-level signatures even after removal of all topology cues. The more significant limitation seems to be in semantic attack classes, in particular Unauthorized Subscribe, where a lack of application-layer context introduces significant confusion with normal traffic. The low precision for Benign and Unauthorized Publish, as well as the low recall of Unauthorized Subscribe, suggest that the decision boundaries in the topology-agnostic feature space are overlapping to some degree. In terms of operations, this implies that flow-based ROS IDS in its own right can already provide valuable winnowing for volumetric attacks but semantic misuse detection probably calls for richer abstractions like multi-flow context, ROS topic semantics, or DPI-derived features.
This interpretation is reinforced by the SHAP analysis. The prevalence of packet inter-arrival time and activity statistics indicates that the models are based on behaviorally meaningful physical descriptors, rather than surrogate identity variables. Furthermore, the diffuse SHAP representation of Unauthorized Subscribe indicates the bottleneck of performance is due to the informativeness of the given features rather than a mere matter of suboptimal tuning. Therefore, the results of explainability not only provide post hoc transparency but also enable us to diagnose the precise boundary of what can and cannot be inferred from topology-free flow statistics. Here, SHAP serves as both a tool for interpretability and scientific validation, connecting model choices to plausible network behavior and informing the design of next-generation ROS IDS features.

7. Limitations and Future Work

The following limitations should be considered when evaluating the contributions of this study:
  • All experiments were conducted exclusively on ROSIDS23. General-purpose network datasets such as CICIDS2017 [9] or UNSW-NB15 [10] contain different traffic structures, and findings may not directly generalize. However, since the focus of this study is the quantitative measurement of ROS-specific data leakage, ROSIDS23 is the most appropriate and only available ROS dataset for this purpose.
  • ROSIDS23 was collected from a controlled simulation environment. Real-world ROS deployments contain noise sources absent from simulation, such as variable network loads, heterogeneous hardware latencies, and concurrent multi-application traffic.
  • The primary optimized models are three Gradient Boosting variants, and this revision adds a reconstructed Gradient Boosting baseline plus a non-boosting Random Forest diagnostic for the topology ablation. Broader comparisons with linear baselines such as Logistic Regression and deep learning architectures such as LSTM [12] and autoencoders [13] could further broaden the scope of findings.
  • This revision evaluated threshold tuning and SMOTE [30] as complementary checks, but a broader search over imbalance strategies, sampling ratios, calibrated decision thresholds, and cost-sensitive objectives remains outside the current scope.
  • This revision extends the reproducibility check to ten different random seeds and obtains significant pairwise Wilcoxon results within the present ROSIDS23 protocol. However, this should still be interpreted as within-dataset stability evidence rather than as a substitute for broader cross-dataset statistical validation, alternative resampling schemes, or additional nonparametric tests such as permutation testing.
  • This revision adds two edge-device measurements (Jetson Nano and TurtleBot3/Raspberry Pi). Broader validation across additional operating-system images, robot workloads, and embedded CPU classes remains necessary before claiming universal real-time performance.
Future investigation can be carried out in the following directions: (1) designing multi-flow contextual features and attention mechanisms to enhance the performance in UnauthSub detection; (2) adversarial robustness [8]; (3) transfer learning methods for different robotic platforms; (4) online learning methods dealing with concept drift; (5) systematic assessment of imbalance handling methods other than the threshold-tuning and SMOTE used in this study; (6) more extensive hardware-specific latency characterization on at additional embedded robotic platforms running live robot workloads; and (7) statistical methods for cross-dataset validation and complementary nonparametric approaches, i.e., permutation tests.

8. Conclusions

This study presents a comprehensive quantitative measurement of data leakage in ROS intrusion detection research and proposes a topology-independent, explainable IDS framework. In a same-metric ablation, topology-inclusive models reached near-perfect Macro-F1 (0.999–1.000), whereas excluding topology identifiers reduced Macro-F1 to approximately 0.66, yielding a consistent 0.33–0.34 drop across the three primary models, a reconstructed Gradient Boosting baseline, and a non-boosting Random Forest diagnostic.
However, Random Forest maintained informative detection performance. DoS attacks are detected at almost perfect F1 ≥ 0.99. The SHAP analysis indicates that the model learns real behavior and based on a 5000-sample SHAP stability check, the global feature ranking is not influenced by the smaller visualization subset. The statistical validation for a batch of 10 different random seeds was consistent (standard deviations ≤ 0.0030 ), and the Wilcoxon signed-rank tests became significant for all the pairs of models ( p = 0.001953 ). In addition, Jetson Nano and TurtleBot3 Burger/Raspberry Pi experiments show that single-flow inference can still be completed within 1.2 ms and 3.9 ms, respectively, across the three models, which further demonstrates the practicability of ROS-specific attack detection on low-power edge mobile robot hardware.
More importantly, our study not only generates higher headline scores than the recent ROSIDS23-based work but also changes the target for evaluation. In recent studies from Karamollaoğlu [5], Zafar et al. [7], and Değirmenci et al. [8], the focus was on topological-invariant classification performance or robustness; here, we detach and quantify directly the inflation brought by topology-dependent identifiers, perform leakage-free model selection, and add prediction with class-level SHAP explainability. This cumulative effect of topology independence, explicit leakage quantification, statistical stability analysis, and operationally interpretable explanations is the core novel scientific contribution of our work, and establishes a more stringent simulation-based benchmark towards future ROS intrusion detection research.
The most significant open challenge is the detection of Unauthorized Subscribe attacks (F1 ≤ 0.43 across all models). The evaluation protocol established in this study offers a repeatable methodological standard for future ROS intrusion detection research.

Author Contributions

Conceptualization, K.A.; methodology, K.A. and B.A.; software, B.A.; validation, K.A. and B.A.; formal analysis, K.A. and B.A.; investigation, K.A. and B.A.; resources, B.A.; data curation, B.A.; writing—original draft preparation, B.A.; writing—review and editing, K.A. and B.A.; visualization, B.A.; supervision, K.A.; project administration, K.A. All authors have read and agreed to the published version of the manuscript.

Funding

This study was supported by Istanbul Topkapi University within the scope of its publication incentive program. The funding number is not applicable.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available in the repository: https://zenodo.org/records/10014434 (accessed on 10 April 2026).

Acknowledgments

We would like to thank the anonymous reviewers for their valuable comments.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ROSRobot Operating System
IDSIntrusion Detection System
MLMachine Learning
XAIExplainable Artificial Intelligence
SHAPSHapley Additive exPlanations
DoSDenial of Service
DPIDeep Packet Inspection
TPETree-structured Parzen Estimator
CVCross-validation
IATInter-arrival Time
XML-RPCExtensible Markup Language Remote Procedure Call
TCPROSTCP-based ROS Transport Protocol

References

  1. Yaacoub, J.-P.A.; Noura, H.N.; Salman, O.; Chehab, A. Robotics cyber security: Vulnerabilities, attacks, countermeasures, and recommendations. Int. J. Inf. Secur. 2022, 21, 115–158. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  2. White, R.; Christensen, H.I.; Quigley, M. SROS: Securing ROS over the wire, in the graph, and through the kernel. arXiv 2016, arXiv:1611.07060. [Google Scholar] [CrossRef] [Scilit]
  3. Dieber, B.; White, R.; Taurer, S.; Breiling, B.; Caiazza, G.; Christensen, H.I.; Cortesi, A. Penetration testing ROS. In Robot Operating System (ROS): The Complete Reference; Koubaa, A., Ed.; Springer International Publishing: Cham, Switzerland, 2020; Volume 4, pp. 183–225. [Google Scholar] [CrossRef] [Scilit]
  4. Değirmenci, E.; Kırca, Y.S.; Özçelik, İ.; Yazıcı, A. ROSIDS23: Network intrusion detection dataset for robot operating system. Data Brief. 2023, 51, 109739. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  5. Karamollaoğlu, H. Detecting robotic cyber attacks in robot operating system networks. Acta Infologica 2025, 9, 682–701. [Google Scholar] [CrossRef] [Scilit]
  6. Kaufman, S.; Rosset, S.; Perlich, C.; Stitelman, O. Leakage in data mining: Formulation, detection, and avoidance. ACM Trans. Knowl. Discov. Data 2012, 6, 1–21. [Google Scholar] [CrossRef] [Scilit]
  7. Zafar, M.H.; Falkenberg Langas, E.; Aftab, M.F.; Sanfilippo, F. Enhanced intrusion detection in robot operating systems via grid search based multi-head attention stacked convolutional network. In Proceedings of the 2024 IEEE 20th International Conference on Automation Science and Engineering (CASE), Bari, Italy, 28 August–1 September 2024; pp. 3880–3885. [Google Scholar] [CrossRef] [Scilit]
  8. Değirmenci, E.; Özçelik, İ.; Yazıcı, A. Adversarial attack detection approach for intrusion detection systems. IEEE Access 2024, 12, 195996–196009. [Google Scholar] [CrossRef] [Scilit]
  9. Sharafaldin, I.; Habibi Lashkari, A.; Ghorbani, A.A. Toward generating a new intrusion detection dataset and intrusion traffic characterization. In Proceedings of the 4th International Conference on Information Systems Security and Privacy (ICISSP), Funchal, Portugal, 22–24 January 2018; pp. 108–116. [Google Scholar] [CrossRef] [Scilit]
  10. Moustafa, N.; Slay, J. UNSW-NB15: A comprehensive data set for network intrusion detection systems. In Proceedings of the 2015 Military Communications and Information Systems Conference (MilCIS), Canberra, Australia, 10–12 November 2015; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  11. Buczak, A.L.; Guven, E. A survey of data mining and machine learning methods for cyber security intrusion detection. IEEE Commun. Surv. Tutor. 2016, 18, 1153–1176. [Google Scholar] [CrossRef] [Scilit]
  12. Kim, J.; Kim, J.; Thu, H.L.T.; Kim, H. Long short-term memory recurrent neural network classifier for intrusion detection. In Proceedings of the 2016 International Conference on Platform Technology and Service (PlatCon), Jeju, Republic of Korea, 15–17 February 2016; pp. 1–5. [Google Scholar] [CrossRef] [Scilit]
  13. Mirsky, Y.; Doitshman, T.; Elovici, Y.; Shabtai, A. Kitsune: An ensemble of autoencoders for online network intrusion detection. In Proceedings of the 2018 Network and Distributed System Security Symposium (NDSS), San Diego, CA, USA, 18–21 February 2018. [Google Scholar] [CrossRef] [Scilit]
  14. Bezemskij, A.; Loukas, G.; Anthony, R.J.; Gan, D. Behaviour-based anomaly detection of cyber-physical attacks on a robotic vehicle. In Proceedings of the 2016 15th International Conference on Ubiquitous Computing and Communications and 2016 8th International Symposium on Cyberspace and Security (IUCC-CSS), Granada, Spain, 14–16 December 2016; pp. 61–68. [Google Scholar] [CrossRef] [Scilit]
  15. Barredo Arrieta, A.; Díaz-Rodríguez, N.; Del Ser, J.; Bennetot, A.; Tabik, S.; Barbado, A.; Garcia, S.; Gil-Lopez, S.; Molina, D.; Benjamins, R.; et al. Explainable artificial intelligence (XAI): Concepts, taxonomies, opportunities and challenges toward responsible AI. Inf. Fusion 2020, 58, 82–115. [Google Scholar] [CrossRef] [Scilit]
  16. Ribeiro, M.T.; Singh, S.; Guestrin, C. “Why should I trust you?”: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 1135–1144. [Google Scholar] [CrossRef] [Scilit]
  17. Lundberg, S.M.; Lee, S.-I. A Unified Approach to Interpreting Model Predictions. In Advances in Neural Information Processing Systems; Curran Associates, Inc.: Red Hook, NY, USA, 2017; Volume 30, Available online: https://proceedings.neurips.cc/paper_files/paper/2017/file/8a20a8621978632d76c43dfd28b67767-Paper.pdf (accessed on 21 May 2026).
  18. Molnar, C. Interpretable Machine Learning: A Guide for Making Black Box Models Explainable, 2nd ed.; Independently Published: Munich, Germany, 2022; Available online: https://christophm.github.io/interpretable-ml-book (accessed on 21 May 2026).
  19. Sommer, R.; Paxson, V. Outside the closed world: On using machine learning for network intrusion detection. In Proceedings of the 2010 IEEE Symposium on Security and Privacy, Oakland, CA, USA, 16–19 May 2010; pp. 305–316. [Google Scholar] [CrossRef] [Scilit]
  20. Ahmad Yousef, K.M.; AlMajali, A.; Ghalyon, S.A.; Dweik, W.; Mohd, B.J. Analyzing Cyber-Physical Threats on Robotic Platforms. Sensors 2018, 18, 1643. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  21. Martín, F.; Soriano, E.; Cañas, J.M. Quantitative analysis of security in distributed robotic frameworks. Robot. Auton. Syst. 2018, 100, 95–107. [Google Scholar] [CrossRef] [Scilit]
  22. Friedman, J.H. Greedy function approximation: A gradient boosting machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef] [Scilit]
  23. Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Ye, Q.; Liu, T.-Y. LightGBM: A Highly Efficient Gradient Boosting Decision Tree. In Advances in Neural Information Processing Systems; Curran Associates, Inc.: Red Hook, NY, USA, 2017; Volume 30, Available online: https://proceedings.neurips.cc/paper_files/paper/2017/file/6449f44a102fde848669bdd9eb6b76fa-Paper.pdf (accessed on 21 May 2026).
  24. Chen, T.; Guestrin, C. XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar] [CrossRef] [Scilit]
  25. Prokhorenkova, L.; Gusev, G.; Vorobev, A.; Dorogush, A.V.; Gulin, A. CatBoost: Unbiased Boosting with Categorical Features. In Advances in Neural Information Processing Systems; Curran Associates, Inc.: Red Hook, NY, USA, 2018; Volume 31, Available online: https://proceedings.neurips.cc/paper_files/paper/2018/file/14491b756b3a51daac41c24863285549-Paper.pdf (accessed on 21 May 2026).
  26. Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Scilit]
  27. Szeghalmy, S.; Fazekas, A. A comparative study of the use of stratified cross-validation and distribution-balanced stratified cross-validation in imbalanced learning. Sensors 2023, 23, 2333. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  28. Akiba, T.; Sano, S.; Yanase, T.; Ohta, T.; Koyama, M. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 2623–2631. [Google Scholar] [CrossRef] [Scilit]
  29. Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
  30. Chawla, N.V.; Bowyer, K.W.; Hall, L.O.; Kegelmeyer, W.P. SMOTE: Synthetic minority over-sampling technique. J. Artif. Intell. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.