Energy-Efficient Patching Strategy for Wireless Sensor Networks

Wireless sensor networks (WSNs) are vulnerable to computer viruses. To protect WSNs from virus attack, the virus library associated with each sensor node must be updated in a timely way. This article is devoted to developing energy-efficient patching strategies for WSNs. First, we model the original problem as an optimal control problem in which (a) each control stands for a patching strategy, and (b) the objective functional to be optimized stands for the energy efficiency of a patching strategy. Second, we prove that the optimal control problem is solvable. Next, we derive the optimality system for solving the optimal control problem, accompanied with a few examples. Finally, we examine the effects of some factors on the optimal control. The obtained results help improve the security of WSNs.


Introduction
Smart sensor nodes, which are low-power devices equipped with a set of sensors, a processor, a memory, a power supply, a radio, and an actuator, can sense, measure, and gather information from the environment. Wireless sensor networks (WSNs), which are self-organized wireless networks of smart sensor nodes, are used to cooperatively transmit the sensed data to the base station [1]. See Figure 1 for a small-sized WSN. WSNs have important applications in many fields, ranging from military target surveillance and natural disaster relief to human health monitoring and hazardous environment exploration [2][3][4]. As WSNs are typically deployed in uncontrollable or even hostile environments, they are vulnerable to a wide range of cyberattacks. In particular, a cyber malefactor may launch a virus attack to the target WSN and perform intended malicious operations on each infected sensor node, ranging from stealing or falsifying the data in this node to destroying the node [5,6]. In the past few decades, numerous WSN-related virus accidents have been reported in the literature [7][8][9]. Consequently, protecting WSNs from virus attack has long been a major issue in the domain of cybersecurity [10].

The Energy-Efficient Patching Problem
To enable a WSN to automatically defend against virus attack, all sensor nodes in the network must be equipped with an intrusion response system (IRS). With the continual emergence of new viruses, the virus libraries associated with these IRSs must be updated in a timely manner to deal with new viruses [11]. For this purpose, new virus patches must be continually injected into a subset of sensor nodes from outside the network and then forwarded from patched node to unpatched node until the whole network is covered [12]. See Figure 2 for a diagram of patching the WSN shown in Figure 1. Technically, patching can be realized by reprogramming the underlying communication protocols [13][14][15]. From the perspective of defending against new viruses, new patches should be injected and forwarded as early as possible.
On the other hand, all sensor nodes in a WSN are with limited power resources. When the energy of a node is depleted, it will die and disconnect from the network [16][17][18]. As the lifetime of the network depends on the number of active nodes and the connectivity of the network, energy must be used efficiently to maximize the network lifetime. As patches are injected and forwarded at the energy cost, we face the following problem: Energy-efficient patching (EEP) problem: For a given WSN, develop an energy-efficient patching strategy. To our knowledge, to date this problem has not been addressed. This paper focuses on the EEP problem.

Our Research Approach and Related Work
Optimal control theory deals with the problem of finding a control law for a given dynamic system such that a certain performance index is optimized [19,20]. Many practical problems have been resolved using this theory [21][22][23]. In this paper, we are going to deal with the EEP problem in the framework of optimal control theory. The key to accomplishing this task is to measure the energy efficiency of a patching strategy. For this purpose, we need to accurately characterize the propagating process of digital viruses over a WSN.
In recent years, several WSN-oriented virus propagation models have been suggested. All these models build on the premise that the sensor nodes are distributed uniformly over a highly regular region (rectangular or circular, say). As a result, the virus propagation process can be characterized by a coarse-grained compartmental epidemic model [24][25][26][27][28][29][30][31]. For most real-world WSNs, however, the sensor nodes are distributed nonuniformly over a highly irregular region. Unfortunately, none of the above models applies to such WSNs.
The fine-grained node-level epidemic modeling [32,33] is especially suited to the characterization of propagation processes on arbitrary networks, because in the modeling process the topological structure of the network rather than its geometrical shape is accounted for. In recent years, this modeling technique has been successfully applied to diverse areas such as epidemic spreading [34], malware spreading [35][36][37][38][39][40], rumor spreading [41,42], and cybersecurity [43][44][45]. In this article, we are going to employ this modeling technique to establish a WSN-oriented virus-patch mixed propagation model. On this basis, we will model the EEP problem as an optimal control problem.

Main Contributions
This paper is devoted to dealing with the EEP problem. Our main contributions are overviewed as follows.
• By employing the node-level epidemic modeling technique, we establish a WSN-based virus-patch mixed propagation model. Thereby, we measure the energy efficiency of a patching strategy. On this basis, we model the EEP problem as an optimal control problem we refer to as the EEP model in which (a) each control stands for a patching strategy, and (b) the objective functional to be optimized stands for the energy efficiency of a patching strategy. • We show that the EEP model admits an optimal control and hence is solvable. We then give a necessary condition for optimal control of the EEP model, from which we conclude that the optimal control is bang-bang and hence is easily realizable. On this basis, we derive the optimality system for solving the EEP model and illustrate its application. Finally, we examine the effects of some factors on the optimal patching strategy.
The remaining materials are organized in this fashion: Section 2 introduces the EEP model. Sections 3 and 4 present a method for solving the EEP model and give a few numeric examples, respectively. Section 5 reveals the effects of some factors on the optimal patching strategy. This work is closed by Section 6.

The Modeling of the Energy-Efficient Patching Problem
This section is devoted to the modeling of the EEP problem following these steps: (1) introduce basic terms and notations, (2) establish a WSN-related virus-patch mixed propagation model, (3) formulate a patching strategy, (4) measure the energy efficiency of a patching strategy, and (5) model the EEP problem as an optimal control problem.

Terms and Notations
Consider a WSN that operates in the time horizon [0, T]. Let V = {1, 2, · · · , N} denote the set of all sensor nodes in the network. Let G = (V, E) denote the topological structure of the network, i.e., {i, j} ∈ E if and only if nodes i and j are within the communication range of each other. Let A = a ij N×N denote the adjacency matrix of G, i.e., a ij = 1 or 0 according as {i, j} ∈ E or not.
For our purpose, all nodes in the network are classified as three categories: susceptible nodes, infected nodes, and patched nodes. A susceptible node is one that is not infected with virus and has not received the newest patch. As a result, it is vulnerable to the viruses that can be handled only with the newest patch. An infected node is one that is infected with virus. A patched node is one that is not infected with virus and has received the newest patch. As a result, it is immune of all viruses. Let X i (t) = 0, 1, and 2 denote that node i is susceptible, infected, and patched at time t, respectively. Then the vector X(t) = (X 1 (t), · · · , X N (t)) (1) stands for the state of the network at time t. Let S i (t), I i (t), and P i (t) denote the probability of node i being susceptible, infected, and patched at time t, respectively.
stands for the expected state of the network at time t.

Remark 1.
The initial network expected state E(0) can be estimated employing network probe.

A Virus-Patch Mixed Propagation Model
For our purpose, we need to establish a WSN-related virus-patch mixed propagation model. To this end, let us make a set of hypotheses as follows.

Hypothesis 1.
Due to the emergence of new virus, each patched node becomes susceptible at an average rate of δ, which we refer to as the patch failure rate.

Hypothesis 2.
Due to the injection of a new virus, each susceptible node gets infected at an average rate of β I . We refer to β I as the virus injection rate.

Hypothesis 3.
Due to the impact of the infected node j, each susceptible node i with a ij = 1 gets infected at an average rate of β P , which we refer to as the virus propagation rate.

Hypothesis 4.
Due to the injection of new patch, each unpatched node gets patched at time t at the rate of γ I (t), which we refer to as the patch injection rate at time t.

Hypothesis 5.
Due to the influence of the patched node j, each unpatched node i with a ij = 1 gets patched at time t at the rate of γ F (t), which we refer to as the patch forwarding rate at time t.

Remark 2.
The patch failure rate δ, the virus injection rate β I , and the virus propagation rate β P can be estimated through collecting and analyzing the relevant historical data. Figure 3 shows the above hypotheses schematically. By the theory on continuous-time Markov chain [46], each susceptible node i gets infected at time t at an average rate of β I + β P ∑ N j=1 a ij I j (t), and each infected node i gets patched at time t at the average rate of γ I (t) + γ F (t) ∑ N j=1 a ij P j (t). It follows by Total Probability Formula that I i (t) ascends at time t at an average rate of Similarly, P i (t) ascends at time t at an average rate of Combining the above discussions, the expected state of the network obeys the following differential system: We refer to the system as a WSN-oriented virus-patch mixed propagation model.

Formulating a Patching Strategy
We refer to the function γ I (t) (0 ≤ t ≤ T) as a patch injection strategy, the function γ F (t) (0 ≤ t ≤ T) as a patch forwarding strategy, and the two-dimensional vector-valued function u defined by as a patching strategy. The patching strategy is under control of the network administrator. In this paper, we assume the admissible set of patching strategy is where L[0, T] stands for the set of all Lebesgue integrable functions defined on the interval [0, T] [47].

Remark 3.
The maximum allowable patch injection rate γ I is determined by the budget for developing new patches. The maximum allowable patch forwarding rate γ F is determined by the energy budget for forwarding patches.
In this context, we may write the model (4) in matrix notation as follows.

Measuring the Energy Efficiency of a Patching Strategy
This subsection is dedicated to estimating the energy efficiency of a patching strategy. The energy efficiency of a patching strategy u = (γ I , γ F ) consists of two parts: the losses caused by viruses, and the energy cost used for patching. For our purpose, let us introduce a pair of hypotheses as follows.
Hypothesis 6. The average loss per unit time caused by each infected node is w 1 units (dollars, say), which we refer to as the loss coefficient. Hypothesis 7. The average energy cost per unit time used for each node to transmit or receive patches at a rate of γ is w 2 γ units. We refer to w 2 as the energy coefficient.

Remark 4.
The loss coefficient w 1 can be estimated by estimating the average value of the environmental data gained by the sensor nodes in the network. The energy coefficient w 2 is a common physical parameter of the sensor nodes in the network.
According to the hypothesis (H 6 ), the average loss caused by the node i in the infinitesimal time horizon [t, t + dt) is w 1 dt or zero according as this node is infected or not at time t. Therefore, the expected loss caused by the node i in the infinitesimal time Similarly, the expected energy overhead of the whole network for transmitting patches in the time a ij P j (t)dt. (9) and the expected energy overhead of the whole network for receiving patches in the time horizon Hence, the expected energy overhead of the whole network for transmitting and receiving patches in the time horizon [0, T] is Combining the above discussions, we conclude that the energy efficiency of the patching strategy u can be measured by

The Modeling of the EEP Problem
Based on previous discussions, we model the EEP problem as the following optimal control problem: Here, We refer to this optimal control problem as the EEP model. In the model, each admissible control stands for an allowable patching strategy, the objective functional stands for the energy efficiency of an allowable patching strategy, and each optimal control stands for an EEP strategy.
The EEP model (13) is determined by the 10-tuple

A Method for Solving the EEP Model
In the previous section, the EEP problem was modeled as an optimal control problem we refer to as the EEP model. This section is dedicated to deriving a systematic method for solving the EEP model using optimal control theory. First, we show that the EEP model is solvable. Second, we give a necessary condition for optimal control of the EEP model. On this basis, we present the optimality system for solving the EEP model.

The Solvability of the EEP Model
First, let us examine the solvability of the EEP model. For this purpose, we need the following lemma, which is a direct corollary of a classical theorem in optimal control theory [20]. Lemma 1. The EEP model (13) has an optimal control if the following five conditions hold simultaneously.
(C 1 ) U is closed and convex. (C 2 ) There is u ∈ U such that the affiliated model (7) is solvable.
The main result in this subsection is given below.
Let u (1) , u (2) ∈ U , 0 < α < 1. As L[0, T] 2 is a real vector space, we have (1 − α)u (1) + αu (2) ∈ L[0, T] 2 . Hence, the convexity of U follows from the observation that for 0 ≤ t ≤ T, there hold The first condition of Lemma 1 is proven. Let u(t) ≡ (γ I , γ F ). Then u ∈ U . As F(E, u) is continuously differentiable, it follows by Continuation Theorem for Differential Systems [48] that the model (7) is solvable. The second condition is proven. The third condition follows from the boundedness of I i , P i , and u, and the fourth condition follows from that L is linear in u and hence is convex. The fifth condition follows from the observation that By Lemma 1, the proposition holds.

A Necessary Condition for Optimal Control of the EEP Model
For our purpose, we need to give a necessary condition for optimal control of the EEP model. To this end, consider the Hamiltonian of the EEP model (13), which is given by where z(t) = (λ 1 (t), · · · , λ N (t), µ 1 (t), · · · , µ N (t)) (0 ≤ t ≤ T) is the adjoint.
A necessary condition for optimal control of the EEP model is given below.

Theorem 2.
Suppose u is an optimal control of the EEP model (13), E is the solution to the affiliated model (7). Then there exists z with z(T) = 0 such that Moreover, Proof. According to Pontryagin Minimum Principle [20], there exists z such that Thus, the system (17) follows by direct calculations. As the terminal cost is unspecified, and the final state is free, the transversality condition z(T) = 0 holds. Finally, by using the optimality condition we have u(t) = arg min u∈U H(E(t), u(t), z(t)), 0 ≤ t ≤ T.

Remark 5.
By this theorem, every optimal control of the EEP model (13) is bang-bang and hence easily realizable.

The Optimality System for the EEP Model
By optimal control theory, the systems (4), (17), (18), and (19) together with E(0) = E 0 and z(T) = 0 constitute the optimality system for the EEP model (13). In view of the existence of optimal control, we can get an optimal control of the EEP model by solving the optimality system using Forward-Backward Euler Scheme.

Numerical Examples
In the previous section, we presented the optimality system for solving the EEP model (13). In this section, we solve three instances of the EEP model to get their respective optimal controls. For this purpose, consider the real-world WSN given in [49] in which there are 66,917 nodes and 885,441 edges. Denote this network by G. First, we take a subnet G 1 with 100 nodes from G, which is plotted in Figure 4.

Example 1.
Consider the instance of the EEP model in which G = G 1 , T = 10, β I = 0.2, β P = 0.15, δ = 0.1, w 1 = w 2 = 1, γ I = 0.4, γ F = 0.3, and E 0 = (0.3, · · · , 0.3). By solving the corresponding optimality system, we get an optimal control u opt , which is shown in Figure 5a. It is seen that either of the two components of u opt is bang-bang, as expected by Theorem 2. Furthermore, it is seen that either of the two components of u opt first stays at the maximum allowable rate, then abruptly drops to the zero rate, and finally stays at the zero rate.
Let A = {0, 0.04, 0.08, · · · , 0.4}, B = {0, 0.03, 0.06, · · · , 0.3}. For g ∈ A, h ∈ B, let u g,h = (γ g,h I , γ g,h F ) denote the static control with γ g,h Figure 5b plots J(u) for all u ∈ u opt u g,h |g ∈ A, h ∈ B . It is seen that u opt is superior to all the static controls in terms of the energy efficiency, as expected. Second, we take a subnet G 2 with 300 nodes from G, which is exhibited in Figure 6.

Example 2.
Consider the instance of the EEP model in which G = G 2 , T = 10, β I = 0.2, β P = 0.15, δ = 0.1, w 1 = w 2 = 1, γ I = 0.4, γ F = 0.3, and E 0 = (0.3, · · · , 0.3). By solving the corresponding optimality system, we get an optimal control u opt , which is shown in Figure 7a. It is seen that either of the two components of u opt is bang-bang, as expected by Theorem 2. Again, it is seen that either of the two components of u opt first stays at the maximum allowable rate, then abruptly drops to the zero rate, and finally stays at the zero rate. Let A = {0, 0.04, 0.08, · · · , 0.4}, B = {0, 0.03, 0.06, · · · , 0.3}. For g ∈ A, h ∈ B, let u g,h = (γ g,h Figure 7b plots J(u) for all u ∈ u opt u g,h |g ∈ A, h ∈ B . Again, it is seen that u opt outperforms all the static controls in terms of the energy efficiency, as expected. Finally, we take a subnet G 3 with 500 nodes from G, which is displayed in Figure 8.
, and E 0 = (0.3, · · · , 0.3). By solving the corresponding optimality system, we get an optimal control u opt , which is shown in Figure 9a. It is seen that either of the two components of u opt is bang-bang, as expected by Theorem 2. Once more, it is seen that either of the two components of u opt first stays at the maximum allowable rate, then abruptly drops to the zero rate, and finally stays at the zero rate. Let A = {0, 0.04, 0.08, · · · , 0.4}, B = {0, 0.03, 0.06, · · · , 0.3}. For g ∈ A, h ∈ B, let u g,h = (γ g,h Figure 9b plots J(u) for all u ∈ u opt u g,h |g ∈ A, h ∈ B . Also, it is seen that u opt overmatches all the static controls in terms of the energy efficiency, as expected. (i) For each instance of the EEP model, the patch injection strategy in the optimal patching strategy obtained by solving the optimality system first attains the maximum allowable patch injection rate for a period of time, then jumps sharply to the zero rate, and finally keeps the zero rate for the remaining period of time. (ii) For each instance of the EEP model, the patch forwarding strategy in the optimal patching strategy obtained by solving the optimality system first attains the maximum allowable patch forwarding rate for a period of time, then jumps sharply to the zero rate, and finally keeps the zero rate for the remaining period of time.
In practice, such patching strategies are easily implementable. Therefore, we recommend to WSN administrators the EEP strategies obtained in this way.

Further Discussions
In the previous section, a method for calculating EEP strategies for WSNs was presented. In this section, we experimentally examine the effects of some factors on the optimal patching strategy obtained in this way.

The Effects of the Loss and Energy Coefficients
First, we study the effects of the loss coefficient and the energy coefficient on the optimal patching strategy, respectively.

Experiment 1. Consider a set of instances of the EEP model in which
(a) Suppose w 2 = 1, w 1 ∈ {0.25, 0.5, 1, 2}. By solving these optimality systems, we get the respective optimal patching strategies, in which the patch injection strategies and the patch forwarding strategies are depicted in Figure 10a-c and Figure 10c-f, respectively. It is seen that with the increase of w 1 , the jump point of either of the patch injection strategy and the patch forwarding strategy in u opt moves to the right. (b) Suppose w 1 = 1, w 2 ∈ {0.25, 0.5, 1, 2}. By solving these optimality systems, we get the respective optimal patching strategies, in which the patch injection strategies and the patch forwarding strategies are exhibited in Figure 11a-c and Figure 11c-f, respectively. It is seen that with the increase of w 2 , the jump point of either of the patch injection strategy and the patch forwarding strategy in u opt moves to the left. From this experiment and 100 similar experiments, we conclude the following results about the EEP model: (i) With the increase of the loss coefficient, the jump point of the patch injection strategy in the optimal patching strategy obtained by solving the optimality system moves to the right, as does the jump point of the patch forwarding strategy in the optimal patching strategy. Hence, with the increase of the loss coefficient, the energy overhead for patching must be enhanced to achieve a higher energy efficiency. (ii) With the increase of the energy coefficient, the jump point of the patch injection strategy in the optimal patching strategy obtained by solving the optimality system moves to the left, as does the jump point of the patch forwarding strategy in the optimal patching strategy. Hence, with the increase of the energy coefficient, the energy overhead for patching must be reduced to achieve a higher energy efficiency.

The Effects of the Maximum Allowable Patch Injection and Forwarding Rates
Second, let us inspect the effects of the maximum allowable patch injection rate and the maximum allowable forwarding rates on the optimal patching strategy, respectively. From this experiment and 100 similar expects, we conclude the following results about the EEP problem:

Experiment 2. Consider a set of instances of the EEP model in which
(i) With the increase of the maximum allowable patch injection rate, the jump point of the patch injection strategy in the optimal patching strategy moves to the left, so does the jump point of the patch forwarding strategy in the optimal patching strategy. Hence, with the increase of the maximum allowable patch injection rate, the energy overhead for patching must be reduced to achieve a higher energy efficiency. (ii) With the increase of the maximum allowable patch forwarding rate, the jump point of the patch injection strategy in the optimal patching strategy moves to the left, so does the jump point of the patch forwarding strategy in the optimal patching strategy. Hence, with the increase of the maximum allowable patch forwarding rate, the energy overhead for patching must be reduced to achieve a higher energy efficiency.

Concluding Remarks
This article has studied the problem of developing EEP strategies for WSNs. Based on a novel virus-patch mixed propagation model, the problem has been modeled as an optimal control problem. The solvability of this optimal control problem has been proved, and a systematic method for solving the optimal control problem has been presented. These results may help us to defending against virus attacks to WSNs in an energy-efficient way.
Still, there are some relevant problems that are worth study. The practicality of the proposed EEP strategies should be considered very carefully. This work builds on the premise that virus patches can be injected into any of the sensor nodes in the WSN. In practice, however, patches can be injected into only those nodes that are in the proximity of the base station. Therefore, this work should be extended to such scenarios. In this paper, the virus attack strategy is assumed to be static. In practice, the malefactor may intelligently change the attack strategy over time to gain a larger benefit. In this situation, it is appropriate to study the EEP problem in the framework of game theory [50][51][52][53][54][55][56].
Author Contributions: All authors of this article have made substantial contributions in all aspects of this work, including problem modeling, theoretical analysis, computer experiments, and writing.