To address the problems that existing network attack homology analysis methods suffer from insufficient measurement of attack behavior similarity and low accuracy in multi-density samples and high-noise scenarios, a time series driven homology analysis method for Web attack behaviors is proposed. Firstly, 3 categories of 20 Web attack alert features are extracted to construct attack series. Then, a similarity algorithm for attack series is proposed to calculate the similarity between sequences and construct a distance matrix. Finally, a clustering algorithm is designed based on the distance matrix to cluster attack sequences, thereby realizing attack homology analysis. Different from traditional methods relying only on statistical feature analysis, the proposed method incorporates the temporal correlation of attack behaviors into homology analysis and effectively improves the accuracy of Web attack homology analysis. Experimental results show that the key indicator ARI of the method reaches 94.9% in noisy environments, verifying that its homology analysis performance outperforms other methods. Meanwhile, the method can maintain stable performance within a wide range of parameters.
在网络攻击的同源分析领域,当前研究的主流思路有基于恶意样本的同源分析方法、基于流量的同源分析方法和基于网络攻击行为的同源分析方法。其中基于恶意样本的同源分析方法通过对比不同恶意软件的代码、结构、运行特征等,判断它们是否来自同一源头或具有相似的开发背景,具体可分为静态同源分析和动态同源分析。静态同源分析主要是对恶意样本代码进行分析,通过提取代码结构特征信息,找到代码间的相似性[4]。动态同源分析通过在沙箱等环境中实时监控恶意样本的运行行为,捕捉网络通信、文件操作、应用程序接口(Application Program Interface,API)调用的模式、系统调用参数等动态特征,揭示恶意样本隐蔽的恶意行为,识别具有共同来源或相似攻击特征的恶意样本[5]。
鉴于上述问题,本文提出一种时序驱动的Web攻击行为同源分析方法。该方法通过对攻击序列进行分析比较,捕捉攻击行为的动态变化和时序规律,并在此基础之上进行后续的同源分析。首先,提取多维度攻击特征,并将其整合形成攻击序列;其次,提出了基于动态时间规整(Dynamic Time Warping, DTW)的攻击序列相似度算法,精准地衡量不同攻击序列之间的相似程度;最后,提出基于层次密度聚类算法(Hierarchical Density-Based Spatial Clustering of Applications with Noise, HDBSCAN)的攻击序列聚类算法,完成对攻击序列的同源分析,以及攻击数据与噪声数据的分离。
构建一个n×n的距离矩阵 D,其中n是攻击序列的数量,该矩阵将存储每对攻击序列间的相似性得分。对于任意一对攻击序列和,应用本文提出的基于DTW的攻击序列相似度算法来计算它们之间的序列距离得分,并将该得分存入序列间的距离矩阵 D 的对应位置中(即Dij )。其中,基于DTW的攻击序列相似度算法如下所示。
算法1 基于DTW的攻击序列相似度算法
输入:时间序列集合,特征权重向量,特征相似性比较方法集合
输出:距离矩阵 D
1. 初始化距离矩阵 D 为n×n的矩阵,所有元素初始化为0
2. for i=1 to n do
3. for j=i to n do
4. if i==j then
5. D[i][j]=0
6. else
7. //计算序列 Ti 和 Tj 的加权DTW距离
8. 初始化矩阵 C,所有元素初始化为无穷大,大小为(len( Ti )+1)×(len( Tj )+1)
9. C[0][0]=0
10. for a=1 to len( Ti ) do
11. for b=1 to len( Tj ) do
12. //计算项tia 和tjb 的加权距离dweighted,tia 为序列 Ti 的第a项,tjb 为序列 Tj 的第b项
13. dweighted=0
14. for k=1 to 20 do
15. //计算项 tia 和 tjb 第k个特征 tia [k]、 tjb [k]间的相似性sitem
该算法以距离矩阵 D 、最小簇大小nsize和最小样本数nsample作为输入,首先调用HDBSCAN算法构建简化的HDBSCAN聚类树,并调用ExtractOptimalClusters过程[15]对树中每个聚类计算稳定性,并求解最大总稳定性下的非嵌套聚类集合。最终,将选中的聚类映射为正整数标签,未被包含的对象统一标记为噪声(-1),最终输出聚类标签向量。算法时间复杂度为O(n2),n为序列数量。
本节开展参数敏感性分析,探讨关键参数对同源分析性能与结构稳定性的影响。图3展示了基于密度的聚类算法(Density-Based Spatial Clustering of Applications with Noise, DBSCAN)在不同邻域半径下的指标(最小样本数固定为2)的变化情况。图4展示了基于HDBSCAN的攻击序列聚类算法在不同最小簇大小值下的指标。
CALISKAN-ISLAMA, LIUA, VOSSC, et al. De-anonymizing programmers via code stylometry[C]//Proceedings of the 24th USENIX Security Symposium. Berkeley, USA: USENIX Association, 2015:255-270.
[5]
WUS Y, WANGP, LIX, et al. Effective detection of Android malware based on the usage of data flow APIs and machine learning[J]. Information and Software Technology, 2016,75:17-25.
МKISELEVA O, МPRYTOMANOVA O, АFILAT O. Application of clustering methods for detecting network threats[J]. Problems of Applied Mathematics and Mathematic Modeling, 2023,23:101-108.
CAMPELLOR J G B, MOULAVID, SANDERJ. Density-based clustering based on hierarchical density estimates[C]//Advances in knowledge discovery and data mining. Berlin, Germany: Springer, 2013:160-172.
[16]
HUSÁKM, ŽÁDNÍKM, BARTOŠV, et al. Dataset of intrusion detection alerts from a sharing platform[DB/OL]. (2019-06-10)[2026-03-06].