Introduction
-
Automated feature extraction: This study proposes an improved network model structure to automate the process of feature extraction, thereby enhancing the efficiency and effectiveness of XSS detection.
-
Detection of complex obfuscation techniques: Recognizing the increasing complexity of obfuscation techniques employed in XSS attacks, this article introduces advanced mechanisms to detect and decipher these techniques, resulting in improved accuracy in XSS detection.
-
Optimization of semantic features: This article emphasizes the importance of further exploration and refinement of semantic features in XSS detection. By leveraging a multi-attention mechanism, the proposed model extracts distinctive characteristics from different feature subspaces, enabling a better understanding of textual context and enhancing the detection of XSS attacks.
Preparatory knowledge
LSTM
Attention mechanism
The model of detection
The structure of the model
(1) Input layer
(2) Embedding layer
(3) Bi-LSTM layer
(4) Multi-head attention layer
(5) Global average pooling layer
(6) Dropout layer
(7) Output layer
Algorithm design
Experimental results and analysis
Experimental environment
Experimental data
Label | Category | Training set | Test set | Total |
---|---|---|---|---|
1 | XSS | 59250 | 14813 | 74063 |
0 | Normal | 25126 | 6281 | 31407 |
Experimental evaluation indicators
Experimental data processing
(1) Clean the collected data
(2) Perform word segmentation processing on the cleaned data
(3) Vectorize the segmented data
Experimental result
(1) Multiple-head attention mechanism (MHAM) layer evaluation experiment
(2) Vector dimension comparison experiment
(3) Evaluation experiment of global average pooling layer
Number of heads | Precision | Recall | F1-score |
---|---|---|---|
1 | 98.99% | 97.81% | 98.39% |
2 | 99.17% | 98.02% | 98.59% |
4 | 99.32% | 98.11% | 98.71% |
8 | 99.33% | 98.03% | 98.67% |
16 | 99.08% | 97.94% | 98.50% |
32 | 98.72% | 97.38% | 98.04% |
Comparative experimental methods and evaluation
(1) Traditional machine learning
Model name | Precision | Recall | F1-score |
---|---|---|---|
CMABLSTM | 99.32% | 98.11% | 98.71% |
XGBoost | 94.92% | 93.40% | 94.15% |
SVM | 94.33% | 90.26% | 92.30% |
(2) Deep learning model
Model name | Precision | Recall | F1-score |
---|---|---|---|
CMABLSTM | 99.32% | 98.11% | 98.71% |
MABLSTM | 99.02% | 97.99% | 98.50% |
ABLSTM | 98.90% | 97.03% | 97.95% |
LSTM | 97.31% | 96.08% | 96.69% |
BLSTM | 98.36% | 96.21% | 97.27% |