XSS attack detection method based on deep learning ensemble model and AdaBoost

By combining a deep learning ensemble model with AdaBoost, and using CNN-LSTM and Transformer to extract features, and then performing AdaBoost weighted fusion, the problem of large feature extraction workload and insufficient model optimization in existing XSS detection methods is solved, and high-accuracy XSS attack detection is achieved.

CN119577782BActive Publication Date: 2025-10-28XIAN UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411658062.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-10-28
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

Existing XSS attack detection methods suffer from problems such as the large workload and strong subjectivity of manual feature extraction required by single-base classifiers, and insufficient optimization of deep learning models when facing new types of attacks.

Method used

By combining deep learning ensemble models with AdaBoost, features are extracted using CNN-LSTM and Transformer models, and weighted fusion is performed using the AdaBoost classifier to optimize the detection model.

Benefits of technology

It improved the accuracy of XSS attack detection to 99.49%, enhancing the robustness and classification accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119577782B_ABST
    Figure CN119577782B_ABST
Patent Text Reader

Abstract

The XSS attack detection method based on deep learning ensemble model and AdaBoost includes the following steps: Step 1, preprocessing; Step 2, constructing a deep learning ensemble model; Step 3, using the deep learning ensemble model constructed in Step 2 for detection; AdaBoost can significantly enhance the classification ability of deep learning models, achieving an accuracy of 99.49%, and can better defend against XSS attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, specifically relating to an XSS attack detection method based on a deep learning ensemble model and AdaBoost. Background Technology

[0002] With the continuous development of Web technology, it has become an important means for enterprises and government agencies to simplify operations, improve service quality and reach a wider audience through the Internet. According to data from the Open Web Application Security Project (OWASP), since 2004, 2007, 2010, 2013, 2017 and 2021, XSS has ranked 4th, 4th, 1st, 3rd, 7th and 3rd in the top ten Web application security risks in the world, respectively [1]. Recent studies have shown that artificial intelligence (AI) technologies, such as machine learning (e.g., decision tree (DT), random forest (RF), support vector machine (SVM) etc.) and deep learning (e.g., convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory (LSTM) etc.) [2] (ML / DL-based technologies) can improve the detection of XSS attacks and overcome the problems that hinder traditional XSS attack detection methods, including input validation, static analysis and dynamic analysis [3]-[4]. However, research indicates that XSS attack detection suffers from issues such as single-base classifiers, small datasets, and imbalanced datasets. Ensemble learning methods, due to their ability to balance datasets, perform better in detecting XSS attacks and security vectors. Cross-site scripting (XSS) remains a significant risk to web applications, allowing attackers to execute malicious scripts in users' browsers, stealing sensitive information such as account credentials and personal data. This not only harms individual user security but can also damage corporate reputation and cause financial losses. Currently, most XSS attack detection methods rely on deep learning models and their variants, with a focus on modifying these models while neglecting the fact that combining the strengths of various models is also a way to improve accuracy.

[0003] Cross-site scripting (XSS) is a JavaScript code injection attack that allows attackers to execute injected JavaScript in a victim's web browser to access sensitive information such as cookies, passwords, and credit card numbers. XSS vulnerabilities can be divided into two main categories: client-side XSS vulnerabilities and server-side XSS vulnerabilities.

[0004] Early researchers analyzed the source code of web applications using static analysis techniques to determine the presence of XSS vulnerabilities. Static analysis methods have the advantage of utilizing source code and are highly efficient, but they also carry the risk of false positives and false negatives. Dynamic analysis methods simulate actual attacker behavior to attack the target. The advantage of this method is its high accuracy in XSS detection, and it does not require access to the source code. However, the attack vectors used by dynamic analysis methods have many limitations, and different types of attack vectors can significantly affect the detection results.

[0005] To address the challenges of static and dynamic XSS detection, some experts and scholars have proposed machine learning-based XSS detection methods, driven by the development of machine learning technology.

[0006] Similarly, there are ensemble methods for XSS attack detection based on supervised ensemble learning, among which AdaBoost achieved an accuracy of 99.8% in detecting XSS attacks. However, these methods have the drawback of requiring manual feature extraction, which is not only labor-intensive but also highly subjective.

[0007] Deep learning, through feature extraction algorithms, can automatically capture and learn text features, effectively overcoming the shortcomings of traditional machine learning. Compared with traditional methods, deep learning-based XSS detection technology has automation capabilities, high detection accuracy, and a low false alarm rate.

[0008] Some common deep learning models, such as Long Short-Term Memory (LSTM) recurrent neural networks, have achieved an accuracy of 99.25% in detecting XSS attacks. The combination of convolutional neural networks (CNN) and LSTM has achieved an accuracy of 99.4% in detecting XSS attacks. The combination of LSTM model and attention mechanism has achieved an accuracy of 99.11% in detecting XSS attacks.

[0009] However, as attackers continue to innovate their techniques to evade XSS detectors, the main challenge facing current research is how to further optimize deep learning models to effectively identify new XSS attack methods. Summary of the Invention

[0010] To overcome the shortcomings of the prior art, the purpose of this invention is to provide an XSS attack detection method based on a deep learning ensemble model and AdaBoost. By combining a deep learning model with the ensemble learning method AdaBoost, it can effectively detect XSS attacks and has the characteristics of high feature representation ability and high classification accuracy.

[0011] To achieve the above objectives, the technical solution adopted by this invention is: an XSS attack detection method based on a deep learning ensemble model and AdaBoost, comprising the following steps:

[0012] Step 1, Preprocessing

[0013] Data collection involves using web crawling technology to capture malicious samples as positive samples and normal samples from the DMOZ database as negative samples.

[0014] For data processing, the Word2Vec model was used to train the vocabulary to obtain word vectors. The vectors were then visualized by tsne dimensionality reduction. The first 100 words were reduced from 128 dimensions to 2 dimensions and then plotted.

[0015] All positive and negative samples were normalized, removing host and path information from the URLs, retaining only the malicious attack payload, and the links were replaced with... http: / / u The above data is URL-encoded and saved in a CSV file;

[0016] All positive and negative samples will be segmented into words. Unlike ordinary text, positive and negative samples include HTML tags, function bodies, parameter names, and other programming language elements. Therefore, special segmentation rules need to be specified. The following rules will be treated as a single word and enclosed in single quotes:

[0017] 1) HTTP / HTTPS links

[0018] 2) HTML tags <script>

[0019] 3)html标签开头<h1

[0020] 4)参数名topic=

[0021] 5)函数体alert(

[0022] 6)字符数字组成的混合字符串;

[0023] 通过建立好的词向量模型,即可用空间向量表示一个文本;

[0024] 步骤2,构建深度学习集成模型,具体做法是:

[0025] CNN-LSTM模型:首先使用Conv1d进行提取特征,ReLU激活和MaxPool1d降维;随后将卷积后的输出传入LSTM层,捕捉时间序列依赖;最后通过全连接层输出分类结果;

[0026] Transformer模型:首先将CNN-LSTM模型的输出结果作为输入,转化为高维词向量表示;随后将高维词向量通过嵌入层生成嵌入向量,并为此嵌入向量添加位置编码;接着构建自注意力机制,即计算输入序列中每个位置的注意力权重,并通过多个头来并行处理信息;然后将多层自注意力编码器堆叠,处理嵌入向量的依赖关系;最后将经过以上步骤处理后的嵌入向量通过全连接层进行映射,得到最终的分类结果;

[0027] 集成模型:首先将CNN-LSTM模型和Transformer模型的输出拼接,对这两个模型进行训练;然后通过全连接层进行分类预测;

[0028] 特征提取:通过定义好的特征提取函数提取训练完成的集成模型中数据的特征和标签;

[0029] AdaBoost分类器:首先使用提取的特征和标签,训练AdaBoost分类器,然后通过AdaBoost对提取的数据特征进行进一步的分类和预测;

[0030] 步骤3,用步骤2构建的深度学习集成模型对所有的正样本和负样本进行检测,验证模型的准确率和性能。

[0031] 所述的步骤3,具体又包括以下步骤:

[0032] 步骤3-1,将步骤1预处理后的数据分别输入CNN-LSTM和Transformer模型中,CNN先提取局部特征,再输入LSTM提取全局特征;Transformer模型内部应用位置编码模块和注意力机制进行并行训练,且都输出各自的分类结果,Transformer模型内部应用位置编码模块为序列中的每个位置添加一个唯一的编码,帮助模型识别序列中的位置信息;

[0033] 步骤3-2,Transformer模型内部应用位置编码模块和注意力机制将各自的输出进行特征合并,即将位置编码模型和注意力机制的输出在特征维度上进行拼接,形成一个更为丰富的特征向量,且这个合并后的特征向量包含了从位置编码模型和注意力机制的输出学习到的局部和全局信息;然后通过全连接层对合并后的特征进行进一步的分类决策;

[0034] 步骤3-3,在步骤3-2得到的合并特征向量的基础上,引入AdaBoost分类器进行进一步的训练,它能够通过构建多个弱分类器并加权组合来增强分类性能,即AdaBoost通过对CNN-LSTM和Transformer的输出进行加权融合,能够进一步提高分类器的鲁棒性和准确性,其中准确性达到了99.49%。

[0035] 本发明的有益效果是:

[0036] 本发明将深度学习模型CNN,LSTM和Transformer这三个经典模型集成,以提取攻击数据特征,然后借助AdaBoost的分类优势,对集成模型进行优化,进一步提升检测精度。

[0037] 本发明将现有的深度学习基准模型与AdaBoost进行结合比较,实验表明本发明提出的模型在检测XSS攻击的准确率方面取得了较好的成效。

[0038] 采用了词向量索引技术对XSS数据和正常数据进行数据预处理,提升了模型区分攻击语句和正常语句的能力。

[0039] 对于XSS攻击,本发明提将深度学习模型和集成学习算法AdaBoost相结合的模型。首先,利用Word2Vec模型对文本数据进行词嵌入训练,以生成高质量的词向量表示。接着,实现系统的数据预处理步骤,以确保数据的有效性和一致性。随后,将训练得到的词向量输入到深度学习集成模型中,以进行特征提取与建模。最后,采用AdaBoost分类器对深度学习模型的输出进行进一步的分类和优化,从而提升整体分类性能。这一方法论为研究提供了可靠的基础,结合了深度学习与集成学习的优势,旨在提高分类精度。通过大量的实验和评估之后,本发明提出的模型最终达到了99.49%的准确率。实验结果表明本发明的模型对于检测XSS攻击具有更好的性能和优势。附图说明

[0040] 图1为本发明词向量降维可视化散点图。

[0041] 图2为本发明数据预处理流程图。

[0042] 图3为本发明的核心模型架构图。

[0043] 图4为本发明训练准确率变化图。

[0044] 图5为本发明核心模型准确率对比图。具体实施方式

[0045] 下面结合附图和实施例对本发明作进一步详细说明。

[0046] 参见图1-3,基于深度学习集成模型与AdaBoost的XSS攻击检测方法,包括以下步骤:

[0047] 步骤1,预处理

[0048] 数据收集,用网络爬虫技术抓取其中的恶意样本作为正样本,以DMOZ数据库中的正常样本作为负样本;Xssed.com是当前最广泛的XSS漏洞收集平台,,基本覆盖了常见的XSS攻击语句类型,并包含了多种变形形式;

[0049] 数据处理,使用Word2Vec模型对词汇进行训练,得到词向量,通过tsne降维可视化,取前100个从128维降到2维并绘图表示;(参见图1)

[0050] 对所有的正样本和负样本进行数据范化处理,去除url中的host、path信息,仅保留恶意攻击payload的部分,并将链接替换为http: / / u,以上数据url编码后保存在csv文件中;

[0051] 将所有正样本和负样本进行分词操作,不同于普通语句文本,实验正样本、负样本包括html标签、函数体、参数名等编程语言,所以需要指定特殊的分词规则,以下规则将会被视作一个单词,使用单引号划分:

[0052] 1)http / https链接

[0053] 2)html标签<script>

[0054] 3)html标签开头<h1

[0055] 4)参数名topic=

[0056] 5)函数体alert(

[0057] 6)字符数字组成的混合字符串;

[0058] 通过建立好的词向量模型,即可用空间向量表示一个文本;数据预处理流程如图2所示;

[0059] 步骤2,构建深度学习集成模型,具体做法是:

[0060] CNN-LSTM模型:首先使用Conv1d进行提取特征,ReLU激活和MaxPool1d降维;随后将卷积后的输出传入LSTM层,捕捉时间序列依赖;最后通过全连接层输出分类结果;

[0061] Transformer模型:首先将CNN-LSTM模型的输出结果作为输入,转化为高维词向量表示;随后将高维词向量通过嵌入层生成嵌入向量,并为此嵌入向量添加位置编码;接着构建自注意力机制,即计算输入序列中每个位置的注意力权重,并通过多个头来并行处理信息;然后将多层自注意力编码器堆叠,处理嵌入向量的依赖关系;最后将经过以上步骤处理后的嵌入向量通过全连接层进行映射,得到最终的分类结果;

[0062] 集成模型:首先将CNN-LSTM模型和Transformer模型的输出拼接,对这两个模型进行训练;然后通过全连接层进行分类预测;

[0063] 特征提取:通过定义好的特征提取函数提取训练完成的集成模型中数据的特征和标签;

[0064] AdaBoost分类器:首先使用提取的特征和标签,训练AdaBoost分类器,然后通过AdaBoost对提取的数据特征进行进一步的分类和预测;

[0065] XSS(跨站脚本攻击)通常涉及对Web请求、URLs、表单输入等文本数据的分析,包含具有特定模式的恶意脚本,例如特定的标签、属性或JavaScript代码片段。CNN能够有效识别这些局部的文本特征,这对于初步筛选潜在的XSS攻击尤为重要。但也存在一些复杂的XSS攻击可能不仅仅依赖于简单的脚本片段,而是涉及更长的脚本和对目标应用逻辑的深入利用。LSTM能够学习和记忆这种长期的、上下文相关的依赖性,对于识别这类复杂的XSS攻击模式十分关键。然而虽然LSTM能够处理长期依赖关系,但其能力受限于逐步传递的隐藏状态。Transformer利用自注意力机制,可以直接比较并关联序列中的任意位置,而无需依赖多步的时间传递。还可以在整个序列中建立复杂的、多层次的关系,这对于理解复杂的语义结构和语境非常有帮助,使得模型能够更全面和深入地理解全局上下文,从而提高检测的准确率和复杂攻击的覆盖范围。

[0066] 而由于检测XSS攻击通常是一个不平衡的分类问题,即正常数据可能远多于XSS攻击数据或者相反,且深度学习模型在达到较高的准确率后,进一步提升性能会变得更加困难。一种集成学习方法AdaBoost,通过结合多个"弱学习器”来构建一个强大的分类器,重点关注分类错误的样本,可以改善模型在不平衡数据集上的表现,从而提高准确率。因此将深度学习模型提取到的特征结合AdaBoost方法,对特征进行进一步的分类,增强分类的准确性和鲁棒性。

[0067] CNN架构:CNN的结构受到人类和动物大脑中神经元的启发,类似于传统的神经网络。CNN有三个主要优点:等效表示,稀疏交互和参数共享

[19] 。CNN架构通过多层卷积、池化和全连接层,利用权重共享和局部连接自动提取图像特征,以实现高效的视觉识别和分类。

[0068] 对于1维CNN,计算公式如下,其中x是输入,n是输入长度,k是内核长度,h是内核,s是步幅数,y是输出):

[0069]

[0070] 步骤3,用步骤2构建的深度学习集成模型进行检测,具体做法是:

[0071] 3-1,将步骤1预处理后的数据分别输入CNN-LSTM和Transformer模型中,CNN先提取局部特征,再输入LSTM提取全局特征;Transformer模型内部应用位置编码模块和注意力机制进行并行训练,且都输出各自的分类结果,Transformer模型内部应用位置编码模块为序列中的每个位置添加一个唯一的编码,帮助模型识别序列中的位置信息;注意力机制包括8头自注意力机制及两个编码层;

[0072] 自注意力机制:自注意力机制通过允许模型在序列的不同部分之间建立直接联系,从而捕捉长距离依赖关系。这种机制包括缩放点积注意力和多头注意力,其中缩放点积注意力通过计算查询与所有键的点积,除以键的维度的平方根,再应用softmax函数来获得权重。多头注意力则将查询、键和值通过不同的线性投影分成多个头,并行执行注意力函数,然后将结果拼接起来。这种设计使得模型能够从不同的表示子空间中同时关注序列的不同位置,提高了模型的表达能力。此外,位置编码的引入使得模型能够理解序列中词汇的顺序信息。自注意力机制的这些特性使得Transformer模型在处理序列数据时更为高效和有效;

[0073] LSTM架构:长短记忆神经网络LSTM(Long Short-Term Memory Network)是RNN的一种优化网络,LSTM神经单元内添加多个门计算与新的变量从而解决RNN存在的梯度消失问题。每个门计算单元的输入与控制信号都来自上一次神经元的输出,保持了RNN的基本特征。给定时间步t的输入Xt和先前的隐藏状态ht-1和先前的单元状态Ct-1,在LSTM单元中执行的计算由以下等式描述:

[0074] 遗忘门:

[0075] ft=σ(Wfht-1+Ufxt+bf) (2)

[0076] 输入门:

[0077] it=σ(Wiht-1+Uixt+bi) (3)

[0078]

[0079] 细胞状态更新:

[0080]

[0081] 输出门:

[0082] ot=sigmoid(Wo⊙[ht-1,xt]+bo) (6)

[0083] ht=ot⊙tanh(Ct) (7)

[0084] Wf、Wi、Wc和Wo分别是与遗忘门、输入门、候选单元状态和输出门相关联的权重矩阵,bf、bi、bc和bo是偏置项。

[0085] 步骤3-2,Transformer模型内部应用位置编码模块和注意力机制将各自的输出进行特征合并,即将位置编码模型和注意力机制的输出在特征维度上进行拼接,形成一个更为丰富的特征向量,且这个合并后的特征向量包含了从位置编码模型和注意力机制的输出学习到的局部和全局信息;然后通过全连接层对合并后的特征进行进一步的分类决策;

[0086] 步骤3-3,在步骤3-2得到的合并特征向量的基础上,引入AdaBoost分类器进行进一步的训练,它能够通过构建多个弱分类器并加权组合来增强分类性能,即AdaBoost通过对CNN-LSTM和Transformer的输出进行加权融合,能够进一步提高分类器的鲁棒性和准确性,其中准确性达到了99.49%。

[0087] AdaBoost分类器

[0088] AdaBoost算法是一种著名的提升(Boosting)集成学习方法,它通过迭代训练多个弱分类器(通常为基础的决策树),并将它们组合成一个强分类器来提高模型的性能。在每次迭代中,AdaBoost会根据前一个分类器的表现调整训练样本的权重,使得错误分类的样本获得更高的权重,从而让后续的分类器更加关注这些样本。每个分类器的权重由其在训练集上的错误率决定,错误率越低,权重越大。最终,所有分类器的加权投票结果作为模型的预测输出,模型准确率达到99.49%。

[0089] 实施例

[0090] 数据集:

[0091] 恶意XSS攻击数据集从知名XSS注入攻击案例网站www.xssed.com爬取,恶意XSS攻击样本30110条语句,作为正样本,基本涵盖了常见的XSS攻击语句类型和较为丰富的变形种类。以DMOZ数据库中的正常样本作为负样本,共获得34500个正常样本。最后将所有数据随机分为70%训练数据和30%测试数据,如表I所示。

[0092] 表I数据集分布表

[0093]

[0094] 将现有的几种先进研究方法选取相同的数据集与本实施例提出的模型进行比较。分别是:LSTM模型(Hakim,Naufal Ahmad Nur,Vera S uryani,and Muhamad Irsan."Detection of Cross-Site Scripting Attacks on Web Applications Using the LSTMMethod."2024 12th Internationa l Conference on Information and CommunicationTechnology(ICoICT),IEEE,2024,pp.432-437),CNN-LSTM模型(Kadhim,Raed Wahee d,andMethaq Talib Gaata."A hybrid of CNN and LSTM methods fo r securing webapplication against cross-site scripting attack."Indonesia n Journal ofElectrical Engineering and Computer Science,vol.21,no.2,2021,pp.1022-1029)以及LSTM-Attention模型(Et-tolba,Maryam,Charifa Hanin,and Abdelhamid Belmekki."DL-based XSS Attack Det ection Approach using LSTM Neural Network with WordEmbeddings."2024IEEE,2024,pp.979-8-3503-7786-6 / 24 / $31.00)。

[0095] 本实施例使用准确率、精确度、召回率和F1指标进行模型评估。准确率ACC为正确分类的样本占总样本的比例;精确度P为预测为恶意语句的样本中,实际为正类的占比;召回率R为实际为恶意语句的样本中,正确预测为恶意语句所占的比例;F1指标为精确率和召回率的调和平均数,是模型评价的重要得分指标,精确度P为预测为恶意语句的样本中,实际为正类的占比。其中TP(True Positive,真阳性)表示实际为正类的样本被正确地分类为正类的数量;TN(True Negative,真阴性)表示实际为负类的样本被正确地分类为负类的数量;FP(False Positive,假阳性)表示实际为负类的样本被错误地分类为正类的数量;FN(False Negative,假阴性)表示实际为正类的样本被错误地分类为负类的数量,评估公式如下所示:

[0096] 准确率Accuracy定义为以下公式:

[0097]

[0098] 精确度Precision定义为以下公式:

[0099]

[0100] 召回率Recall定义为以下公式:

[0101]

[0102] F1指标定义为以下公式:

[0103]

[0104] 本实施例模型训练时学习率设置为0.01,采用随机梯度下降算法,损失函数为二元交叉熵。图4显示了本文模型在训练时准确率的变化趋势,横轴表示训练周期,纵轴表示训练的准确率,可以看出本文模型的准确率整体呈上升的趋势,且最终在第10个训练周期趋于平稳,为0.9949。

[0105] 从表II的实验结果来看,本文模型具有最高的准确率、召回率以及最好的F1值。

[0106] 表II本文实验结果与现有方法比较

[0107]

[0108] 模型准确率对比图如图5所示。从图中可以看出本文模型的准确率相较于其他三个模型显示最优,为0.9949,然后依次是lstm模型、lstm-attention模型和cnn-lstm模型,准确率分别为0.9936、0.9934和0.9931。< / script>

Claims

1. An XSS attack detection method based on deep learning ensemble models and AdaBoost, characterized in that, Includes the following steps: Step 1, Preprocessing Data collection involves using web crawling technology to capture malicious samples as positive samples and normal samples from the DMOZ database as negative samples. For data processing, the Word2Vec model was used to train the vocabulary to obtain word vectors. The vectors were then visualized by tsne dimensionality reduction. The first 100 words were reduced from 128 dimensions to 2 dimensions and then plotted. All positive and negative samples were normalized, removing host and path information from the URLs, retaining only the malicious attack payload, and the links were replaced with... http: / / u The above data is URL-encoded and saved in a CSV file; All positive and negative samples are segmented into words. Unlike ordinary text, positive and negative samples include HTML tags, function bodies, parameter names, and programming language elements. Therefore, special segmentation rules need to be specified. The following rules will be treated as a single word and delimited using single quotes: 1) HTTP / HTTPS links 2) HTML tags <script>3)html标签开头<h14)参数名topic=5)函数体alert(6)字符数字组成的混合字符串;通过建立好的词向量模型,即可用空间向量表示一个文本;步骤2,构建深度学习集成模型,具体做法是:CNN-LSTM模型:首先使用Conv1d进行提取特征,ReLU激活和MaxPool1d降维;随后将卷积后的输出传入LSTM层,捕捉时间序列依赖;最后通过全连接层输出分类结果;Transformer模型:首先将CNN-LSTM模型的输出结果作为输入,转化为高维词向量表示;随后将高维词向量通过嵌入层生成嵌入向量,并为此嵌入向量添加位置编码;接着构建自注意力机制,即计算输入序列中每个位置的注意力权重,并通过多个头来并行处理信息;然后将多层自注意力编码器堆叠,处理嵌入向量的依赖关系;最后将经过以上步骤处理后的嵌入向量通过全连接层进行映射,得到最终的分类结果;集成模型:首先将CNN-LSTM模型和Transformer模型的输出拼接,对CNN-LSTM模型和Transformer模型进行训练;然后通过全连接层进行分类预测;特征提取:通过定义好的特征提取函数提取训练完成的集成模型中数据的特征和标签;AdaBoost分类器:首先使用提取的特征和标签,训练AdaBoost分类器,然后通过AdaBoost对提取的数据特征进行进一步的分类和预测;步骤3,用步骤2构建的深度学习集成模型对所有的正样本和负样本进行检测,验证模型的准确率和性能。2.根据权利要求1所述的基于深度学习集成模型与AdaBoost的XSS攻击检测方法,其特征在于,所述的步骤3,具体又包括以下步骤:步骤3-1,将步骤1预处理后的数据分别输入CNN-LSTM和Transformer模型中,CNN先提取局部特征,再输入LSTM提取全局特征;Transformer模型内部应用位置编码模块和注意力机制进行并行训练,且都输出各自的分类结果,Transformer模型内部应用位置编码模块为序列中的每个位置添加一个唯一的编码,帮助模型识别序列中的位置信息;步骤3-2,Transformer模型内部应用位置编码模块和注意力机制将各自的输出进行特征合并,即将位置编码模型和注意力机制的输出在特征维度上进行拼接,形成一个更为丰富的特征向量,且这个合并后的特征向量包含了从位置编码模型和注意力机制的输出学习到的局部和全局信息;然后通过全连接层对合并后的特征进行进一步的分类决策;步骤3-3,在步骤3-2得到的合并特征向量的基础上,引入AdaBoost分类器进行进一步的训练,它能够通过构建多个弱分类器并加权组合来增强分类性能,即AdaBoost通过对CNN-LSTM和Transformer的输出进行加权融合,能够进一步提高分类器的鲁棒性和准确性,其中准确性达到了99.49%。< / script>