## 4 Security Analysis
### The Attacking Process after ACD Migration
#### 4.3.3 The Expected Time about Attacking  
In this subsection, the attacking process is analyzed on a longer and extended attack chain that has no closure on both ends to study the relative mobility of attacks, as shown in Figure 7. We also assume that the attacker has compromised \(k\) nodes. The martingale theory is adopted to calculate the expected time for the attacker to move to the next \(L\) node (i.e., node \(k+L^{\text{th}}\)) or be returned to the previous \(L\) node (i.e., node \(k-L^{\text{th}}\)). Martingale [29] is formally defined as:  
**Definition 1**. : _A stochastic process \(\{Z_{n},n\geq 1\}\) is said to be a martingale process if, for all \(n\), \(E[|Z_{n}|]<\infty\) and \(E[Z_{n+1}|Z_{1},Z_{2},\ldots,Z_{n}]=Z_{n}\)._We elaborate on the Markov chain, which structures a foundation for introducing the Martingale theory. When the attacker stays at the node \(k\) at the beginning of \(n^{th}\) migration period, the probabilities of the following states are expressed as follows:  
\[P\{X_{n+1}=k+1|X_{n}=k\}=(1-\omega)\mu, \tag{12}\]  
\[P\{X_{n+1}=k|X_{n}=k\}=(1-\omega)(1-\mu), \tag{13}\]  
\[P\{X_{n+1}=k-1|X_{n}=k\}=\omega. \tag{14}\]  
Hence,  
\[E[X_{n+1}|X_{n}=k]=k+(1-\omega)\mu-\omega=X_{n}+(1-\omega)\mu-\omega. \tag{15}\]  
Then we build a martingale sequence. Theorem 1: _Let \(M_{0},M_{1},\ldots,M_{n}\) be independent random variables, where \(M_{i}=X_{i}-[(1-\omega)\mu-\omega)\cdot i\), then the sequence \(M_{n}\) is a Martingale with respect to \(X_{0},X_{1},\ldots,X_{n}\)._  
Proof: It can be seen that \(E[|M_{n}|]<\infty\). As mentioned in Section 4.3.2, the random walk starts at the attacking entrance, i.e., \(X_{0}=0\). Then  
\[E[M_{n+1}|X_{0},X_{1},X_{2},\ldots,X_{n}]=E[M_{n+1}|X_{n}] \tag{16}\] \[= E[X_{n+1}-[(1-\omega)\mu-\omega]\cdot(n+1)|X_{n}]\] \[= E[X_{n+1}|X_{n}]-[(1-\omega)\mu-\omega]\cdot(n+1)\] \[= X_{n}+(1-\omega)\mu-\omega-[(1-\omega)\mu-\omega]\cdot(n+1)\] \[= X_{n}-[(1-\omega)\mu-\omega]\cdot n\] \[P\{X_{n+1}=k+1|X_{n}=k\}=(1-\omega)\mu, \tag{12}\]0  
\(\qed\)  
After building a Martingale sequence, we now need to calculate the attacking time by first addressing the stochastic stopping time. Definition 2: The positive inter-valued, possibly infinite, random variable \(N\) is said to be a random time for the process \(\{Z_{n},n\geq 1\}\) if the event {\(N=n\)} is determined by the random variables \(Z_{1},\cdots,Z_{n}\). That is, \(Z_{1},\cdots,Z_{n}\) determines whether or not \(N=n\). If \(P\{N<\infty\}=1\), then the random time \(N\) is said to be a stopping time. The overall movement direction of the attacker on the attack chain can be affected by the different relative strengths between defending and attacking abilities. For example, in case the attacking ability (\((1-\omega)\mu\)) is bigger than the defensive ability (\(\omega\)), then the attacker is getting closer to his target and vice versa. This means that the arrival time to the next \(L^{th}\) node tends to be positive, when \(E[X_{n+1}|X_{n}]>X_{n}\), i.e., \(\omega<\mu/(\mu+1)\). On the contrary, When \(E[X_{n+1}|X_{n}]<X_{n}\), i.e., \(\omega>\mu/(\mu+1)\), the probability of moving to the next node is smaller than this of returning to the previous node. Migrations exile the attacker who eventually loses all the obtained illegal privileges and hence the arrival time to the next \(L^{th}\) node tends to be \"negative\". However, the metric of \"time\" must be positive. So, we analyze the first arrival time to a specific node in different scenarios according to different relations between \(\omega\) and \(\mu/(\mu+1)\). \[P\{X_{n+1}=k+1|X_{n}=k\}=(1-\omega)\mu, \tag{12}\]1 The extension Markov chain. **A. **\(\omega<\mu/(\mu+1)\)  
In this case, the position at which an attack starts is denoted as the initial position, i.e., \(X_{0}=0\). **Definition 3**.