Contextual Detection of Cross-Site Scripting Attacks Using RoBERTa-Based Deep Learning Model

Authors

  • Thamer Almansour College of Computing and Informatics, Saudi Electronic University, Riyadh, Saudi Arabia
  • Marwah M. Almasri College of Computing and Informatics, Saudi Electronic University, Riyadh, Saudi Arabia
  • Shimaa A. Nagro College of Computing and Informatics, Saudi Electronic University, Riyadh, Saudi Arabia https://orcid.org/0000-0002-4601-9423

DOI:

https://doi.org/10.19139/soic-2310-5070-3291

Keywords:

Cross-Site Scripting, RoBERTa, Transformer Models, Machine Learning, Deep Learning

Abstract

As internet usage grows, web applications remain vulnerable to Cross-Site Scripting attacks, in which malicious actors construct malicious scripts via user input, posing major threats to data security and program integrity. This paper presents a contextual detection method of cross-site scripting attacks using a RoBERTa based deep learning model, which uses advanced natural language understanding to observe payload patterns. The model's ability to understand contextual relationships reduces the need for manual feature engineering, resulting in a reliable solution for detecting both basic and sophisticated obfuscated assaults. To improve the model's contextual learning capabilities, the proposed methodology included carefully dataset selection and preprocessing procedures such as decoding, tokenization, and the removal of redundant patterns. The model underwent specialized fine-tuning using a balanced dataset of benign and malicious payloads. The results of the research show outstanding performance, with the model obtaining 99.38% accuracy and a false positive rate of 0.71%. These results indicate the model's ability to accurately detect different Cross-Site Scripting payloads while minimizing false detections. The findings make major contributions to web security by providing a highly accurate detection method for one of the most popular cybersecurity threats, laying the groundwork for future advances in automated threat detection.

Downloads

Published

2026-05-31

How to Cite

Almansour, T. ., Almasri, M. M., & Nagro, S. A. (2026). Contextual Detection of Cross-Site Scripting Attacks Using RoBERTa-Based Deep Learning Model. Statistics, Optimization & Information Computing. https://doi.org/10.19139/soic-2310-5070-3291

Issue

Section

Research Articles