A Design Method of Intrusion Detection System Based on Bayesian Neural Network
Through the intrusion detection system based on Bayesian neural network, the problem of data imbalance and diversified attacks in the Internet of Vehicles and the Internet of Things is solved, unsupervised learning model unlabeled data detection is realized, and detection accuracy and reliability are improved. , suitable for a variety of network environments.
Patent Information
- Application Number
- CN202110770677.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-08
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-07-08
AI Technical Summary
Existing intrusion detection systems face the problems of data imbalance and diversified attack methods when processing Internet of Vehicles and Internet of Things data, and lack of label data, making it difficult to effectively perform intrusion detection and classification prediction.
Design an intrusion detection system based on Bayesian neural network, establish an unsupervised learning model through ETL (extraction, transformation, loading) and feature engineering, and use the variational Bayesian method and Lambda architecture for data preprocessing and modeling Training to detect unknown network attacks.
It realizes intrusion detection without label data, reduces the risk of over-fitting, improves the accuracy and reliability of detection, can effectively detect unknown network attack behaviors, and is suitable for traditional cyberspace and emerging Internet of Vehicles and Internet of Things environments.
Smart Images

Figure CN113536299B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of intrusion detection, and in particular relates to a design method of an intrusion detection system based on a Bayesian neural network. Background Art
[0002] The proportion of attack events in the Internet of Vehicles and Internet of Things data is very small, reflecting obvious data imbalance. In addition, some attack data are correlated, which means they may be short-term or long-term. At the same time, the actual attack methods are diverse and lack labeled data, so intrusion detection and classification prediction of such data is difficult.
[0003] Intrusion detection, as the name implies, is the detection of intrusion behavior. It collects information from several key points in a computer network or computer system and analyzes it to find out whether there are behaviors that violate security policies and signs of attacks in the network or system. The combination of software and hardware for intrusion detection is an intrusion detection system. Unlike other security products, an intrusion detection system requires more intelligence. It must be able to analyze the data obtained and obtain useful results. A qualified intrusion detection system can greatly simplify the administrator's work and ensure the safe operation of the network. According to the different objects of the intrusion detection system, the intrusion detection system can be divided into a host-based intrusion detection system and a network-based intrusion detection system.
[0004] 1. The host-based intrusion detection system installs a host intrusion detection module on the protected machine to collect information on the protected machine. The source of information can be system logs and specific application logs, or it can capture specific processes and system calls, etc. By analyzing the information, it is determined whether a behavior is an intrusion behavior. The host-based intrusion detection system generally protects the host where the intrusion detection system is located. The disadvantage of the host-based intrusion detection system is that it relies on a specific system platform. Users must develop corresponding modules for different operating systems. Since there are many different operating systems in a network, it is difficult to ensure that each operating system has a corresponding host intrusion detection module, and a host intrusion detection module can only protect the local machine, so it has great limitations in use. In addition, it requires installation on each machine. If the number of installed machines is large, it is a large investment for users. However, this intrusion detection system is not limited by the network structure, and can use the functions provided by the operating system itself and combine with abnormal analysis to report attack behaviors more accurately.
[0005] 2. The data source of the network-based intrusion detection system is the data packets on the network. The intrusion detection system obtains information by detecting the messages in the network. Generally speaking, the detection method can only detect the messages of the local machine. In order to monitor the messages of other machines, it is necessary to set the network card to promiscuous mode, listen to all the data packets in the network segment and make judgments. By placing an intrusion detection module in the network, we can monitor the data packets of the protected machine. Before the protected machine is about to be attacked, the intrusion detection module can first discover it. Generally, the network-based intrusion detection system is responsible for protecting the entire network segment. The advantages of the network-based intrusion detection system are: simple, only one or several such systems need to be installed on a network segment to monitor the situation of the entire network segment, and at the same time, we can allocate dedicated computers as the operating host machines of the network-based intrusion detection system, so as not to increase the load on the host running critical business.
[0006] From the perspective of machine learning, the hidden Markov model (HMM) or the long short-term memory (LSTM) model is often used to process time series data. However, the hidden Markov model is a model based on the homogeneous Markov assumption, and its state at any moment only depends on the state at the previous moment. Therefore, it is not very good at processing and predicting important events with long intervals and delays in time series. The LSTM model is mainly used for time series data with long intervals and delays, but it is generally a supervised learning model. Summary of the invention
[0007] The present invention aims to solve the above technical problems and provides a design method of an intrusion detection system based on a Bayesian neural network.
[0008] In order to achieve the above object, the present invention adopts the following technical solution:
[0009] A design method of an intrusion detection system based on a Bayesian neural network comprises the following steps:
[0010] S1. Read the normal network traffic analysis data without network attack;
[0011] S2. Preprocess the data;
[0012] S3. Write the coding layer module;
[0013] S4. Write the Lambda unit module. The Lambda unit module adopts the Lambda architecture. It provides calculation for the preprocessed data and preliminarily displays the calculation results of the latest data. The relevant statistical features of the acquired data after the encoding layer;
[0014] S5. Write a sampling layer module to obtain a sampling function according to the Lambda unit module and the statistical distribution set by the model;
[0015] S6. Write a decoding layer module and use the output of the sampling layer module as input;
[0016] S7. Write a VLB module. The VLB module uses a variational Bayesian method to calculate the loss function of the model. The normal network traffic data, the decoding layer output, and the Lambda unit module output are used as the input of the VLB module.
[0017] S8. Set the model’s loss function, optimizer, learning rate, batch size, etc., and perform training;
[0018] S9. Test the trained model based on normal network traffic data and attack traffic data respectively.
[0019] Preferably, S2 comprises:
[0020] S201: perform a shuffle operation on the original data to disrupt the order of arrangement;
[0021] S202: Divide the data after the shuffle operation into a training set, a validation set, and a test set;
[0022] S203: Perform mean / variance normalization on the training set. To prevent data leakage, perform normalization on the validation set and the test set based on the mean / variance of the training set.
[0023] As a preferred embodiment, S3 specifically includes: writing a coding layer module, setting the batch data size to 100, setting the dimension of the first Dense layer to 256, dividing the dimensions of the last five hidden layers by 2, 4, 8, 16, and 32 respectively, using relu as the activation function of each layer, setting the dimension of the last layer to 8, and having no activation function;
[0024] S4 specifically includes: writing Lambda modules, encapsulating functions as Layer objects in TensorFlow through the Lambda architecture. Layer objects are computing unit layers other than conventional layers such as Dense, Conv, and LSTM. Writing several Lambda modules to extract the mean and log covariance of data after being processed by the encoding layer.
[0025] S5 specifically includes: writing a sampling layer module that takes the mean and log covariance obtained in S4 as input;
[0026] S6 specifically includes: writing a decoding layer module, taking the output of S5 as input, corresponding to the encoding layer, and performing reverse operations on the dimensions of each Dense layer, that is, dividing the dimensions of the hidden layer by 32, 16, 8, 4, and 2 respectively, and the dimension of the second-to-last layer is 256. The activation function of each hidden layer uses relu, and the dimension of the last Dense layer is 115, and the activation function uses sigmoid;
[0027] S7 specifically includes: writing the VLB module, based on the assumption of independent and identical distribution, since the joint probability can be expressed as after taking the log , according to Bayesian neural network theory, this formula can be rewritten as , in this model, the prior probability and the posterior probability Use Gaussian distribution;
[0028] Through the re-parameterization technique, the KL divergence in the above formula can be derived, which facilitates the back propagation of the neural network, so that the loss function of the entire model can be written as:
[0029] ,in ,at the same time .
[0030] Neural network technology has been studied in intrusion detection for a long time and is constantly developing. Early research identified known network intrusions by training back-propagation neural networks, and further studied identifying unknown network intrusion behaviors. Today's neural network technology has a very strong attack pattern analysis capability, and various other neural network architectures such as self-organizing feature mapping networks have been proposed to overcome some of the limiting defects of back-propagation networks.
[0031] The processing of neural networks consists of two stages. The purpose of the first stage is to construct the detector of the intrusion analysis model, which is trained using historical data representing user behavior to complete the construction and assembly of the network; the second stage is the actual operation stage of the intrusion analysis model. The network receives the input event data, compares it with the reference historical behavior, and determines the similarity or deviation between the two. In the neural network, the following methods are used to identify abnormal events: changing the state of the unit, changing the weight of the connection, adding or deleting the connection, and also providing the function of gradually correcting the defined normal mode.
[0032] Neural networks use fully connected networks to fit data, which is equivalent to using multiple fully connected networks. When neural networks are used in intrusion detection, in many cases, the system tends to form an unstable network structure and cannot learn specific knowledge from the training data. The reason for this situation is not yet fully determined. In this configuration, the network fails to learn something for non-obvious reasons. Neural networks are prone to overfitting and poor generalization; and no confidence can be given to the predicted results.
[0033] Bayesian neural network, in simple terms, can be understood as regularizing the weights of a neural network by introducing uncertainty, which is equivalent to integrating an infinite number of neural networks on a certain weight distribution for prediction. Bayesian neural network is different from general neural networks in that its weight parameters are random variables rather than definite values. In other words, unlike traditional neural networks that use loss functions such as cross entropy and mse to fit label values, Bayesian neural networks fit posterior distributions. The advantage of doing this is that it reduces overfitting.
[0034] Preferably, S8 specifically includes: according to the VLB module, inputting normal traffic data, decoding layer output, and Lambda module output as inputs of the VLB module, and setting the loss function of the model; setting the optimizer to RMSprop, and initializing the learning rate to 1e-7.
[0035] After adopting the above technical solution, the present invention has the following advantages:
[0036] The present invention discloses a design method of an intrusion detection system based on a Bayesian neural network. After the intrusion detection system performs relevant preliminary preprocessing such as ETL and feature engineering on the data, it establishes, trains, verifies and tests the Bayesian neural network model and performs relevant parameter tuning. The intrusion detection system adopts an unsupervised learning model, which not only does not require label data, but also can detect unknown network attacks, playing a particularly important role in the network attack defense system. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The present invention is a flowchart of the steps of a design method of an intrusion detection system based on a Bayesian neural network. DETAILED DESCRIPTION
[0038] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0039] like Figure 1 As shown, a design method of an intrusion detection system based on a Bayesian neural network includes the following steps:
[0040] S1. Read normal traffic analysis data and Mirai zombie traffic analysis data separately and merge them. In this embodiment, there are 1,098,677 traffic analysis data, and each data has 115 analysis fields.
[0041] S2. Preprocess the data, which includes the following steps:
[0042] S201: perform a shuffle operation on the original data to disrupt the order of arrangement;
[0043] S202: Divide the data after the shuffle operation into a training set, a validation set, and a test set;
[0044] S203: performing mean / variance normalization processing on the training set. To prevent data leakage, the validation set and the test set are also normalized based on the mean / variance of the training set.
[0045] S3. Write the encoding layer module, set the batch size to 100, set the dimension of the first dense layer to 256, divide the dimensions of the last five hidden layers by 2, 4, 8, 16, and 32 respectively, use relu as the activation function for each layer, and set the dimension of the last layer to 8 without an activation function.
[0046] S4. Write a Lambda unit module. In TensorFlow, the function is encapsulated as a Layer object through the Lamdba architecture. The Layer object is a computing unit layer other than conventional layers such as Dense, Conv, and LSTM. In this embodiment, two Lambda modules are written to extract the mean and log covariance of the data after being processed by the encoding layer;
[0047] The Lambda unit module adopts the Lambda architecture, which provides calculations for preprocessed data and preliminarily displays the calculation results of the latest data, and obtains relevant statistical features of the data after the encoding layer;
[0048] S5. Write a sampling layer module, take the mean and log covariance obtained in S4 as input, and obtain the sampling function according to the Lambda unit module and the statistical distribution set by the model;
[0049] S6. Write a decoding layer module, take the output of S5 as input, corresponding to the encoding layer, and perform the reverse operation on the dimensions of each Dense layer, that is, divide the dimensions of the hidden layer by 32, 16, 8, 4, and 2 respectively. The dimension of the second-to-last layer is 256. The activation function of each hidden layer uses relu. The dimension of the last Dense layer is 115, and the activation function uses sigmoid.
[0050] S7. Write a VLB module. The VLB module uses a variational Bayesian method to calculate the loss function of the model. The normal network traffic data, the decoding layer output, and the Lambda unit module output are used as the input of the VLB module.
[0051] According to the assumption of independent and identical distribution, since the joint probability can be expressed as , according to Bayesian neural network theory, this formula can be rewritten as , in this model, the prior probability and the posterior probability Use Gaussian distribution;
[0052] Through the re-parameterization technique, the KL divergence in the above formula can be derived, which facilitates the back propagation of the neural network, so that the loss function of the entire model can be written as:
[0053] ,in ,at the same time ;
[0054] S8. Set the model’s loss function, optimizer, learning rate, batch size, etc., and perform training;
[0055] In this embodiment, according to the VLB module, the input normal traffic data, the decoding layer output, and the Lambda module output are used as the input of the VLB module, and the loss function of the model is set; the optimizer is set to RMSprop, and the initial learning rate is 1e-7;
[0056] S9. Test the trained model based on normal network traffic data and attack traffic data respectively.
[0057] The model uses a total of 160,000 sample data for training and testing. The intrusion detection system designed by this design method has a false alarm rate of 4.6% for normal traffic and a detection rate of 92.5% for malicious traffic. The sample data used in this example is Philips_B120N10_Baby_Monitor.
[0058] The design method of the intrusion detection system of the present invention establishes an unsupervised learning model for intrusion detection based on a Bayesian neural network, which can be applied to traditional cyberspace security as well as emerging Internet of Vehicles and Internet of Things intrusion detection. The unsupervised learning model proposed in the present invention does not require labeled data and can detect unknown network attack behaviors at the same time, thus getting rid of the shortcomings of previous vulnerability strategy-based protection and supervised learning models.
[0059] In addition to the above preferred embodiments, the present invention has other implementation modes. Those skilled in the art may make various changes and modifications based on the present invention. As long as they do not depart from the spirit of the present invention, they should all fall within the scope defined by the claims attached to the present invention.
Claims
1. A design method for an intrusion detection system based on a Bayesian neural network, characterized in that: The following steps are involved: S1. Read the normal network traffic analysis data without network attack; S2. Preprocess the data; S3. Write the coding layer module; S4. Write the Lambda unit module. The Lambda unit module adopts the Lambda architecture. It provides calculation for the preprocessed data and preliminarily displays the calculation results of the latest data. The acquired data passes through the encoding layer and then statistically analyzes the relevant features. S5. Write a sampling layer module to obtain a sampling function according to the Lambda unit module and the statistical distribution set by the model; S6. Write a decoding layer module and use the output of the sampling layer module as input; S7. Write a VLB module. The VLB module uses a variational Bayesian method to calculate the loss function of the model. The normal network traffic data, the decoding layer output, and the Lambda unit module output are used as the input of the VLB module. S8. Set the model’s loss function, optimizer, learning rate, and batch size for training; S9. Test the trained model based on normal network traffic data and attack traffic data respectively; S2 includes: S201: perform a shuffle operation on the original data to disrupt the order of arrangement; S202: Divide the data after the shuffle operation into a training set, a validation set, and a test set; S203: performing mean / variance normalization processing on the training set. To prevent data leakage, the validation set and the test set are also normalized based on the mean / variance of the training set. S3 specifically includes: writing the encoding layer module, setting the batch data size to 100, setting the dimension of the first Dense layer to 256, dividing the dimensions of the last five hidden layers by 2, 4, 8, 16, and 32 respectively, using relu as the activation function for each layer, and setting the dimension of the last layer to 8 without an activation function; S4 specifically includes: writing Lambda modules, encapsulating functions as Layer objects in TensorFlow through the Lambda architecture, where Layer objects are computing unit layers other than Dense, Conv, and LSTM conventional layers, and writing several Lambda modules to extract the mean and log covariance of data after being processed by the encoding layer; S5 specifically includes: writing a sampling layer module that takes the mean and log covariance obtained in S4 as input; S6 specifically includes: writing a decoding layer module, taking the output of S5 as input, corresponding to the encoding layer, and performing reverse operations on the dimensions of each Dense layer, that is, dividing the dimensions of the hidden layer by 32, 16, 8, 4, and 2 respectively, and the dimension of the second-to-last layer is 256. The activation function of each hidden layer uses relu, and the dimension of the last Dense layer is 115, and the activation function uses sigmoid; S7 specifically includes: writing the VLB module, based on the assumption of independent and identical distribution, since the joint probability is expressed as log after taking , according to Bayesian neural network theory, this formula can be rewritten as , in this model, the prior probability and the posterior probability Use Gaussian distribution; Through the re-parameterization technique, the KL divergence in the above formula is derived, which facilitates the back propagation of the neural network. The loss function of the entire model is written as: ,in ,at the same time .
2. The design method of an intrusion detection system based on a Bayesian neural network according to claim 1 is characterized in that: S8 specifically includes: according to the VLB module, taking the normal traffic data, the decoding layer output and the Lambda module output as the input of the VLB module, setting the loss function of the model; setting the optimizer to RMSprop, and initializing the learning rate to 1e-7.
