Network unsupervised intrusion detection method and system based on SVD and clustering analysis
The unsupervised intrusion detection method through SVD and cluster analysis solves the feature selection problem that relies on category labels in the existing technology, realizes network traffic anomaly detection under unsupervised conditions, and improves the accuracy and efficiency of detection.
Patent Information
- Application Number
- CN202310191812.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2024-08-27
AI Technical Summary
Existing network traffic anomaly detection methods rely on data sets with category labels, which are difficult to apply to real-time network environments, resulting in insufficient generalization capabilities in real network attack detection, and feature selection methods rely on category label correlation and cannot be effectively processed. Traffic data without category labels.
An unsupervised intrusion detection method based on SVD and cluster analysis is used to construct a network traffic matrix, perform singular value decomposition (SVD) dimensionality reduction, cluster the reduced matrix, and use distance thresholds to determine whether the sending and receiving traffic is Unknown type of network traffic.
It improves the calculation efficiency and classification accuracy, can effectively detect network traffic anomalies under unsupervised conditions, is suitable for real network environments, and reduces calculation time consumption.
Smart Images

Figure CN118555085A
Abstract
Description
Technical Field
[0001] The present invention relates to the research field of network traffic anomaly, and in particular to a network unsupervised intrusion detection method and system based on SVD and cluster analysis. Background Art
[0002] Any network anomaly will lead to abnormal network traffic, so monitoring the network based on traffic is feasible in any situation. As an important technical support for network situation awareness, anomaly detection of network traffic has received increasing attention in recent years.
[0003] In response to anomalies caused by security reasons, network traffic anomaly detection generally effectively prevents network attacks and maintains cyberspace security by building an intrusion monitoring model. When building an intrusion detection model, the characteristics of the data set often play a crucial role in the results of the classifier. Once the feature dimension of the data set is too high or contains more noise features, the efficiency of the classifier is often relatively low, and the calculation time is long. Therefore, many scholars have proposed feature selection methods to select high-quality features. However, these methods rely on the category labels of the data set, and are often selected by calculating the correlation between each dimension of the feature and the category label, leaving the features with high correlation with the category label and deleting the features with low correlation with the category label. However, combined with the actual network environment, the traffic data collected in real time does not have a category label. Therefore, these current feature selection methods cannot be well applied, and the real network security problems will not be substantially solved.
[0004] There are currently many open source datasets with category labels. The intrusion detection classifiers built based on these open source datasets are not very suitable for attack detection in real network environments in terms of generalization ability. Summary of the invention
[0005] In order to overcome the above two shortcomings, the present invention proposes a network unsupervised intrusion detection method and system based on SVD and cluster analysis.
[0006] In order to achieve the above object, the present invention adopts the following technical scheme:
[0007] In a first aspect, the present invention provides a network unsupervised intrusion detection method based on SVD and cluster analysis, characterized in that it includes:
[0008] S1. Use data collection tools to collect network traffic data and business data of smart terminals;
[0009] S2. Based on the collected network traffic data, a network traffic matrix A of network nodes within a set time period is constructed. ij ;
[0010] S3. Network traffic matrix A ij Perform SVD decomposition to obtain the reduced-dimensional left singular matrix U and right singular matrix V; the U matrix represents the characteristics of the sending traffic in the latent space, and the V matrix represents the characteristics of the receiving traffic in the linear latent space;
[0011] S4. Cluster the reduced-dimensional U matrix and V matrix respectively. The U matrix calculates the distance of the sending traffic in the linear latent space, and the V matrix calculates the distance of the receiving traffic in the linear latent space.
[0012] S5. Adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to determine whether the sent traffic and the received traffic are network traffic of unknown types.
[0013] In combination with the first aspect, the data collection in S1 specifically involves using a network traffic monitor to collect network data packets from smart terminals, parsing the data packets and aggregating data streams to form data suitable for analysis needs, which are then transmitted to a control center via a network and stored in a database.
[0014] In combination with the first aspect, the network traffic matrix Aij of the network nodes within the set time period constructed in S2 is specifically: continuously measuring the traffic between any nodes at a certain time interval, and arranging these traffic into a matrix Aij as a time series of all these traffic measurement values; wherein Aij represents the size of the traffic sent by the i node to the j node.
[0015] In combination with the first aspect, the node includes a router, a link, and a point of presence.
[0016] In combination with the first aspect, the SVD decomposition of the network traffic matrix Aij in S3 is specifically as follows: a set of orthogonal bases A=UΣVT for reconstructing the network traffic matrix is obtained through SVD decomposition of the matrix Aij; wherein Σ is a diagonal matrix, U is an orthogonal matrix, and the columns of U are the left singular vectors of the matrix A, VT is an orthogonal matrix, and the columns of VT are the right singular vectors of the matrix A.
[0017] In combination with the first aspect, the S4 clusters the reduced-dimensional U matrix and V matrix separately as follows: randomly designate a U matrix as the clustering center, subtract different U matrices and take the absolute value as the distance matrix, calculate the distance matrix between different U matrices, and then calculate the norm of the distance matrix as the distance between the matrices; similarly, calculate the norm of the distance matrix between different V matrices as the distance between the matrices; cluster the matrices according to different distances; and achieve the distance of normal sending traffic in different matrices in the linear latent space through repeated iterations.
[0018] In combination with the first aspect, in a second possible implementation manner of the first aspect, the method further includes
[0019] S6. Construct an unknown type traffic judgment model according to steps S2-S5; send data containing unknown type network traffic to the network model for prediction, and compare the obtained output with the distance threshold to determine whether the predicted network traffic is an unknown type of network traffic.
[0020] In a second aspect, the present invention provides an unsupervised intrusion detection system based on SVD and cluster analysis, comprising:
[0021] A data collection module, configured to collect network traffic data and business data of the smart terminal using a data collection tool;
[0022] The network matrix building module is configured to build a network traffic matrix A of network nodes within a set time period based on the collected network traffic data. ij ;
[0023] The network matrix decomposition module is configured to decompose the network traffic matrix A ij Perform SVD decomposition to obtain the reduced left singular matrix U and right singular matrix V;
[0024] The cluster analysis module is configured to cluster the dimension reduction data of the processed U matrix and V matrix using a density clustering algorithm, and merge the traffic data of unknown types belonging to the same type;
[0025] The judgment module is often configured to adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to judge whether the sent traffic and the received traffic are network traffic of unknown types.
[0026] In combination with the second aspect, in a first possible implementation manner of the second aspect, the system further includes
[0027] Traffic detection model construction is configured to build other module functions into unknown types of traffic detection judgment models for testing other traffic network data.
[0028] The network unsupervised intrusion detection method and system based on SVD and cluster analysis provided by the present invention improve the calculation efficiency and time by performing SVD decomposition on the network traffic matrix and then reducing the dimension; the left and right singular matrices after SVD decomposition and dimensionality reduction are clustered respectively, so as to simultaneously test whether the sending or receiving of traffic in the network is abnormal, thereby achieving the purpose of high accuracy and accelerating the calculation speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 It is a schematic diagram of a flow chart of a network unsupervised intrusion detection method based on SVD and cluster analysis according to an embodiment of the present invention;
[0031] Figure 2 It is a schematic diagram of the structure of an unsupervised intrusion detection system based on SVD and cluster analysis according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] An embodiment of the present invention provides a network unsupervised intrusion detection method based on SVD and cluster analysis, such as Figure 1 As shown, the method includes:
[0034] S1. Use data collection tools to collect network traffic data and business data of smart terminals.
[0035] S2. Based on the collected network traffic data, a network traffic matrix A of network nodes within a set time period is constructed. ij .
[0036] The traffic matrix is used to represent all traffic status information between different nodes in the network, and can fully record the status characteristics of the entire network. It represents the traffic size between all OD pairs in the entire network. The routing information in the entire network can also clearly reflect the traffic volume of each link in the entire network. The traffic matrix represents the network traffic demand from the source node to the destination node in the network, that is, the size of the OD flow.
[0037] S3. Network traffic matrix A ij Perform SVD decomposition to obtain the reduced left singular matrix U and right singular matrix V; the U matrix represents the characteristics of the sending traffic in the latent space, and the V matrix represents the characteristics of the receiving traffic in the linear latent space.
[0038] S4. Cluster the reduced-dimensional U matrix and V matrix separately, randomly specify the U matrix as the cluster center, subtract different U matrices and take the absolute value as the distance matrix, calculate the distance matrix between different U matrices, and then calculate the norm of the distance matrix as the distance between matrices. The V matrix is similar, and the norm of the distance matrix between different V matrices is calculated as the distance between matrices. Cluster the matrices according to different distances. Through repeated iterations, the goal of "the matrix distance within the cluster is close enough, and the matrix distance between clusters is far enough" is finally achieved. The distance of normal sending traffic in the linear latent space is calculated through the U matrix, and the distance of normal receiving traffic in the linear latent space is calculated through the V matrix.
[0039] S5. Adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to determine whether the sent traffic and the received traffic are network traffic of unknown types.
[0040] S6. Construct an unknown type traffic judgment model according to steps S2-S5; send data containing unknown type network traffic to the network model for prediction, and compare the obtained output with the distance threshold to determine whether the predicted network traffic is an unknown type of network traffic.
[0041] An embodiment of the present invention provides a specific implementation of a network unsupervised intrusion detection method based on SVD and cluster analysis in step S1, the method comprising:
[0042] Use network traffic monitors to collect network data packets from smart terminals, parse data packets and aggregate data streams to form data suitable for analysis, then transmit them to the control center through network transmission and store them in the database. For Windows systems, use the transport layer, middle layer or network interface layer of NDIS in DDK to capture data packets; for Linux systems, use the Libpcap packet capture library to capture data packets, such as using the following functions: pcap_open_live() is used to obtain the description information of a captured packet; pcap_lookupnet() is used to obtain the network address and mask of the network device; pcap_loop() is used to pass the captured data packets to the analysis function.
[0043] The network traffic matrix A of the network nodes in the set time period is constructed in S2 ij Specifically, the flow between any nodes is continuously measured at a certain time interval, and these flows are arranged into a matrix Aij as the time series of all these flow measurement values; where A ij Indicates the amount of traffic sent from node i to node j. The nodes include routers, links, and access points.
[0044] The network traffic matrix A in S3 ijThe specific SVD decomposition is as follows: through the matrix A ij The SVD decomposition of the network traffic matrix is used to obtain a set of orthogonal bases A=UΣV T ; where Σ is a diagonal matrix, U is an orthogonal matrix, and the columns of U are the left singular vectors of matrix A, V T is an orthogonal matrix, V T The columns of are the right singular vectors of the matrix A.
[0045] Among them, the network traffic matrix A ij The specific steps of SVD decomposition are: Step 1: Find A T The eigenvectors of A (the matrix formed by the eigenvectors is V) and eigenvalues (arranged from large to small by default, and then the square root is required, and the matrix formed by the eigenvalues after the square root is Σ);
[0046] Step 2: Ask for AA T Eigenvectors (the matrix formed by eigenvectors is U).
[0047] The S4 clusters the dimensionally reduced U matrix and V matrix separately, specifically: clustering the dimensionally reduced data of the processed U matrix and V matrix using a density clustering algorithm, and merging the traffic data of unknown types belonging to the same type.
[0048] After decomposition, we get the U matrix. Since the idea of SVD is to retain the main components after dimensionality reduction, we can retain the first few eigenvalues of the Σ matrix as needed, corresponding to the first few columns of the U matrix, so that the number of columns of the U matrix is reduced. Then, according to the idea of the K-means clustering algorithm, randomly select a U matrix as the "center point", subtract different U matrices and take the absolute value as the distance matrix, calculate the distance matrix between different U matrices, and then calculate the norm of the distance matrix as the distance between the matrices. The same is true for the V matrix. The norm of the distance matrix between different V matrices is calculated as the distance between the matrices. According to the type of known traffic, the threshold between the distances is determined, and this distance threshold is used to distinguish whether the traffic is normal or abnormal.
[0049] Another embodiment of the present invention provides an unsupervised intrusion detection system based on SVD and cluster analysis, such as Figure 2 As shown, the system includes
[0050] A data collection module, configured to collect network traffic data and business data of the smart terminal using a data collection tool;
[0051] The network matrix building module is configured to build a network traffic matrix A of network nodes within a set time period based on the collected network traffic data. ij ;
[0052] The network matrix decomposition module is configured to decompose the network traffic matrix Aij Perform SVD decomposition to obtain the reduced left singular matrix U and right singular matrix V;
[0053] The cluster analysis module is configured to cluster the dimension reduction data of the processed U matrix and V matrix using a density clustering algorithm, and merge the traffic data of unknown types belonging to the same type;
[0054] an abnormality judgment module, configured to adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to judge whether the sending traffic and the receiving traffic are network traffic of unknown types;
[0055] Traffic detection model construction is configured to build other module functions into unknown types of traffic detection judgment models for testing other traffic network data.
[0056] The unsupervised intrusion detection system based on SVD and cluster analysis provided in the embodiment of the present invention can implement the method embodiment provided above. For specific function implementation, please refer to the description in the method embodiment, which will not be repeated here. The clinical research program auxiliary design method, device and system provided in the embodiment of the present invention can be applied to clinical research, but is not limited to this.
[0057] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0058] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0059] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A network unsupervised intrusion detection method based on SVD and cluster analysis, comprising the following steps: S1. Use data collection tools to collect network traffic data and business data of smart terminals; S2. Based on the collected network traffic data, a network traffic matrix A of network nodes within a set time period is constructed. ij ; S3. Network traffic matrix A ij Perform SVD decomposition to obtain the reduced-dimensional left singular matrix U and right singular matrix V; the U matrix represents the characteristics of the sending traffic in the latent space, and the V matrix represents the characteristics of the receiving traffic in the linear latent space; S4. Cluster the reduced-dimensional U matrix and V matrix respectively, calculate the distance of normal sending traffic in the linear latent space through the U matrix, and calculate the distance of normal receiving traffic in the linear latent space through the V matrix; S5. Adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to determine whether the sent traffic and the received traffic are network traffic of unknown types.
2. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 1, characterized in that: The data collection in S1 specifically involves using a network traffic monitor to collect network data packets from smart terminals, parsing the data packets and aggregating data streams to form data suitable for analysis needs, which are then transmitted to a control center via a network and stored in a database.
3. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 1, characterized in that: The network traffic matrix Aij of the network nodes within the set time period constructed in S2 is specifically: continuously measuring the traffic between any nodes at a certain time interval, and arranging these traffic into a matrix Aij as a time series of all these traffic measurement values; wherein Aij represents the size of the traffic sent by the i node to the j node.
4. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 3, characterized in that: The nodes include routers, links and points of presence.
5. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 1, characterized in that: The SVD decomposition of the network traffic matrix Aij in S3 is specifically as follows: a set of orthogonal bases A=UΣV for reconstructing the network traffic matrix is obtained by SVD decomposition of the matrix Aij: T ; where Σ is a diagonal matrix, U is an orthogonal matrix, and the columns of U are the left singular vectors of matrix A, V T is an orthogonal matrix, V T The columns of are the right singular vectors of the matrix A.
6. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 1, characterized in that: The S4 clusters the reduced-dimensional U matrix and V matrix separately as follows: randomly designate a U matrix as the clustering center, subtract different U matrices and take the absolute value as the distance matrix, calculate the distance matrix between different U matrices, and then calculate the norm of the distance matrix as the distance between the matrices; similarly, calculate the norm of the distance matrix between different V matrices as the distance between the matrices; cluster the matrices according to different distances; and achieve the distance of normal sending traffic in different matrices in the linear latent space through repeated iterations.
7. The network unsupervised intrusion detection method based on SVD and cluster analysis as claimed in claim 1, characterized in that: The method further comprises S6. Construct an unknown type traffic judgment model according to steps S2-S5; send data containing unknown type network traffic to the network model for prediction, and compare the obtained output with the distance threshold to determine whether the predicted network traffic is an unknown type of network traffic.
8. An unsupervised intrusion detection system based on SVD and cluster analysis applied to the method of claim 1, characterized in that: The system comprises A data collection module, configured to collect network traffic data and business data of the smart terminal using a data collection tool; The network matrix building module is configured to build a network traffic matrix A of network nodes within a set time period based on the collected network traffic data. ij ; The network matrix decomposition module is configured to decompose the network traffic matrix A ij Perform SVD decomposition to obtain the reduced left singular matrix U and right singular matrix V; The cluster analysis module is configured to cluster the dimension reduction data of the processed U matrix and V matrix using a density clustering algorithm, and merge the traffic data of unknown types belonging to the same type; The abnormality judgment module is configured to adjust the distance threshold according to the classification accuracy, and use the distance threshold as a standard to judge whether the sending traffic and the receiving traffic are network traffic of unknown types.
9. The unsupervised intrusion detection system based on SVD and cluster analysis as claimed in claim 8, characterized in that: The system also includes Traffic detection model construction is configured to build other module functions into unknown types of traffic detection judgment models for testing other traffic network data.
