[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-119281-en":3,"doc-seo-119281-105":29,"detail-sidebar-cat-0-en-105":90},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":11,"language":21,"language_code":22,"site_id":23,"html_lang":22,"table_of_contents":24,"faqs":25,"seo_title":26,"seo_description":14,"update_tm":27,"read_time":28},119281,7971461740909,"Levi","https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d",8,"Research & Report","Comparative Analysis of Machine Learning Algorithms for Cross-Site Scripting (XSS) Attack Detection","Cross-Site Scripting (XSS) attacks exploit weaknesses in web applications to inject and execute malicious scripts, creating a serious cybersecurity risk. Traditional XSS detection struggles to keep up with increasingly complex payloads. This research evaluates four machine learning algorithms—XGBoost, Random Forest (RF), K-Nearest Neighbors (KNN), and Support Vector Machine (SVM)—through comparative analysis. Model performance is measured using confusion matrices, 10-fold cross-validation, and training-time assessment, leveraging dataset characteristics to identify the most robust solution. Results show Random Forest achieves 99.93% accuracy with strong balanced metrics, supporting reliable defenses against evolving XSS threats.","INTERNATIONAL JOURNAL ON INFORMATICS VISUALIZATION  \n[journal homepage : www.joiv.org/index.php/joiv](journal homepage : www.joiv.org/index.php/joiv)  \nComparative Analysis of Machine Learning Algorithms for Cross-Site  \nScripting (XSS) Attack Detection  \nKhairatun Hisan Hamzaha, Mohd Zamri Osmana,* , Tumusiime Anthony a, Mohd Arfian Ismail b,  \nZubaile Abdullah c, Alde Alandad  \na Faculty of Computing, Universiti Teknologi Malaysia, Skudai, Johor Bahru, Malaysia b Faculty of Computing, Universiti Malaysia Pahang Al-Sultan Abdullah, Pekan, Pahang, Malaysia c Faculty of Computer Science and Information Technology, Universiti Tun Hussein Onn Malaysia, Parit Raja, Johor, Malaysia d Department of Information Technology, Politeknik Negeri Padang, Padang, Indonesia  \nCorresponding author:*[mohdzamri.osman@utm.my](mohdzamri.osman@utm.my)  \nAbstract—Cross-Site Scripting (XSS) attacks pose a significant cybersecurity threat by exploiting vulnerabilities in web applications to inject malicious scripts, enabling unauthorized access and execution of malicious code. Traditional XSS detection systems often struggle to identify increasingly complex XSS payloads. To address this issue, this research evaluated the efficacy of Machine Learning algorithms in detecting XSS threats within online web applications. The study conducts a comprehensive comparative analysis of XSS attack detection using four prominent Machine Learning algorithms, which consist of Extreme Gradient Boosting (XGBoost), Random Forest (RF), K-Nearest Neighbors (KNN), and Support Vector Machine (SVM). This research utilizes a comparative methodology to assess the selected Machine Learning algorithms by analyzing their performance metrics, including confusion matrix, 10-fold crossvalidation, and assessment of training time to thoroughly evaluate the models. By exploring dataset characteristics and evaluating the performance metrics of each selected algorithm, the study determined the most robust Machine Learning solution for XSS detection. Results indicate that Random Forest is the top performer, achieving 99.93% accuracy and balanced metrics across all criteria evaluated. These findings will significantly enhance web application security by providing reliable defenses against evolving XSS threats.  \nKeywords—Cross Site Scripting (XSS); machine learning; RF; XGBoost; KNN; SVM; cybersecurity; web application security.  \nManuscript received 5 Mar. 2024; revised 17 Jul. 2024; accepted 24 Sep. 2024. Date of publication 30 Nov. 2024.  \nInternational Journal on Informatics Visualization is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.  \nI. INTRODUCTION  \nCross-site scripting (XSS) remains a challenging threat in cybersecurity, exploiting vulnerabilities in online web applications to inject malicious scripts into web pages. XSS is a web security vulnerability where attackers inject malicious scripts into trusted websites, exploiting the site's failure to validate or encode user input properly. This poses a significant risk to users, enabling attackers to gain unauthorized access to sensitive information and execute malicious code. The traditional XSS detection system needs to be improved, considering the increasingly diverse forms of XSS payloads [2]. OWASP's 2021 report indicates that 94% of the applications tested are susceptible to injection vulnerabilities, with 33 Common Weakness Enumerations (CWEs) falling into this category [1] . Traditional methods for detecting cross-site scripting (XSS) focus on signature-based approaches, which involve investigating known attack  \npatterns. As a result, online web applications and users that utilize traditional methods are left vulnerable. This calls for a dynamic and adaptive solution that can overcome the constantly evolving payloads of XSS.  \nThis research implemented a machine learning (ML) approach to XSS detection to address the increasing complexity of XSS payloads. The study focuses on utilizi","cbCaidIOf5bMcHJZ","https://ap.wps.com/l/cbCaidIOf5bMcHJZ","pdf",3722649,1,"English","en",105,"# Introduction\n## Type of XSS Attack\n## XSS Detection Model Machine Learning-based","[{\"question\":\"Why are XSS attacks considered a significant cybersecurity threat?\",\"answer\":\"XSS attacks exploit vulnerabilities in web applications to inject and execute malicious scripts, enabling unauthorized access and harmful code execution.\"},{\"question\":\"Which machine learning algorithms were compared for XSS attack detection?\",\"answer\":\"The study compares Extreme Gradient Boosting (XGBoost), Random Forest (RF), K-Nearest Neighbors (KNN), and Support Vector Machine (SVM).\"},{\"question\":\"What evaluation metrics were used to compare the models?\",\"answer\":\"Performance was assessed using a confusion matrix, 10-fold cross-validation, and training time.\"}]","Comparative Analysis of Machine Learning Algorithms for Cross-Site Scripting (XSS) Attack Detection | PDF",1785723491,20,{"code":4,"msg":30,"data":31},"ok",{"site_id":23,"language":22,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":85,"head_meta":87,"extra_data":89,"updated_unix":27},"comparative-analysis-of-machine-learning-algorithms-for-cross-site-scripting-xss-attack-detection","",{"@graph":35,"@context":84},[36,53,67],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/comparative-analysis-of-machine-learning-algorithms-for-cross-site-scripting-xss-attack-detection/119281/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":22,"description":14,"dateModified":61,"datePublished":61,"encodingFormat":60,"isAccessibleForFree":62,"interactionStatistic":63},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-08-03",true,{"@type":64,"interactionType":65,"userInteractionCount":4},"InteractionCounter",{"@type":66},"ViewAction",{"@type":68,"mainEntity":69},"FAQPage",[70,76,80],{"name":71,"@type":72,"acceptedAnswer":73},"Why are XSS attacks considered a significant cybersecurity threat?","Question",{"text":74,"@type":75},"XSS attacks exploit vulnerabilities in web applications to inject and execute malicious scripts, enabling unauthorized access and harmful code execution.","Answer",{"name":77,"@type":72,"acceptedAnswer":78},"Which machine learning algorithms were compared for XSS attack detection?",{"text":79,"@type":75},"The study compares Extreme Gradient Boosting (XGBoost), Random Forest (RF), K-Nearest Neighbors (KNN), and Support Vector Machine (SVM).",{"name":81,"@type":72,"acceptedAnswer":82},"What evaluation metrics were used to compare the models?",{"text":83,"@type":75},"Performance was assessed using a confusion matrix, 10-fold cross-validation, and training time.","https://schema.org",{"og:url":51,"og:type":86,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":88,"canonical":51},"index,follow",{"doc_id":7,"site_id":23},{"code":4,"msg":5,"data":91},[92,96,100,104,109,114,119,122,126,129,133],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":93,"show_sort_weight":94,"slug":95},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":97,"show_sort_weight":98,"slug":99},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":101,"show_sort_weight":102,"slug":103},"Exam",70,"exam",{"id":105,"doc_module":4,"doc_module_name":45,"category_name":106,"show_sort_weight":107,"slug":108},5,"Comic",60,"comic",{"id":110,"doc_module":4,"doc_module_name":45,"category_name":111,"show_sort_weight":112,"slug":113},6,"Technology",50,"technology",{"id":115,"doc_module":4,"doc_module_name":45,"category_name":116,"show_sort_weight":117,"slug":118},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":120,"slug":121},30,"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":28,"slug":125},9,"Religion & Spirituality","religion-spirituality",{"id":28,"doc_module":4,"doc_module_name":45,"category_name":127,"show_sort_weight":28,"slug":128},"World Cup","world-cup",{"id":130,"doc_module":4,"doc_module_name":45,"category_name":131,"show_sort_weight":130,"slug":132},10,"Lifestyle","lifestyle",{"id":134,"doc_module":4,"doc_module_name":45,"category_name":135,"show_sort_weight":105,"slug":136},19,"General","general"]