A blockchain eclipse attack detection and defense method based on CNN

Through the convolutional neural network to identify the characteristics of blockchain network traffic, we build a detection and defense method for blockchain eclipse attacks, which solves the problems of low detection accuracy and lack of defense solutions in the existing technology, and achieves high accuracy. Detection and effective defense reduce node losses.

CN115065502BActive Publication Date: 2024-09-10NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202210480726.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-05
Publication Date
2024-09-10
Estimated Expiration
2042-05-05

AI Technical Summary

Technical Problem

Existing technologies have low detection accuracy when detecting blockchain eclipse attacks, and lack effective defense solutions. Traditional detection models are difficult to accurately identify features in network traffic, resulting in high false alarm rates and inability to defend against attacks in a timely manner.

Method used

Convolutional neural network (CNN) is used to identify characteristic images generated by traffic data, and a detection and defense method for blockchain eclipse attacks is constructed through five steps of data acquisition, data processing, model training, attack detection and attack defense. , use the CNN model to extract the characteristics of traffic data, identify attack characteristics, and take targeted defensive measures.

Benefits of technology

It improves the detection accuracy of blockchain eclipse attacks, avoids feature loss, enhances the pertinence of defense measures, reduces the loss of protected nodes, and improves the reliability of the blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115065502B
    Figure CN115065502B
Patent Text Reader

Abstract

A blockchain solar eclipse attack detection and defense method based on CNN, obtains the traffic data set of blockchain solar eclipse attack and normal blockchain traffic data packets, and divides them into training data and test data in proportion; extracts features from the training data and test data to generate corresponding feature vectors, and uses the feature vectors to generate two-dimensional feature images; uses the feature map of the training sample to train the CNN detection model so that it learns the relevant features of the solar eclipse attack, and finally obtains a CNN model that can be used to detect blockchain Japanese attacks; uses the trained detection model to perform attack detection on the feature map generated by the test sample to determine whether the node is suffering from a solar eclipse attack; if the attack is suffering from a Japanese attack, the system will make specific defense actions to get the node out of the state of being eclipsed. The above method integrates attack detection and attack defense, forming a complete solar eclipse attack response plan, with the characteristics of high-precision detection and adaptive defense.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network security, and mainly relates to a blockchain eclipse attack detection and defense method based on CNN. Background Art

[0002] As a trust system construction technology, blockchain has created a new computing paradigm for establishing trust at low cost. It also contains great potential to support the free flow of value, optimize production relations, break the monopoly of the center, and promote industrial innovation. It is expected to become the cornerstone of realizing value interconnection in the new era of digital economy in the future. The application of blockchain technology has rapidly expanded from the financial field to various industries. At the same time, blockchain technology is facing more and more security challenges. Among them, eclipse attacks can enable the attacking node to occupy all external network connections of the victim node, resulting in the victim node being unable to receive correct blocks and transaction information. Therefore, whether eclipse attacks in the blockchain can be detected and defended in a timely manner is an important indicator of blockchain reliability.

[0003] Traditional intrusion detection technologies mostly use machine learning algorithms as detection models, which have disadvantages such as low detection accuracy and high false alarm rate. In reality, network traffic has high latitude and multi-feature characteristics. It is difficult to judge the current network status using a single feature. Extracting traffic feature graphs can integrate multiple features of traffic data and improve detection accuracy. The network itself is a complex environment with various noise data.

[0004] At present, there is no complete detection and defense plan for blockchain eclipse attacks. Most research and inventions focus more on the detection methods of eclipse attacks and ignore the importance of defense plans. In addition, existing eclipse attack detection methods mostly use traditional detection models with low detection accuracy. Summary of the invention

[0005] The present invention provides a detection and defense method for blockchain eclipse attacks based on CNN, which solves the problems of low accuracy of additional testing and lack of defense methods in existing solutions. The detection method uses a convolutional neural network to identify feature images generated by traffic data, avoid feature loss and improve detection accuracy. The CNN network is an excellent classification algorithm that can be used for image recognition. It can well distinguish the differences between different feature maps, so as to identify feature maps belonging to Japanese attacks. The defense method is formulated according to the network structure of the blockchain and the attack principle of the eclipse attack, and actively helps the protected nodes get rid of the eclipse state.

[0006] A blockchain eclipse attack detection and defense method based on CNN includes five steps: data acquisition, data processing, model training, attack detection and attack defense, specifically:

[0007] Step 1: Data acquisition: obtain a traffic data set and divide the sample data into training samples and test samples;

[0008] Step 2, data processing: preprocessing and feature extraction of the divided sample data to generate feature images;

[0009] Step 3: Model training: Use sample data to train the CNN detection model to obtain a detection model for detecting blockchain eclipse attacks;

[0010] Step 4: Attack detection: Use the trained CNN model to detect whether there is an eclipse attack. If not, run normally without taking any action. If so, proceed to step 4 for attack defense.

[0011] Step 5, attack defense; the system alarms and takes defensive actions, including cutting off all current network connections of the node; deleting all IP data stored in the node routing table; prohibiting external nodes from establishing incoming connections to themselves; restarting the node; requesting a legal IP address from the DNS seed to establish an outgoing connection.

[0012] Furthermore, in step 1, an eclipse attack environment is built, and attack traffic data packets are obtained through packet capture software, and normal blockchain traffic data packets are captured at the same time, and the two are integrated into a complete traffic data set; the traffic data set is sorted, and the data therein is first edited into normal traffic and attack traffic, and then the classified data packets are diverted using features, and the captured network flows are diverted according to the source IP address, source port, and destination IP address; finally, the experimental data set is divided into training samples and test samples in proportion.

[0013] Furthermore, in step 2, the traffic features in the sample data are first extracted according to the feature extraction scheme of the KDDCUP standard data set, and the blockchain message type, the number of times such messages appear in the past two seconds, and the amount of IP data carried are added as feature items according to the characteristics of the eclipse attack. The character data is then converted into numerical data using one-hot encoding. After normalization, invalid features are removed through PDA, and 121-bit features are retained. Finally, the one-dimensional feature vector is converted into a 11*11 two-dimensional feature image.

[0014] Furthermore, in step 3, the CNN model includes a data input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer; the input layer receives the feature map converted from the training data and the test data; the convolution layer, the pooling layer and the fully connected layer are the data processing process inside the model; the output layer is the final output result of the model, and the output result is two numerical values, which respectively represent the probability that the input traffic is normal traffic and attack traffic.

[0015] Furthermore, in the CNN model, the input layer mainly preprocesses the original image data, including de-meaning and normalization; the convolution layer extracts different features of the input data; the pooling layer reduces the size of the feature map; the fully connected layer acts as a classifier; and the output layer outputs the final classification result.

[0016] Furthermore, in step 3, the feature images of the training samples are used to train the CNN detection model; the input data of the CNN model is an image, and the output result is two probability values, namely the probability that the input data is normal traffic and the probability that the input data is attack traffic; the CNN model uses the mean square error as the objective function and updates the model through the gradient descent method; the CNN model will learn and memorize the characteristics of the eclipse attack, and finally obtain a detection model that can be used to detect blockchain eclipse attacks.

[0017] Furthermore, in step 4, the trained CNN model is used to detect the feature graph of the test sample. Based on the output of the model, it is determined whether the current node is under eclipse attack; the judgment standard is that if the probability of the traffic on a certain connection being attack traffic is higher than the data of normal traffic, it is considered that an attacker is flooding illegal IPs to the protected node, and the protected node is or will be under eclipse attack, and defensive measures need to be taken.

[0018] Compared with the common eclipse attack detection scheme, the present invention has the following beneficial effects:

[0019] (1) The traffic data obtained comes directly from the transmitted data packets. The low cost of data acquisition can increase the breadth of data sources. (2) The one-dimensional data packets are converted into two-dimensional data images. In this way, the different features in the traffic data packets can be fully combined to avoid false positives caused by feature omissions. (3) The detection model is constructed using a convolutional neural network. The neural network algorithm has good image recognition performance and can accurately capture the differences in different feature maps, thereby improving detection accuracy. (4) Add a defense strategy against eclipse attacks to make the defense system more complete. After detecting an eclipse attack, a defense projection can be quickly made to minimize the loss of protected nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The figure is a flow chart of a blockchain eclipse attack detection and defense method based on CNN in an embodiment of the present invention.

[0021] Figure 2 Schematic diagram of the convolutional neural network (CNN) algorithm model in an embodiment of the present invention.

[0022] Figure 3 This is a flow chart of the defensive measures taken after a solar eclipse attack is detected in an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings.

[0024] like Figure 1 As shown in the figure, the CNN-based blockchain eclipse attack detection and defense solution mainly includes five steps: data acquisition, data processing, model training, attack detection and attack defense.

[0025] Step 1, data acquisition. Build an eclipse attack environment, use the packet capture software to obtain attack traffic data packets, and capture normal blockchain traffic data packets at the same time, and integrate the two into a complete traffic data set. At this time, the data set is still relatively messy and disordered traffic, which needs to be sorted out. First, edit the data in the data set into normal traffic and attack traffic. Then use the features to divert the classified data packets, and divert the captured network flow according to the source IP address, source port, and destination IP address. Finally, divide the traffic data set into training samples and test samples in proportion (the recommended ratio of training samples to test samples is 8:2).

[0026] Step 2, data processing. At this time, the sample data is still binary data and needs to be converted into numerical data. First, the traffic features in the sample data are extracted. The process uses the tshark tool to customize the traffic features of the pcap file (the acquired traffic). The customized traffic features include the basic traffic features defined by the KDDCUP standard data set (connection duration, protocol type, number of bytes of data from the source host to the target host, etc.). In addition, the present invention adds customized feature items according to the characteristics of the eclipse attack: blockchain message type, the number of times such messages appear in the past two seconds, and how much IP data is carried (non-addr message is 0). The previous step will obtain the vector features of the traffic, but the vector contains character data (such as TCP protocol type, etc.) in addition to numerical data, so it needs to be normalized. The processing process is to use unique hot encoding to convert character data into numerical data. For example, there are three types of TCP protocol types—TCP, UDP, and ICMP, so the unique hot encodings of these three types are 001, 010, and 100 respectively. After normalization, the PDA algorithm is used to reduce the dimension of the data, remove invalid features, and finally retain 121 features. Finally, the one-dimensional feature vector is converted into a 11*11 two-dimensional feature image.

[0027] Step 3, model training. Use the feature graph of the training sample to train the CNN detection model. The input data of the CNN model is an image, and the output result is two probability values, namely the probability that the input data is normal traffic and the probability that the input data is attack traffic. The CNN model uses the mean square error as the objective function and updates the model through the gradient descent method. The CNN model will learn and memorize the characteristics of the eclipse attack, and finally obtain a detection model that can be used to detect blockchain eclipse attacks.

[0028] Step 4: Attack detection. Use the trained CNN model to detect the feature graph of the test sample. According to the output of the model, determine whether the current node is under eclipse attack. The judgment standard is that if the probability of the traffic on a connection being attack traffic is higher than the data of normal traffic, it is considered that an attacker is flooding illegal IPs to the protected node, and the protected node is or will be under eclipse attack, and defensive measures need to be taken.

[0029] Step 5, attack defense. When the detection model determines that the protected node is under eclipse attack, it will call the relevant interface in the defense module. The interface of the defense module is a piece of program code in the system. The function of the program is to deploy specific defense measures to get the protected node out of the eclipse state and greatly reduce the probability of the protected node being eclipsed. The defense measures are set according to the network structure of the blockchain and the attack principle of the eclipse attack. They are directly targeted at the eclipse attack, specifically: cut off all current network connections of the node; delete all IP data stored in the node routing table; prohibit external nodes from establishing incoming connections to themselves; restart the node; request a legal IP address from the DNS seed to establish an outgoing connection.

[0030] Figure 2 The figure is a schematic diagram of the structure of the CNN algorithm model. The CNN model includes: data input layer, convolution layer, pooling layer, fully connected layer and input layer. The data input layer corresponds to the feature map converted from training data and test data. The convolution layer, pooling layer and fully connected layer are the data processing processes inside the model. The output layer is the final output result of the model. The output result is two numerical values, which represent the probability that the input traffic is normal traffic and attack traffic respectively. Among them, the data input is mainly to preprocess the original image data, including de-meaning and normalization. The convolution layer is the most important layer in the CNN model. Its purpose is to extract different features of the input data. The purpose of the pooling layer is to reduce the size of the feature map. The fully connected layer plays the role of a classifier in the entire convolutional neural network. The output layer outputs the final classification result. Generally, the probability of each type of output result is expressed, and the type with the highest probability is finally selected as the classification result.

[0031] Figure 3The specific actions of the defense measures are demonstrated, including: cutting off the current connection, clearing the routing table, prohibiting incoming connections, requesting DNS seeds, restarting the node, etc.

[0032] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A blockchain eclipse attack detection and defense method based on CNN, characterized by: The method includes five steps: data acquisition, data processing, model training, attack detection and attack defense, specifically: Step 1: Data acquisition: obtain the traffic data set and divide the sample data into training samples and test samples; Step 2, data processing: preprocessing and feature extraction of the divided sample data to generate feature images; converting the one-dimensional data packet into a two-dimensional data image so that different features in the traffic data packet can be fully combined to avoid false alarms caused by feature omissions; In step 2, firstly, the traffic features in the sample data are extracted according to the feature extraction scheme of the KDDCUP standard data set. In this process, the tshark tool is used to perform customized extraction of the traffic features of the obtained traffic pcap file; the customized traffic features include the basic traffic features defined by the KDDCUP standard data set, including connection duration, protocol type, and the number of bytes of data from the source host to the target host. According to the characteristics of the eclipse attack, the blockchain message type, the number of times such messages appear in the past two seconds, and the amount of IP data carried are added as feature items. Then, the character data is converted into numerical data using one-hot encoding. After normalization, invalid features are removed through PDA, and 121-bit features are retained; finally, the one-dimensional feature vector is converted into a 11*11 two-dimensional feature image; Step 3: Model training: Use sample data to train the CNN detection model to obtain a detection model for detecting blockchain eclipse attacks; Step 4: Attack detection: Use the trained CNN model to detect whether there is an eclipse attack. If not, run normally without taking any action. If so, proceed to step 4 for attack defense. Step 5, attack defense; when the detection model determines that the protected node is under eclipse attack, it will call the relevant interface in the defense module; the interface of the defense module is a piece of program code in the system, and the function of the program is to deploy specific defense measures to make the protected node get rid of the eclipse state and greatly reduce the probability of the protected node being eclipsed; the system alarms and takes defensive actions, including cutting off all current network connections of the node; deleting all IP data stored in the node routing table; Disable external nodes from establishing incoming connections to themselves; restart the node; Request a valid IP address from the DNS seed and establish an outgoing connection.

2. According to a CNN-based blockchain eclipse attack detection and defense method according to claim 1, it is characterized by: In step 1, build an eclipse attack environment, obtain attack traffic data packets through packet capture software, and capture normal blockchain traffic data packets at the same time, and integrate the two into a complete traffic data set; organize the traffic data set, first edit the data into normal traffic and attack traffic, and then use the features to divert the classified data packets, and divert the captured network flow according to the source IP address, source port, and destination IP address; finally, divide the experimental data set into training samples and test samples in proportion.

3. According to a CNN-based blockchain eclipse attack detection and defense method according to claim 1, it is characterized by: In step 3, the CNN model includes a data input layer, a convolution layer, a pooling layer, a fully connected layer, and an output layer; the input layer receives the feature map converted from the training data and the test data; the convolution layer, the pooling layer, and the fully connected layer are the data processing processes within the model; The output layer is the final output result of the model. The output result is two numerical values, which represent the probability that the input traffic is normal traffic and attack traffic respectively.

4. According to a CNN-based blockchain eclipse attack detection and defense method according to claim 3, it is characterized by: In the CNN model, the input layer mainly preprocesses the original image data, including de-meaning and normalization; the convolution layer extracts different features of the input data; The pooling layer reduces the size of the feature map; the fully connected layer acts as a classifier; the output layer outputs the final classification result.

5. According to a CNN-based blockchain eclipse attack detection and defense method according to claim 1, it is characterized by: In step 3, the feature images of the training samples are used to train the CNN detection model. The input data of the CNN model is an image, and the output result is two probability values, namely the probability that the input data is normal traffic and the probability that the input data is attack traffic. The CNN model uses the mean square error as the objective function and updates the model through the gradient descent method. The CNN model will learn and memorize the characteristics of the eclipse attack, and finally obtain a detection model that can be used to detect blockchain eclipse attacks.

6. According to a CNN-based blockchain eclipse attack detection and defense method according to claim 1, it is characterized by: In step 4, the trained CNN model is used to detect the feature map of the test sample; based on the output of the model, it is determined whether the current node is under an eclipse attack; the judgment standard is that if the probability that the traffic on a certain connection is attack traffic is higher than the data of normal traffic, it is considered that an attacker is flooding illegal IPs to the protected node, and the protected node is or will be under an eclipse attack, and defensive measures need to be taken.

Citation Information

Cited By

  • Radio spectrum anomaly monitoring apparatus based on cnn and blockchain

    CN120416852B