AWS Builder Center

Can AI Detect 5G Attacks With Less Personal Data? Lessons From Our Thesis

Can machine learning detect malicious traffic in a 5G network while using less personal data? That is the question of the diploma thesis Spyros Kostantis and I are completing at the University of the Aegean. It looks at two privacy-friendly ideas: Data minimisation: remove the source and destination address fields and see if detection still works. Federated learning (FedAvg): train across 5 simulated nodes that share model parameters, not raw data.

The question

Can machine learning detect malicious traffic in a 5G network while using less personal data? That is the question of the diploma thesis Spyros Kostantis and I are completing at the University of the Aegean. It looks at two privacy-friendly ideas:
  1. Data minimisation: remove the source and destination address fields and see if detection still works.
  1. Federated learning (FedAvg): train across 5 simulated nodes that share model parameters, not raw data.

The data

We used 5G-NIDD, a public dataset from the University of Oulu, captured on a real 5G testbed: 1,215,890 flow records with benign traffic and 8 attack types (UDP/HTTP/SYN/ICMP floods, slow-rate DoS and port scans). We framed it as a binary task, benign vs malicious.
To keep the evaluation honest:
  • We split the data into training, validation and a held-out test set of 124,315 records.
  • Identical feature rows were kept in the same split.
  • Preprocessing was fitted on training data only.
  • The test set was used once, after all models were frozen.

What we found

1. Tree models detect attacks well. On the test set, Random Forest and Extra Trees reached a Macro-F1 of about 0.83. A naive baseline that always predicts “attack” scores only 0.36.
2. Removing addresses costs almost nothing for tree models.
Model
With addresses
Without
Change
Random Forest
0.8301
0.8298
−0.0003
Extra Trees
0.8301
0.8295
−0.0006
Logistic Regression
0.8299
0.7713
−0.0586
Detection does not need to know who is talking to whom. This is data minimisation, though, not proof of anonymisation.
3. FedAvg works, but has a cost. We trained the same MLP centrally and with FedAvg (Flower, 5 clients, 30 rounds), with balanced (IID) and skewed (non-IID) data splits, repeating with different random seeds.
  • Macro-F1 was similar, and the winner changed with the seed, so there is no stable winner.
  • In one typical pair, FedAvg caught 99.3% of attacks against 68.5% for the central model.
  • But it raised a false alarm on 42% of benign traffic, against 11% for the central model: roughly 4× more alerts.
The lesson: one metric is not enough. Always look at the error types.

Reproducibility

  • All randomness is fixed with seeds and library versions are pinned.
  • 47 automated tests pass.
  • We re-ran the experiments from scratch on a second machine and got identical results to the last decimal.

Limitations

  • One dataset only.
  • FedAvg was a local simulation, not real distributed devices.
  • No differential privacy or secure aggregation, so there is no formal privacy guarantee.
  • No 6G experiment, because 6G networks and datasets do not exist yet.

Takeaway

AI can strengthen 5G security and can do it with less identifying data. Privacy-oriented training like FedAvg should be judged by its false-alarm cost, not just a single score. Next steps: differential privacy and secure aggregation on top of FedAvg, and testing on other networks.
Dataset: 5G-NIDD, Siriwardhana et al., University of Oulu (CC BY 4.0).
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article