International Science and Technology Journal

Home < Articles < Article Details

Real-Time XSS attack detection based on an enhanced web application firewall through Deep Learning and LSTM-Integrated MoD Framework

الملخص
تستخدم معظم الخدمات الرقمية الحديثة تطبيقات الويب لخدمة عملائها بشكل مستمر، حيث يتم معالجة كميات كبيرة من المعلومات الحساسة في الوقت الفعلي. العديد من تهديدات الأمن السيبراني تُعَرض سرية ونزاهة وتوافر البيانات للخطر، مما يسبب خسائر مالية وعواقب قانونية. على سبيل المثال، يعد تهديد (XSS) السبب الجذري في 80٪ من خروقات البيانات عبر الإنترنت. يستغل XSS نقاط الضعف في تطبيقات الويب عن طريق حقن سكريبتات خبيثة في طلبات المستخدمين. غالبا ما تعتمد جدران الحماية التقليدية لتطبيقات الويب (WAFs) على أساليب ثابتة قائمة قد لا تكتشف أنماط هجوم XSS بفعالية في بيئات الويب الحديثة. تقدم هذه الدراسة نموذج WAF محسن يدمج نموذج التعلم العميق للذاكرة طويلة المدى قصيرة المدى (LSTM) كطبقة كشف ذكية لتقنية XSS تسمى XSSLayer موضوعة جنبا إلى جنب مع WAF التقليدي لتحسين قدراته على الكشف في الوقت الحقيقي. يقوم XSSLayer بتحليل جميع الطلبات الواردة ويحدد أنماط السكريبتات غير الطبيعية أو الخبيثة قبل توجيه إلى WAF، مما يمكن الجدار الناري من إعادة توجيه حركة المرور الصالحة فقط للوصول إلى خادم تطبيقات الويب. لذا، تعمل طبقة الكشف المعتمدة على LSTM و WAF بشكل تعاوني لاكتشاف وصد هجمات XSS بكفاءة. تم اختبار النظام المتكامل وتقييمه باستخدام عدة مقاييس أداء، بما في ذلك الدقة والفقدان. أظهرت النتائج التي تم الحصول عليها أن جدار الحماية المحسن لتطبيقات الويب (WAF)، مع ذاكرة طويلة المدى قصيرة المدمج (LSTM)، يمكنه تصنيف السكريبتات الخبيثة ضمن طلبات الويب، في حين بلغت دقة التدريب حوالي 98.0٪ ودقة التحقق حوالي 99.4٪. بالإضافة إلى ذلك، أظهرت النتائج فقدان تحقق حوالي 0.02، مما يشير إلى موثوقية تنبؤية عالية وخطأ توقع بسيط. كما أظهر تحليل مصفوفة الالتباس فقط 25 إيجابية كاذبة من أصل 2,600 طلب حميد و11 سلبيا كاذبة من أصل 2,137 حالة هجوم، مما يدل على قدرة النموذج القوية على التمييز الخاص. علاوة على ذلك، تشير النتائج التي تم الحصول عليها من الدقة، والاستدعاء، ودرجة F1 إلى أن النموذج يظهر قدرة استثنائية، مع أداء شبه مثالي في اكتشاف هجمات XSS باستخدام بنية LSTM في الوقت الحقيقي. علماً بأن دمج نموذج XSSLayer مع جدار الحماية ModSecurity إلى زيادة إضافية في حجم العمليات الحسابية وزيادة طفيفة في وقت الرد والذاكرة المستخدمة وكذلك زيادة استخدام في سعة المعالجة المركزية. ومع ذلك، توفر النتائج أدلة قوية على أن دمج نماذج التعلم العميق LSTM مع أنظمة WAF التقليدية يعزز بشكل كبير قدرة اكتشاف هجمات XSS في الوقت الحقيقي مقارنة بنظام WAF التقليدي..................... الكلمات المفتاحية:..................جدار حماية تطبيقات الويب WAF، التعلم العميق، اكتشاف الهجمات، جدار الحماية، وXSS
Abstract
Most modern digital services utilize web applications to serve their clients continuously; whereby large amounts of sensitive information are processed in real time. Many cybersecurity threats compromise confidentiality, integrity, and availability, causing financial losses and legal consequences. For instance, Cross-Site Scripting (XSS) is the root cause of 80% of online data breaches. The XSS exploit weaknesses in web applications by injecting malicious scripts into user requests. However, Traditional Web Application Firewalls (WAFs) often rely on static rule-based approaches that may not effectively detect XSS attack patterns in modern web environments. This study proposes an enhanced WAF that integrates a deep learning Long Short-Term Memory (LSTM) model as an intelligent XSS detection layer named XSSLayer positioned alongside the traditional WAF for improving its real-time detection capabilities. The XSSLayer analyzes all incoming requests and identifies abnormal or malicious script patterns before forwarding the analysis results to the WAF, enabling the firewall to forward only valid traffic to reach the web application server. Thus, the LSTM-based detection layer and the WAF collaboratively operate to detect and block XSS attacks efficiently. The integrated system was tested and evaluated using several performance metrics, including accuracy and loss. The obtained results showed that the enhanced Web Application Firewall (WAF), with an integrated Long Short-Term Memory (LSTM), can classify malicious scripts within web requests, whereas the training accuracy reached approximately 98.0% and the validation accuracy was about 99.4%. In addition, the results showed a validation loss of about 0.02, that indicate a high predictive reliability and minimal prediction error. The confusion matrix analysis showed only 25 false positives out of 2,600 benign requests and 11 false negatives out of 2,137 attack instances, which indicates the model's robust discriminative capacity. Furthermore, the obtained results of precision, recall, and the F1‑score indicate that the model shows an exceptional capability, with nearly perfect performance in detecting XSS attacks using the LSTM architecture in real-time. However, integrating the XSS model with the ModSecurity firewall introduced additional computational overhead and slightly increased reply time, memory, and CPU usage. However, the findings provide strong evidence that integrating LSTM deep learning models with traditional WAF systems substantially enhances the capability of detecting XSS attacks in real-time compared to conventional WAF. .................. Keywords: ...............Web Application Firewall, Deep Learning, Attack Detection, Firewall, and XSS.