Method, device and electronic equipment for defending against wormhole attacks in wireless sensor networks

By constructing a weighted undirected graph, community partitioning, and graph reconstruction to identify wormhole attack node pairs, the problem of insufficient defense against wormhole attacks in wireless sensor networks is solved, achieving efficient and accurate defense effects and improving network security and stealth.

CN122160774APending Publication Date: 2026-06-05HUAZHONG UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAZHONG UNIV OF SCI & TECH
Filing Date
2026-03-17
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing defenses against wormhole attacks in wireless sensor networks suffer from insufficient security and limited effectiveness, especially in complex and harsh environments. Current technologies often rely on the assumption of uniform node distribution, which makes the defense measures ineffective.

Method used

We construct a weighted undirected graph, divide communities using the Gilvin-Newman algorithm, identify key node sets, and reconstruct the graph using a hybrid weight of shortest path projection and conductance projection. This allows us to identify and defend against high-risk wormhole attack node pairs. We also combine the edge centrality metric of motif to detect 2-hop edge centrality, ensuring the concealment and effectiveness of node pairs.

Benefits of technology

It significantly improves the defense against wormhole attacks. By simplifying the network through graph reconstruction, retaining key topology information, and accurately identifying high-risk node pairs, it enhances the security and stealth of the network and reduces the risk of stealthy forwarding of wormhole attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122160774A_ABST
    Figure CN122160774A_ABST
Patent Text Reader

Abstract

The application discloses a method, device and electronic equipment for defending wormhole attack in a wireless sensor network, and belongs to the technical field of wireless communication. The method for defending wormhole attack comprises the following steps: dividing a weighted undirected graph corresponding to nodes in the wireless sensor network into a plurality of communities; reconstructing the weighted undirected graph by using a key node set in each community to obtain a reconstructed graph; simplifying the original large-scale network into a simplified network containing only key nodes by graph reconstruction, while retaining the key topological information of the original network, thereby providing a basis for efficient high-risk node pair selection. Further, high-risk node pairs corresponding to wormhole attacks are found from the reconstructed graph; the high-risk node pairs thus found are prone to be used by attackers to implement wormhole attacks with high concealment by using a selective forwarding method. Further, the high-risk node pairs corresponding to the wormhole attacks are defended, which can significantly improve the defense effect of the wormhole attack nodes deployed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of wireless communication technology, and more specifically, relates to a method, apparatus, and electronic device for defending against wormhole attacks in a wireless sensor network. Background Technology

[0002] Wireless Sensor Networks (WSNs) have been widely used in various fields such as agricultural monitoring, industrial control, environmental monitoring, and national defense security. With the continuous expansion of application scenarios, WSNs are gradually extending from relatively stable and controllable environments to more complex and harsh scenarios such as underground pipeline monitoring, mine safety monitoring, and geological disaster early warning.

[0003] A wormhole attack refers to an attacker constructing a private communication channel (i.e., a wormhole) between two malicious nodes. Through this channel, data packets are rapidly forwarded, misleading other nodes in the network into believing that a high-quality direct link exists between the two malicious nodes. This induces surrounding nodes to forward their communication traffic via the wormhole. Wormhole attacks not only disrupt network topology and steal sensitive information, but also provide the conditions for various other attacks such as black hole attacks and selective forwarding attacks, seriously threatening the normal operation of the network.

[0004] Regarding the implementation mechanism of wormhole attacks, most existing research is based on a key assumption: network nodes are approximately uniformly distributed, and the location of the attacking node has little impact on the attack effect. Therefore, existing work typically uses random selection or simply chooses the node with the highest degree value in the network as the attack target when selecting wormhole attack nodes. Defense schemes deployed against such nodes often suffer from insufficient security and limited defensive effectiveness. Summary of the Invention

[0005] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a method, device and electronic device for defending against wormhole attacks in wireless sensor networks. Its purpose is to solve the technical problems that defense schemes deployed against wormhole attack nodes often have insufficient security and limited defense effect.

[0006] To achieve the above objectives, according to one aspect of the present invention, a method for defending against wormhole attacks in a wireless sensor network is provided, comprising: S1: Construct a weighted undirected graph corresponding to the nodes in the wireless sensor network. , For a set of nodes, Let be the set of edges. For the set of edge weights; S2: For the weighted undirected graph The area was divided into multiple communities; S3: Obtain the set of key nodes within each community ; S4: Utilize the key node sets within each of the aforementioned communities For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, Reconstruct the weight set for the edges; S5: From the reconstructed graph Identify high-risk node pairs corresponding to wormhole attacks; S6: Defend against high-risk node pairs corresponding to the wormhole attack.

[0007] Furthermore, the set of edge weights Represented as: ={ }

[0008] in, For nodes , Corresponding edges The weights, Representative node , Communication delay between them Representative node , Packet loss rate between Representative node , The number of packets transmitted between them.

[0009] Further, S4 includes: from the weighted undirected graph Find the key node set within each of the aforementioned communities. and its corresponding set of edges Using formulas Determine the set of edge reconstruction weights ; in, For any two nodes , The shortest path projection between them For nodes , The electrical conductance projection between them For balancing parameters, and .

[0010] Furthermore, S3 includes: selecting multiple nodes with the highest external communication ratio (ECR) within each community as key nodes, and summarizing them to obtain a key node set. The external communication ratio (ECR(v)) of node v is:

[0011] in, Representative node The number of times communication with nodes outside the community. Representative node Total number of communications.

[0012] Furthermore, S3 includes: in any community Select the one with the highest external communication ratio (ECR) Each node is considered a key node, and these nodes are aggregated to obtain the key node set. ;Community Number of key nodes The calculation formula is:

[0013] in, Represents the total number of communities. Represents the total number of nodes in the network. Representing the community The number of internal nodes.

[0014] Further, S5 includes: for the reconstructed graph Each node Find the node The corresponding unordered neighbor pair set ,node ; Calculate the unordered neighbor pair set each tuple Corresponding phantom centrality ; tuples corresponding to the maximum motif centrality node pairs As the high-risk node pair.

[0015] Furthermore, tuples The corresponding phantom centrality is expressed as: ; in, For nodes The edge centrality of the corresponding edge, For nodes The edge centrality of the corresponding edge.

[0016] According to another aspect of the present invention, an apparatus for defending against wormhole attacks in a wireless sensor network is provided, comprising: The building module is used to construct the weighted undirected graph corresponding to the nodes in a wireless sensor network. , For a set of nodes, Let be the set of edges. For the set of edge weights; The partitioning module is used to partition the weighted undirected graph. The area was divided into multiple communities; The acquisition module is used to acquire the set of key nodes within each community. ; The reconstruction module is used to utilize the key node sets within each of the aforementioned communities. For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, Reconstruct the weight set for the edges; The lookup module is used to find the reconstructed graph. Identify high-risk node pairs corresponding to wormhole attacks; The defense module is used to defend against high-risk node pairs corresponding to the wormhole attack.

[0017] According to another aspect of the invention, an electronic device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method for defending against wormhole attacks in the wireless sensor network.

[0018] According to another aspect of the invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for defending against wormhole attacks in a wireless sensor network.

[0019] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: (1) This invention provides a method for defending against wormhole attacks in wireless sensor networks, which divides the weighted undirected graph corresponding to the nodes in the wireless sensor network into multiple communities; and utilizes the key node set in each community. For the weighted undirected graph Reconstruction yields the reconstructed graph. By reconstructing the graph, the original large-scale network is simplified into a streamlined network containing only key nodes, while retaining the key topological information of the original network, providing a foundation for efficient selection of high-risk node pairs. Furthermore, from the reconstructed graph... High-risk node pairs corresponding to wormhole attacks are identified. These high-risk node pairs are vulnerable to attacks by attackers using selective forwarding methods to carry out highly covert wormhole attacks. Furthermore, defending against these high-risk node pairs can significantly improve the effectiveness of defenses deployed against wormhole attack nodes.

[0020] (2) This scheme sets up edges weights Calculate using the following formula:

[0021] This weighting calculation method takes into account both communication quality and communication frequency, and can accurately reflect the strength of the communication relationship between nodes.

[0022] (3) This scheme combines the advantages of shortest path projection and conductivity projection. The hybrid weight between key nodes is defined as follows:

[0023] By adjusting the balance parameters The value of can achieve a balance between local and global features.

[0024] (4) This plan selects the community with the highest ECR value. Each node is considered a key node, and these nodes are aggregated to obtain the key node set. This design ensures that the total number of key nodes is roughly equal to the number of communities, while avoiding excessive interference from small communities in the selection of key nodes.

[0025] (5) This scheme considers that in order to ensure the attack effect while satisfying the concealment requirement, the attacked node pair needs to meet the following conditions: the two nodes cannot be adjacent, and the distance between the two nodes is less than a set value; the connection covered by the wormhole should be the "central" connection of the network, so that the wormhole can achieve the best effect. To this end, the Motif-Based Edge Centrality (MBET) method is introduced to calculate the 2-hop edge centrality. By finding the 2-hop edge, it is ensured that the two nodes are not adjacent and that the distance between the two nodes is kept within a reasonable range; by finding the optimal 2-hop edge, the node pair with the highest attraction in the graph can be identified, so that the established wormhole has high performance. Attached Figure Description

[0026] Figure 1 This is a flowchart of a method for defending against wormhole attacks in a wireless sensor network according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a method for defending against wormhole attacks in a wireless sensor network according to an embodiment of the present invention; Figure 3 This is a trend chart showing the change of the proportion of wormhole traffic in the network with the degree of node aggregation, provided by an embodiment of the present invention. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0028] Example 1 This embodiment provides a method for defending against wormhole attacks in wireless sensor networks, such as... Figure 1 and Figure 2 As shown, it includes: S1: Constructing a weighted undirected graph corresponding to the nodes in the wireless sensor network. , For a set of nodes, Let be the set of edges. S2: For the weighted undirected graph, the set of edge weights is defined. The system is divided into multiple communities. S3: Obtain the set of key nodes within each community. S4: Utilize the key node sets within each of the aforementioned communities. For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, S5: From the reconstructed graph, the weight set is reconstructed. S6: Identify high-risk node pairs corresponding to wormhole attacks.

[0029] As an optional implementation, S1: Construct a weighted undirected graph based on the communication latency, packet loss rate, and number of packets transmitted between nodes in the wireless sensor network. ,in For a set of nodes, Let be the set of edges. This is the set of weights. Specifically, when two nodes... , When there is direct information exchange between them, it is assumed that there is a boundary between them. ,side weights Calculate using the following formula:

[0030] in, Representative node , Communication delay between them This represents the packet loss rate between two nodes. This represents the number of packets transmitted between two nodes. This weighting method comprehensively considers communication quality and frequency, and can accurately reflect the strength of the communication relationship between nodes.

[0031] Specifically, step S1: Construct a weighted undirected graph: Assume a NUDWSN containing 100 sensor nodes is deployed within an area with a radius of 500 meters. The node distribution adopts a clustered distribution pattern: within a radius of... Five cluster centers are uniformly distributed in plane A, with 20 nodes in each cluster. The nodes in each cluster are distributed in a circle centered on the cluster center with a radius of [missing information]. Within a space defined by meters, each node communicates using an IEEE 802.11DCF module, employing AODV (Ad hoc On-Demand Distance Vector) routing protocol. Each node attempts to send data packets to other nodes in the network, with a communication duration of 300 seconds. During communication, the communication delay between nodes is recorded. Packet loss rate and the number of packets transmitted For example, between node 1 and node 2: , , Construct a weighted undirected graph based on these parameters. When there is direct communication between two nodes, an edge is established between them. The weight of the edge is calculated according to the following formula:

[0032] For node 1 and node 2, the calculation is as follows:

[0033] By analogy, calculate the weights between all pairs of nodes that communicate directly, and construct a complete weighted undirected graph. In this embodiment, Figure It contains 100 vertices and approximately 280 edges.

[0034] As an optional implementation, step S2: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Run the community detection algorithm to obtain community partitioning. Preferably, the Girvan-Newman algorithm (GN algorithm) is used for community identification. The GN algorithm iteratively removes the edges with the highest betweenness to gradually segment the network until the optimal modularity Q value is reached. The reasons for choosing the GN algorithm are: (1) Compared with fast heuristic methods, the GN algorithm provides edge-level interpretability and hierarchical segmentation information, which can clearly show the evolution process of the network's community structure. (2) For the network scale processed by this invention, the computational complexity of the GN algorithm is acceptable, which can maintain the stability of the algorithm and ensure a reasonable running time. The specific steps of the GN algorithm include: (1) The entire diagram It is considered a single community.

[0035] (2) Calculate the edge betweenness of all edges in the graph. The edge betweenness is defined as the number of shortest paths through that edge.

[0036] (3) Remove the edge with the highest edge betweenness.

[0037] (4) Identify the connected components of the current graph and treat each connected component as an independent community.

[0038] (5) Calculate the modularity of the current partition. Modularity is an indicator for measuring the quality of community segmentation.

[0039] (6) Repeat steps (2) to (5) until there are no remaining edges in the graph.

[0040] (7) Return the community division when the modularity reaches its maximum value. .

[0041] Community discovery enables the identification of natural community structures formed by node clustering in NUDWSN, laying the foundation for subsequent identification of key nodes.

[0042] For step S2: Community partitioning: the constructed weighted undirected graph The Gilvin-Newman algorithm (GN algorithm) is used for community identification. The specific process is as follows: (1) Initialization: Initialize the entire graph It is considered a single community.

[0043] (2) Calculate the edge betweenness number of all edges. The edge betweenness number is defined as the number of shortest paths through that edge. For example, for edge... Calculate the shortest path between all pairs of nodes in the network, and count how many shortest paths pass through the edge. Assuming there are 156 shortest paths passing through this edge, and the total number of shortest paths between all pairs of nodes in the network is 4950 (the number of combinations of choosing 2 nodes from 100 nodes), then the edge betweenness of this edge is... .

[0044] (3) Identify and remove the edge with the highest betweenness. Assume the edge... If the edge has the highest betweenness number of 0.0428, then remove that edge.

[0045] (4) After removing the edges, check the connectivity of the graph. If the graph is divided into multiple connected components, treat each connected component as a community.

[0046] (5) Calculate the modularity of the current community division Value. Modularity. Defined as:

[0047] in The total number of edges in the graph. For the elements of the adjacency matrix (if nodes) and If there is an edge between them, the weight is the edge weight; otherwise, it is 0. For nodes The degree, For nodes The community to which it belongs This is the Kronecker function (1 if the two arguments are equal, 0 otherwise).

[0048] (6) Repeat steps (2) to (5) and record the modularity of each iteration. value.

[0049] (7) After all edges in the graph have been removed, select the modularity. The community division with the maximum value is taken as the final result. In this embodiment, when the modularity... When the maximum value of 0.472 is reached, the network is divided into 5 communities: It contains 23 nodes. It contains 19 nodes. It contains 21 nodes. It contains 18 nodes. It contains 19 nodes. The community partitioning results are basically consistent with the initial cluster distribution, but due to the complexity of communication relationships, some edge nodes were assigned to adjacent communities.

[0050] S3: Run the key node identification algorithm in each community to obtain the key node set. The core of this step lies in identifying the edge nodes within each community that undertake cross-community communication tasks, rather than simply selecting the node with the highest degree. Specifically, this includes: (1) Calculate the external communication ratio (ECR)(v) of each node, defined as:

[0051] in, Representative node The number of times communication with nodes outside the community. Representative node The total number of communications. Nodes with high ECR values ​​undertake more inter-community communication tasks and are considered edge nodes of the community.

[0052] (2) Identify each community Number of key nodes The calculation formula is:

[0053] in, Represents the total number of communities. Represents the total number of nodes in the network. Representing the community Number of internal nodes. Within each community, select the node with the highest ECR value. Each node is considered a key node, and these nodes are aggregated to obtain the key node set. This design ensures that the total number of key nodes is roughly equal to the number of communities, while avoiding excessive interference from small communities in the selection of key nodes.

[0054] (3) Select the community with the highest ECR value. Each node serves as a key node representing the community. By aggregating the key nodes from all communities, we can obtain the key node set. By selecting edge nodes rather than central nodes as key nodes, the critical paths for cross-community communication can be more accurately identified.

[0055] Specifically, step S3: Key node identification: After obtaining the community division Next, key nodes are identified in each community. First, the external communication ratio (ECR) for each node is calculated. Taking node v in community C1 as an example... 15 For example: node v 15 The set of neighboring nodes The corresponding edge weights are respectively

[0056]

[0057]

[0058]

[0059] and Belongs to the community , Belongs to the community , Belongs to the community .

[0060] Calculate the external communication ratio:

[0061] Calculate the community using this method The ECR value of all nodes in the system.

[0062] Next, determine the number of key nodes to be selected in each community: Total number of nodes Community numbers For the community Number of nodes The number of key nodes is:

[0063] Similarly, calculate the number of key nodes in other communities:

[0064]

[0065]

[0066]

[0067] Select the community with the highest ECR value Each node is considered a key node. Assume the community... The top two nodes in terms of ECR ​​value are (ECR=0.424) and If ECR=0.398, then these two nodes are selected as key nodes. The key node set is obtained by summing all key nodes in the community. There are a total of 7 key nodes.

[0068] S4: Utilizing the weighted undirected graph and key node set Run the graph reconstruction algorithm to obtain the reconstructed graph. To simultaneously characterize the local routing features and global topology coupling characteristics of WSNs, this embodiment proposes a hybrid graph reconstruction method based on shortest path projection and conductance projection. Specifically, it includes: (1) Shortest path projection: For the set of key nodes Any two nodes in , In the original image This is mapped to a weighted value in the form of similarity: ; in, For nodes , The shortest path distance between them This is the distance attenuation factor, used to control the degree to which distance affects the weights. This projection emphasizes the physical or logical proximity along the path, reflecting the local routing characteristics of the network.

[0069] (2) Conductivity projection: To reflect the global connectivity between nodes, the effective resistance based on the Laplace matrix is ​​calculated. : ; in, For Laplace matrix, Let be the degree matrix of the nodes. for The generalized inverse matrix, represent The Middle Line number Column element values. Effective resistance is a classic concept in graph theory. Analogous to a resistive network, effective resistance reflects the equivalent resistance between two nodes. This metric reflects the network's global transmission capability under multi-path parallel transmission, and the corresponding conductance projection is defined as: .

[0070] (3) Hybrid weight: To combine the advantages of shortest path projection and conductance projection, the hybrid weight between key nodes is defined as follows: ; in, For balancing parameters, and By adjusting The value of can achieve a balance between local and global features. Experiments show that... A value of 0.2 yields better results.

[0071] (4) For the set of key nodes For each pair of nodes in the array, calculate the mixed weights using the method described above to construct an edge set. and weight set Thus, the reconstructed graph is obtained. By reconstructing the graph, the original large-scale network is simplified into a streamlined network containing only key nodes, while retaining the key topological information of the original network, thus providing a basis for efficient selection of high-risk node pairs.

[0072] For step S4: Graph reconstruction: using the original graph and key node set Perform graph reconstruction to obtain the reconstructed graph. For the set of key nodes For any two nodes in the array, calculate the mixture weight between them. and For example: (1) In the original image In the middle, node and Shortest path length between Let the distance attenuation coefficient be... (Taking approximately 1 times the average shortest path length of the network), calculate the shortest path projected weights: .

[0073] (2) First, construct the Laplace matrix of the original graph G. ,in For degree matrix, This is the weight matrix. Calculate... generalized inverse matrix (The Moore-Penrose pseudo-inverse can be used for calculation). Calculate the effective resistance: ; Calculate the projected weights of conductance: .

[0074] (3) Set the equilibrium parameters (The optimal value determined experimentally), calculate the mixed weights:

[0075] Calculate the key node set using this method The mixed weights among all node pairs are used to construct the reconstructed graph. Reconstructed graph It contains 7 vertices (key nodes) and 21 edges (a complete graph with 7 nodes).

[0076] S5: In the reconstruction diagram The optimal 2-hop open path detection algorithm is run to identify high-risk node pairs. To ensure the attack's effectiveness while maintaining stealth, the attacked node pairs must meet the following conditions: (1) Two nodes cannot be adjacent, otherwise the effect of the introduced wormhole will be greatly reduced.

[0077] (2) The distance between the two nodes should not be too far, otherwise the concealment of the wormhole will be greatly reduced.

[0078] (3) The connection covered by the wormhole should be the "central" connection of the network so that the wormhole can achieve the best effect. A Motif-Based Edge Centrality (MBET) method is introduced to calculate 2-hop edge centrality. Specific steps include: (1) Calculate the reconstructed graph Edge centrality of all edges Edge centrality is defined as the ratio of the number of shortest paths through an edge to the total number of shortest paths between all pairs of nodes.

[0079] (2) Initialize an empty motif list.

[0080] (3) For each node Iterate through all its unordered neighbor pairs. ,in For nodes The set of neighboring nodes.

[0081] (4) Calculate motif centrality: Calculate motif centrality: .

[0082] (5) Translate the tuple Add to the motif list.

[0083] (6) Return to the motif list The node pair corresponding to the tuple with the highest value As a high-risk node pair.

[0084] The node pairs found using the MBET method satisfy the three conditions mentioned above: by finding two-jump edges, it ensures that the two nodes are not adjacent, while keeping the distance between them within a reasonable range. By finding the optimal two-jump edge, the node pairs with the highest attraction in the graph can be identified.

[0085] Specifically, step S5: High-risk node pair identification: in the reconstructed graph G The optimal two-hop edge detection algorithm is run to identify high-risk node pairs.

[0086] (1) Calculate the reconstructed graph The edge centrality of all edges in the set. For example, calculate the number of shortest paths between all pairs of nodes that pass through this edge. Assume there are 8 shortest paths passing through this edge, and the total number of shortest paths between all pairs of nodes in the reconstructed graph is 21 (the number of combinations of choosing 2 out of 7 nodes). Then the edge centrality of this edge is... .

[0087] (2) For the reconstructed graph For each node x in the array, iterate through all its unordered neighbor pairs. Calculate the motif centrality. (Based on nodes) For example, suppose its neighbor is Then the following unordered neighbor pairs exist:

[0088]

[0089]

[0090] (3) Traverse all nodes, calculate the motif centrality of all possible nodes, and select... The tuple with the highest value. Assuming it has been calculated... The tuple with the highest value is ,That If the value is 0.810, then select the node pair. As a high-risk node pair. Node and The following properties must be met: Two nodes are not directly adjacent (in the reconstructed graph, they are connected through nodes). Connect the nodes to form a 2-hop edge. The distance between the two nodes is moderate (4 hops apart in the original graph). This 2-hop edge has the highest motif centrality, indicating that it is the most important in the network. Figure 3 This is a graph showing the trend of the proportion of wormhole traffic in the network changing with the degree of node aggregation.

[0091] Regarding S6: Defense is implemented against high-risk node pairs corresponding to the aforementioned wormhole attacks. Specifically, for ordinary nodes other than high-risk nodes, to ensure energy efficiency, a neighbor threshold method is used for screening, followed by trust calculation to identify wormholes in suspicious nodes; while high-risk nodes periodically perform trust calculations to identify wormholes. For the neighbor threshold method, firstly, the algorithm updates the neighbor list of each node in the network and calculates the number of neighbors for each node. For each node i, its number of neighbors is recorded as L. i Set a neighbor threshold ratio W, if L i ≥W×N ave (where N) ave If the number of neighbors is the average number of nodes in the network, then the node is likely to be attacked by a wormhole, and it is added to the list of suspicious nodes. The preferred value for W is 1.2-1.4. Subsequently, the trust level of each suspicious node is calculated to filter for wormholes. For high-risk node pairs, the trust level is calculated directly, thus preventing attackers from using selective forwarding methods to render the neighbor threshold method ineffective. This ensures node efficiency while improving the defense against wormhole attacks.

[0092] Example 2 This embodiment provides a device for defending against wormhole attacks in a wireless sensor network, including: a construction module, a partitioning module, an acquisition module, a reconstruction module, a search module, and a defense module. The construction module is used to construct a weighted undirected graph corresponding to the nodes in the wireless sensor network. , For a set of nodes, Let be the set of edges. This is the set of edge weights. The partitioning module is used to partition the weighted undirected graph. The system is divided into multiple communities. A module is used to retrieve the key node set within each community. The reconstruction module is used to utilize the key node sets within each of the aforementioned communities. For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, The set of edge reconstruction weights is defined. A lookup module is used to retrieve weights from the reconstructed graph. The system identifies high-risk node pairs corresponding to wormhole attacks. A defense module is then used to defend against these high-risk node pairs.

[0093] Example 3 This embodiment provides an electronic device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the method for defending against wormhole attacks in a wireless sensor network.

[0094] The electronic device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The memory can be used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory.

[0095] Example 4 This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method for defending against wormhole attacks in a wireless sensor network.

[0096] Specifically, the memory may include high-speed random access memory, as well as non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital (SD) cards, flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.

[0097] Example 5 This invention provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the method described in the above embodiments of this invention.

[0098] The technical features of the embodiments described above can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. It should be noted that the terms "in one embodiment," "for example," and "again" in this invention are intended to illustrate the invention and are not intended to limit the invention.

[0099] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.

Claims

1. A method for defending against wormhole attacks in a wireless sensor network, characterized in that, include: S1: Construct a weighted undirected graph corresponding to the nodes in the wireless sensor network. , For a set of nodes, Let be the set of edges. For the set of edge weights; S2: For the weighted undirected graph The area was divided into multiple communities; S3: Obtain the set of key nodes within each community ; S4: Utilize the key node sets within each of the aforementioned communities For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, Reconstruct the weight set for the edges; S5: From the reconstructed graph Identify high-risk node pairs corresponding to wormhole attacks; S6: Defend against high-risk node pairs corresponding to the wormhole attack.

2. The method for defending against wormhole attacks in a wireless sensor network as described in claim 1, characterized in that, The set of edge weights Represented as: ={ } in, For nodes , Corresponding edges The weights, Representative node , Communication delay between them Representative node , Packet loss rate between Representative node , The number of packets transmitted between them.

3. The method for defending against wormhole attacks in a wireless sensor network as described in claim 1 or 2, characterized in that, S4 includes: from the weighted undirected graph Find the key node set within each of the aforementioned communities. and its corresponding set of edges Using formulas Determine the set of edge reconstruction weights ; in, For any two nodes , The shortest path projection between them For nodes , The electrical conductance projection between them For balancing parameters, and .

4. The method for defending against wormhole attacks in a wireless sensor network as described in claim 1, characterized in that, S3 includes: selecting multiple nodes with the highest external communication ratio (ECR) within each community as key nodes, and summarizing them to obtain a key node set. The external communication ratio (ECR(v)) of node v is: in, Representative node The number of times communication with nodes outside the community. Representative node Total number of communications.

5. The method for defending against wormhole attacks in a wireless sensor network as described in claim 4, characterized in that, S3 includes: in any community Select the one with the highest external communication ratio (ECR) Each node is considered a key node, and these nodes are aggregated to obtain the key node set. ;Community Number of key nodes The calculation formula is: in, Represents the total number of communities. Represents the total number of nodes in the network. Representing the community The number of internal nodes.

6. The method for defending against wormhole attacks in a wireless sensor network as described in claim 1, characterized in that, The S5 includes: For the reconstructed graph Each node Find the node The corresponding unordered neighbor pair set ,node ; Compute unordered neighbor pairs each tuple Corresponding phantom centrality ; The tuple corresponding to the maximum motif centrality node pairs As the high-risk node pair.

7. The method for defending against wormhole attacks in a wireless sensor network as described in claim 6, characterized in that, tuple The corresponding phantom centrality is expressed as: ; in, For nodes The edge centrality of the corresponding edge, For nodes The edge centrality of the corresponding edge.

8. A device for defending against wormhole attacks in a wireless sensor network, characterized in that, include: The building module is used to construct the weighted undirected graph corresponding to the nodes in a wireless sensor network. , For a set of nodes, Let be the set of edges. For the set of edge weights; The partitioning module is used to partition the weighted undirected graph. The area was divided into multiple communities; The acquisition module is used to acquire the set of key nodes within each community. ; The reconstruction module is used to utilize the key node sets within each of the aforementioned communities. For the weighted undirected graph Reconstruction yields the reconstructed graph. , For the set of key nodes The corresponding set of edges, Reconstruct the weight set for the edges; The lookup module is used to find the reconstructed graph. Identify high-risk node pairs corresponding to wormhole attacks; The defense module is used to defend against high-risk node pairs corresponding to the wormhole attack.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.