Research Article

Comparison of Network Attack Detection Algorithms Based on NSL-KDD Dataset

Qi Wu*
Sanjiang University

* Corresponding author: [email protected]

Abstract

Intrusion detection systems built on hand-written rules are losing ground as attackers find new ways to bypass fixed signatures. Working with the NSL-KDD benchmark, the paper put three classical machine learning methods—Decision Tree (DT), Random Forest (RF), and K-Nearest Neighbors (KNN)—through the same set of binary and five-class detection tests. Random forest handled the diverse five-class label set best, hitting 76.3% accuracy with an F1 of 0.720. In the simpler binary task, however, the decision tree pulled ahead (81.2%, F1 0.813). The reason was straightforward: the ensemble model grew too cautious when samples were scarce, suppressing false alarms at the cost of missing real attacks. DoS floods were caught almost without fail (F1 0.884). R2L and U2R, on the other hand, evaded detection almost entirely—their training presence was vanishingly small, at 0.83% and 0.04% of the training pool. Feature importance scores from the random forest pointed overwhelmingly to traffic volume and rate-based statistics as the strongest signals, while class skew stood out as the single largest obstacle. Rather than chasing marginal accuracy gains, the results argue for treating rare-class detection as the main priority in future work.

Keywords: Network intrusion detection; machine learning; NSL-KDD; random forest; feature importance
Published: August 18, 2026
DOI: 10.54254/2755-2721/2026.BA36241
Volume: ACE Vol.258
pp. 41-48
Download PDF

References

  1. Federal Bureau of Investigation. (2024). Internet crime report 2023. https://www.ic3.gov/Media/PDF/AnnualReport/2023_IC3Report.pdf
  2. Ravipati, R. D., & Abualkibash, M. (2019). Intrusion detection system classification using different machine learning algorithms on KDD-99 and NSL-KDD datasets – a review paper.International Journal of Computer Science and Information Technology, 11, 1–14.
  3. Ngueajio, M. K., Washington, G., Rawat, D. B., et al. (2022). Intrusion detection systems using support vector machines on the KDDCUP'99 and NSL-KDD datasets: A comprehensive survey.arXiv. https://arxiv.org/abs/2209.05579
  4. Udurume, M., Shakhov, V., & Koo, I. (2024). Comparative analysis of deep convolutional neural network–bidirectional long short-term memory and machine learning methods in intrusion detection systems.Applied Sciences, 14(8), Article 3289.
  5. Tavallaee, M., Bagheri, E., Lu, W., et al. (2009). A detailed analysis of the KDD CUP 99 data set. InProceedings of the 2009 IEEE Symposium on Computational Intelligence in Security and Defense Applications (CISDA)(pp. 1–6).
  6. Hakke, D. G., Dixit, A. Y., Thorat, S., et al. (2025). Performance evaluation of machine learning-based intrusion detection using NSL-KDD, UNSW-NB15 and CICIDS2017 datasets.International Journal of Applied Mathematics, 38(2), 145–162.
  7. Arcos-Argudo, M., Bojorque, R., & Torres, A. (2025). A deterministic comparison of classical machine learning and hybrid deep representation models for intrusion detection on NSL-KDD and CICIDS2017.Algorithms, 18(3), 112–130.
  8. Zamri, I. T. B., & Juremi, J. (2023). Review of network intrusion systems evaluated on NSL-KDD and CIC-IDS2017 datasets.Journal of Applied Technology and Innovation, 7(1), 33–48.
  9. Canadian Institute for Cybersecurity. (2009). NSL-KDD dataset [Data set].University of New Brunswick. https://www.unb.ca/cic/datasets/nsl.html
  10. Kasongo, S. M., & Sun, Y. (2023). A deep learning method with wrapper-based feature selection for wireless intrusion detection system.Computers & Security, 124, Article 102984.
  11. Das, S., Mahfouz, A. M., Venugopal, D., & Shiva, S. (2023). Dimensionality reduction for network intrusion detection: A comparative study of feature selection techniques.IEEE Access, 11, 89321–89337.