Deployment-Aware Evaluation of a Machine Learning-Based Web Application Firewall for Academic E-Voting Systems
DOI:
https://doi.org/10.47709/brilliance.v6i4.9731Keywords:
Cross-Site Scripting, E-Voting, Machine Learning, Random Forest, SQL Injection, Web Application FirewallAbstract
Web applications in higher education, including e-voting systems for student-organization elections, are frequent targets of SQL Injection (SQLi) and Cross-Site Scripting (XSS) attacks. Machine Learning (ML) based Web Application Firewall (WAF) studies usually select models by offline accuracy on curated datasets, which says little about how a model behaves once it filters live requests. This study aims to build an ML-based WAF embedded as middleware in an academic e-voting application and to test whether offline accuracy is a sufficient criterion for selecting a deployable model. HTTP request payloads were vectorized with character-level TF-IDF n-grams and Chi-Square feature selection, and Decision Tree (DT) and Random Forest classifiers were integrated into a Flask-based WAF that performs allow, block, and log actions. The models were assessed with a three-layer deployment-aware protocol: offline hold-out evaluation, black-box testing of the integrated middleware, and an independent stress test of 500 requests containing obfuscated attacks and look-alike benign inputs. Offline, the two models differed by less than 0.3 percentage points, with Random Forest reaching 99.54% accuracy for SQLi and 100% for XSS. Under the stress test, however, DT missed four obfuscated SQLi payloads, whereas Random Forest blocked all 400 attacks with 99.2% overall accuracy and a mean inference latency of 5.5 ms. Offline accuracy therefore hid a security-relevant difference that only deployment-aware testing revealed. The protocol and the security-first selection criterion offer a practical basis for evaluating ML-based WAFs in institutional web applications.
References
Alhamyani, R., & Alshammari, M. (2024). Machine Learning-Driven Detection of Cross-Site Scripting Attacks. Information, 15(7), 420. https://doi.org/10.3390/info15070420
Asan Nainar, M. M., & Sibikarthik, B. K. (2025). ML-Enhanced Behavioral and Anomaly Detection Web Application Firewall. International Journal of Innovative Research in Technology (IJIRT), 11(12). https://ijirt.org/publishedpaper/IJIRT178127_PAPER.pdf
Aydos, M., Aldan, Ç., Co?kun, E., & Soydan, A. (2022). Security testing of web applications: A systematic mapping of the literature. Journal of King Saud University - Computer and Information Sciences, 34(9), 6775–6792. https://doi.org/10.1016/j.jksuci.2021.09.018
Babaey, V., & Ravindran, A. (2024). GenSQLi: A Generative Artificial Intelligence Framework for Automatically Securing Web Application Firewalls Against Structured Query Language Injection Attacks. Future Internet, 17(1), 8. https://doi.org/10.3390/fi17010008
Bak?r, R. (2025). UniEmbed: A Novel Approach to Detect XSS and SQL Injection Attacks Leveraging Multiple Feature Fusion with Machine Learning Techniques. Arabian Journal for Science and Engineering, 50(19), 15591–15604. https://doi.org/10.1007/s13369-024-09916-4
Casmiry, E., Mduma, N., & Sinde, R. (2025). Enhanced SQL injection detection using chi-square feature selection and machine learning classifiers. Frontiers in Big Data, 8, 1686479. https://doi.org/10.3389/fdata.2025.1686479
Crespo-Martínez, I. S., Campazas-Vega, A., Guerrero-Higueras, Á. M., Riego-DelCastillo, V., Álvarez-Aparicio, C., & Fernández-Llamas, C. (2023). SQL injection attack detection in network flow data. Computers & Security, 127, 103093. https://doi.org/10.1016/j.cose.2023.103093
Dawadi, B., Adhikari, B., & Srivastava, D. (2023). Deep Learning Technique-Enabled Web Application Firewall for the Detection of Web Attacks. Sensors, 23(4), 2073. https://doi.org/10.3390/s23042073
Erskine, S. K. (2025). Real-time large-scale intrusion detection and prevention system (IDPS) CICIoT dataset traffic assessment based on deep learning. Applied System Innovation, 8(2), 52. https://doi.org/10.3390/asi8020052
Floris, G. (2025). ModSec-AdvLearn: Countering adversarial SQL injections with robust machine learning. IEEE Transactions on Information Forensics and Security, 20, 6693–6705. https://doi.org/10.1109/TIFS.2025.3583234
Irfa’issurur, M., & Josaphat, B. P. (2025). Machine Learning for Cybersecurity: Web Attack Detection (Brute Force, XSS, SQL Injection). InPrime: Indonesian Journal of Pure and Applied Mathematics, 7(1), 1–15. https://doi.org/10.15408/inprime.v7i1.41025
Kepuska, K., & Tomaševi?, M. (2024). A lightweight framework for cyber risk management in Western Balkan higher education institutions. PeerJ Computer Science, 10, e1958. https://doi.org/10.7717/peerj-cs.1958
Liu, Z., Fang, Y., Huang, C., & Xu, Y. (2023). MFXSS: An effective XSS vulnerability detection method in JavaScript based on multi-feature model. Computers & Security, 124, 103015. https://doi.org/10.1016/j.cose.2022.103015
Mani, K., & Shenoy, A. K. B. (2025). Machine learning models in web applications: A comprehensive review. ICT Express, 11(6), 1110–1119. https://doi.org/10.1016/j.icte.2025.09.001
Nair, S. S. (2024). Securing Against Advanced Cyber Threats: A Comprehensive Guide to Phishing, XSS, and SQL Injection Defense. Journal of Computer Science and Technology Studies, 6(1), 76–93. https://doi.org/10.32996/jcsts.2024.6.1.9
Paul, A., Sharma, V., & Olukoya, O. (2024). SQL injection attack: Detection, prioritization & prevention. Journal of Information Security and Applications, 85, 103871. https://doi.org/10.1016/j.jisa.2024.103871
Qin, Q., Li, Y., Mi, Y., Shen, J., Wu, K., & Wang, Z. (2024). Detecting XSS with Random Forest and multi-channel feature extraction. Computers, Materials & Continua, 80(1), 843–874. https://doi.org/10.32604/cmc.2024.051769
Rahayu, A., Yulyanti, E., & Ghalib, M. (2025). Systematic Literature Review: SQL Injection Detection Vulnerability Using Machine Learning. JURNAL MEDIA INFOTAMA, 21(1), 15–20. https://doi.org/10.37676/jmi.v21i1.6702
Ramadhan, R. F., & Ashari, W. M. (2024). Performance comparison of Random Forest and Decision Tree algorithms for anomaly detection in networks. Journal of Applied Informatics and Computing (JAIC), 8(2), 367–375.
Rodriguez Gavilanes, N. M., Loor Mendoza, B. D., & Llerena Guevara, L. A. (2025). Evaluación y mitigación de inyecciones SQL en aplicaciones web: Desarrollo de un prototipo. Latin-American Journal of Computing, 12(2), 13–25. https://doi.org/10.33333/lajc.vol12n2.01
Rosca, C.-M., Stancu, A., & Popescu, C. (2025). Machine Learning Models for SQL Injection Detection. Electronics, 14(17), 3420. https://doi.org/10.3390/electronics14173420
Santi, P. A. D. A., Afwani, R., Albar, M. A., Anjarwani, S. E., & Mardiansyah, A. Z. (2022). Black box testing with equivalence partitioning and boundary value analysis methods. 207–219. https://doi.org/10.2991/978-94-6463-084-8_19
Shaheed, A., & Kurdy, M. H. D. B. (2022). Web Application Firewall Using Machine Learning and Features Engineering. Security and Communication Networks, 2022, 1–14. https://doi.org/10.1155/2022/5280158
Sun, H., Du, Y., & Li, Q. (2023). Deep learning-based detection technology for SQL injection research and implementation. Applied Sciences, 13(16), 9466. https://doi.org/10.3390/app13169466
Tadhani, J. R., Vekariya, V., Sorathiya, V., Alshathri, S., & El-Shafai, W. (2024). Securing web applications against XSS and SQLi attacks using a novel deep learning approach. Scientific Reports, 14(1), 1803. https://doi.org/10.1038/s41598-023-48845-4
Younas, F., Raza, A., Thalji, N., Abualigah, L., Zitar, R. A., & Jia, H. (2024). An efficient artificial intelligence approach for early detection of cross-site scripting attacks. Decision Analytics Journal, 11, 100466. https://doi.org/10.1016/j.dajour.2024.100466
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Muhammad Zainuddin, Achmad Zakki Falani, Hariadi Yutanto

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.















