Adaptive Honeypot Engagement through Reinforcement Learning of Semi-Markov Decision Processes
Linan Huang Quanyan Zhu




Adaptive Honeypot Engagement








L. Huang and Q. Zhu



Department of Electrical and Computer Engineering, New York University

 2 MetroTech Center, Brooklyn, NY, 11201, USA 

{lh2328,qz494}@nyu.edu


Adaptive Honeypot Engagement through Reinforcement Learning of Semi-Markov Decision Processes
    Linan Huang Quanyan ZhuThis research is supported in part by NSF under grant ECCS-1847056, CNS-1544782, and SES-1541164, and in part by ARO grant W911NF1910041.
    

====================================================================================================================================================================




A honeynet is a promising active cyber defense mechanism. It reveals the fundamental Indicators of Compromise (IoCs) by luring attackers to conduct adversarial behaviors in a controlled and monitored environment. 
The active interaction at the honeynet brings a high reward but also introduces high implementation costs and risks of adversarial honeynet exploitation.  
In this work, we apply infinite-horizon Semi-Markov Decision Process (SMDP) to characterize a stochastic transition and sojourn time of attackers in the honeynet and quantify the reward-risk trade-off. 
In particular, we design adaptive long-term engagement policies shown to be risk-averse, cost-effective, and time-efficient. 
Numerical results have demonstrated that our adaptive engagement policies can quickly attract  attackers to the target honeypot and engage them for a sufficiently long period to obtain worthy threat information. Meanwhile, the penetration probability is kept at a low level. 
 The results show that the expected utility is robust against attackers of a large range of persistence and intelligence. 
Finally, we apply reinforcement learning to the SMDP to solve the curse of modeling. 
Under a prudent choice of the learning rate and exploration policy, we achieve a quick and robust convergence of the optimal policy and value. 








§ INTRODUCTION

Recent instances of  ransomware attack and  malware have demonstrated an inadequacy of traditional cybersecurity techniques such as the firewall and intrusion detection systems. 
These passive defense mechanisms can detect low-level Indicators of Compromise (IoCs) 
such as hash values, IP addresses, and domain names. 
However, they can hardly disclose high-level indicators such as attack tools and Tactics, Techniques and Procedures (TTPs) of the attacker, which induces the attacker fewer pains to adapt to the defense mechanism, evade the indicators, and launch revised attacks as shown in the pyramid of pain <cit.>. 
Since high-level indicators are more effective in deterring emerging advanced attacks yet harder to acquire through the traditional passive mechanism, defenders need to adopt active defense paradigms to learn these fundamental characteristics of the attacker, attribute cyber attacks <cit.>, and design defensive countermeasures correspondingly. 

Honeypots are one of the most frequently employed active defense techniques to gather information on threats. 
A honeynet is a network of honeypots, which emulates the real production system but has no production activities nor authorized services.  
Thus, an interaction with a honeynet, e.g., unauthorized inbound connections to any honeypot, directly reveals malicious activities.  
On the contrary, traditional passive techniques such as firewall logs or IDS sensors have to separate attacks from a ton of legitimate activities, thus provide much more false alarms and may still miss some unknown attacks. 

Besides a more effective identification and denial of adversarial exploitation through low-level indicators such as the inbound traffic, a honeynet can also help defenders to achieve the goal of identifying attackers' TTPs under proper engagement actions. The defender can interact with attackers and allow them to probe and perform in the honeynet until she has learned the attacker's fundamental characteristics. 
More services a honeynet emulates, more activities an attacker is allowed to perform, and a higher degree of interactions together result in a  larger revelation probability of the attacker's TTPs. 
However, the additional services and reduced restrictions also bring extra risks. Attacks may use some honeypots as  pivot nodes to launch attackers against other production systems <cit.>. 


The current honeynet applies the honeywall as a gateway device to supervise outbound data and separate the honeynet from other production systems, as shown in Fig. <ref>. 
However, to avoid attackers' identification of the data control and the honeynet, a defender cannot block all outbound traffics from the honeynet, which leads to a trade-off between the rewards of learning high-level IoCs and the following three types of risks. 
 


  T1: Attackers identify the honeynet and thus either terminate on their own or generate misleading interactions with honeypots. 

  T2: Attackers circumvent the honeywall to penetrate other production systems <cit.>. 

  T3: Defender's engagement costs outweigh the investigation reward.  


We quantify risk T1 in Section <ref>, T2  in Section <ref>, and T3 in Section <ref>. 
In particular, risk T3 brings the problem of timeliness and optimal decisions on timing. 
Since a persistent traffic generation to engage attackers is costly and the defender aims to obtain timely threat information, the defender needs cost-effective policies to lure the attacker quickly to the target honeypot and reduce attacker's sojourn time in honeypots of low-investigation value. 




To achieve the goal of long-term, cost-effective policies,  we construct the Semi-Markov Decision Process (SMDP) in Section <ref> on the network shown in Fig. <ref>. 
Nodes 1 to 11 represent different types of honeypots, nodes 12 and 13 represent the domain of the production system and the virtual absorbing state, respectively. 
The attacker transits between these nodes according to the network topology in Fig. <ref> and can remain at different nodes for an arbitrary period of time. 
The defender can dynamically change the honeypots' engagement levels such as the amount of outbound traffic, to affect the attacker's sojourn time, engagement rewards, and the probabilistic transition in that honeypot. 


In Section <ref>, we define security metrics related to our attacker engagement problem and analyze the risk both theoretically and numerically.  
These metrics answer important security questions in the honeypot engagement problem as follows.   
How likely will the attacker visit the normal zone at a given time? How long can a defender engage the attacker in a given honeypot before his first visit to the normal zone? How attractive is the honeynet if the attacker is initially in the normal zone?   
To protect against the Advanced Persistent Threats (APTs), we further investigate the engagement performance against attacks of different levels of persistence and intelligence. 

Finally, for systems with a large number of governing random variables, it is often hard to characterize the exact attack model, which is referred to as the curse of modeling. 
Hence, we apply reinforcement learning methods in Section <ref> to learn the attacker's behaviors represented by the parameters of the SMDP. We visualize the convergence of the optimal engagement policy and the optimal value in a video demo[See the demo following URL: <https://bit.ly/2QUz3Ok>]. 
In Section <ref>, we discuss challenges and future works of reinforcement learning in the honeypot engagement scenario where the learning environment is non-cooperative, risky, and sample scarce. 



























 §.§ Related Works

Active defenses <cit.> and defensive deceptions <cit.> to detect and deter attacks have been active research areas. Techniques such as
honeynets <cit.>, moving target
defense <cit.>, obfuscation <cit.>,
and perturbations <cit.> have been introduced as defensive mechanisms to secure the cyberspace. 
The authors in <cit.> and <cit.> design two proactive defense schemes where the defender can manipulate the adversary's belief and take deceptive precautions under stealthy attacks, respectively.  
In particular, many works <cit.> including ones with Markov Decision Process (MDP) models <cit.> and game-theoretic models <cit.> 
 focus on the adaptive honeypot deployment, configuration, and detection evasion to effectively gather threat  information without the attacker's notice.  A number of quantitative frameworks have been proposed to model proactive defense for various attack-defense scenarios building on Stackelberg games <cit.>, signaling games <cit.>, dynamic games <cit.>, and mechanism design theory <cit.>. Pawlick et al. in <cit.> have provided a recent survey of game-theoretic methods for defensive deception, which includes a taxonomy of deception mechanisms and an extensive literature of game-theoretic deception.
 

Most previous works on honeypots have focused on studying the attacker's break-in attempts yet pay less attention to engaging the attacker after a successful penetration so that the attackers can thoroughly expose their post-compromise behaviors.  
Moreover, few works have investigated timing issues and risk assessment during the honeypot engagement, which may result in an improper engagement time and uncontrollable risks. 
The work most related to this one is <cit.>, which introduces a continuous-state infinite-horizon MDP model where the defender decides when to eject the attacker from the network. The author assumes a maximum amount of information that a defender can learn from each attack. The type of systems, i.e., either a normal system or a honeypot,   determines the transition probability. 
Our framework, on the contrary, introduces following additional distinct features: 


  * The upper bound on the amount of information which a defender can learn is hard to obtain and may not even exist. Thus, we consider a discounted factor to penalize the timeliness as well as the decreasing amount of unknown information as time elapses. 

  * The transition probability not only depends on the type of systems but also depends on the network topology and the defender's actions. 

  * The defender endows attackers the freedom to explore the honeynet and affects the transition probability and the duration time through different engagement actions. 

  * 
We use reinforcement learning methods to learn the parameter of the SMDP model. 
Since our learning algorithm constantly updates the engagement policy based on the up-to-date samples obtained from the honeypot interactions, the acquired optimal policy adapts to the potential evolution of attackers' behaviors. 


SMDP generalizes MDP by considering the random sojourn time at each state, and is widely applied to machine maintenance <cit.>, resource allocation <cit.>, infrastructure protection <cit.>, and cybersecurity <cit.>. 
This work aims to leverage the SMDP framework to determine the optimal attacker engagement policy and to quantify the trade-off between the value of the investigation and the risk. 






 §.§ Notations

Throughout the paper, we use calligraphic letter 𝒳 to define a set. The upper case letter X denotes a random variable and the lower case x represents its realization. The boldface 𝐗 denotes a vector or matrix and 𝐈 denotes an identity matrix of a  proper dimension. 
Notation  represents the probability measure and 
⋆ represents the convolution. 
 The indicator function 1_{x=y} equals one if x = y, and zero if x≠ y. 
The superscript k represents decision epoch k and the subscript i is the index of a node or a state. 
The pronoun `she' refers to the defender, and `he' refers to the attacker. 



§ PROBLEM FORMULATION


To obtain optimal engagement decisions at each honeypot under the probabilistic transition and the continuous sojourn time, we introduce the continuous-time infinite-horizon discounted SMDPs, which can be summarized by the tuple 
{t∈ [0,∞), 𝒮,
𝒜(s_j), 
tr(s_l| s_j, a_j),  
z(·| s_j,a_j,s_l), r^γ( s_j,a_j,s_l), γ∈ [0,∞)}. 
We describe each element of the tuple in this section. 


 §.§ Network Topology

We abstract the structure of the honeynet as a finite graph 𝒢=(𝒩,ℰ). 
The node set 𝒩:={n_1,n_2,⋯,n_N}∪{n_N+1} contains N nodes of hybrid honeypots. Take Fig. <ref> as an example, 
a node can be either a virtual honeypot of an integrated database system or a physical honeypot of an individual computer. 
These nodes provide different types of functions and services, and are connected following the topology of the emulated production system. 
Since we focus on optimizing the value of investigation in the honeynet, we only distinguish between different types of honeypots in different shapes, yet use one extra node n_N+1 to represent the entire domain of the production system. 
The network topology ℰ:={e_jl}, j,l∈𝒩, is the set of directed links connecting node n_j with n_l, and represents all possible transition trajectories in the honeynet. 
The links can be either physical (if the connecting nodes are real facilities such as computers) or logical (if the nodes represent integrated systems). 
Attackers cannot break the topology restriction. 


Since an attacker may use some honeypots as pivots to reach a production system, and it is also possible for a defender to attract attackers from the normal zone to the honeynet through these bridge nodes, there exist links of both directions between honeypots and the normal zone. 



 §.§ States and State-Dependent Actions

At time t∈ [0,∞), an attacker's state belongs to a finite set 𝒮:={s_1, s_2, ⋯, 
s_N, 
s_N+1,s_N+2} where s_i, i∈{1,⋯,N+1}, represents the attacker's location at time t. 
Once attackers are ejected or terminate on their own, we use the extra absorbing state s_N+2 to represent the virtual location. 
The attacker's state reveals the adversary visit and exploitation of the emulated functions and services. 
Since the honeynet provides a controlled environment, we assume that the defender can monitor the state and     transitions persistently without uncertainties. 

The attacker can visit a node multiple times for different purposes. A stealthy attacker may visit the honeypot node of the database more than once and revise data progressively (in a small amount each time) to evade detection. 
An attack on the honeypot node of sensors may need to frequently check the node for the up-to-date data. 
Some advanced honeypots may also emulate anti-virus systems or other protection mechanisms such as setting up an authorization expiration time, then the attacker has to compromise the nodes repeatedly. 


At each state s_i∈𝒮,  the defender can choose an action a_i from a state-dependent finite set 𝒜(s_i). 
For example, at each honeypot node, the defender can conduct action a_E to eject the attacker, action a_P to purely record the attacker's activities, low-interactive action  a_L, or high-interactive action a_H to engage the attacker, i.e., 𝒜(s_i):={a_E, a_P,a_L,a_H}, i∈{1,⋯,

N}. 
The high-interactive action is costly to implement yet both increases the probability of a longer sojourn time at honeypot n_i, and reduces the probability of attackers penetrating the normal system from n_i if connected. 
If the attacker resides in the normal zone either from the beginning or later through the pivot honeypots, the defender can choose either action a_E to eject the attacker immediately, or action a_A to attract the attacker to the honeynet by exposing some  vulnerabilities intentionally, i.e., 𝒜(s_N+1):={a_E,a_A}.  
Note that the instantiation of the action set and the corresponding consequences are not limited to the above scenario. For example, the action can also refer to a different degree of outbound data control. A strict control reduces the probability of attackers penetrating the normal system from the honeypot, yet also brings less investigation value. 


 §.§ Continuous-Time Process and Discrete Decision Model


Based on the current state s_j∈𝒮, the defender's action a_j∈𝒜(s_j), the attacker transits to state s_l∈𝒮 with a probability tr(s_l|s_j,a_j) and the sojourn time at state s_j is a continuous random variable with a probability density z(·| s_j,a_j, s_l). 
Note that the risk T1 of the attacker identifying the honeynet at state s_j under action a_j≠ A_E
can be characterized by the transition probability tr(s_N+2|s_j,a_j) as well as the duration time z(·| s_j,a_j,s_N+2).  

Once the attacker arrives at a new honeypot n_i, the defender dynamically applies an interaction action at  honeypot n_i from 𝒜(s_i) and keeps interacting with the attacker until he transits to the next honeypot. 
The defender may not change the action before the transition to reduce the probability of attackers detecting the change and  become aware of the honeypot engagement. 

Since the decision is made at the time of transition, we can transform the above continuous time model on horizon t∈ [0,∞) into a discrete decision model at decision epoch k∈{0,1,⋯, ∞}. 
The time of the attacker's k^th transition is denoted by a random variable T^k, the landing state is denoted as s^k∈𝒮, and the adopted action  after arriving at s^k is denoted as a^k∈𝒜(s^k). 



 §.§ Investigation Value


The defender gains a reward of investigation by engaging and analyzing the attacker in the honeypot. 
To simplify the notation, we divide the reward during time t∈ [0,∞) into ones at discrete decision epochs T^k, k∈{0,1,⋯, ∞}. 
When τ∈ [T^k,T^k+1] amount of time elapses at stage k, the defender's reward of investigation

    r(s^k,a^k,s^k+1,T^k,T^k+1,τ)=r_1(s^k,a^k,s^k+1)1_{τ=0}+r_2(s^k,a^k, T^k,T^k+1,τ),

at time τ of stage k, is the sum of two parts. The first part is the immediate cost of applying engagement action a^k ∈𝒜(s^k) at state s^k ∈𝒮 and the second part is the reward rate of threat information acquisition minus the cost rate of persistently generating deceptive traffics. 
Due to the randomness of the attacker's behavior, the information acquisition can also be random, thus the actual reward rate r_2 is perturbed by an additive zero-mean noise w_r. 

Different types of attackers target different components of the production system. For example, an attacker who aims to steal data will take intensive adversarial actions at the database.
Thus, if the attacker is actually in the honeynet and adopts the same behavior as he is in the production system, the defender can identify the target of the attack based on the traffic intensity. 
We specify r_1 and r_2 at each state properly to measure the risk T3. 
To maximize the value of the investigation, the defender should choose proper actions to lure the attacker to the honeypot emulating the target of the attacker in a short time and with a large probability. 
Moreover, the defender's action should be able to engage the attacker in the target honeypot actively for a longer time to obtain more valuable threat information. 
We compute the optimal long-term policy that achieves the above objectives in Section <ref>. 

As the defender spends longer time interacting with attackers, investigating their behaviors and acquires better understandings of their targets and TTPs, less new information can be extracted. 
In addition, the same intelligence becomes less valuable as time elapses due to the  timeliness. 
Thus, we use a discounted factor of γ∈ [0,∞) to penalize the decreasing value of the investigation as time elapses. 



 §.§ Optimal Long-Term Policy


The defender aims at a policy π∈Π which maps state s^k∈𝒮 to action a^k∈𝒜(s^k) to maximize the long-term expected utility starting from state s^0, i.e., 

    u(s^0,π)=𝔼[∑_k=0^∞∫_T^k^T^k+1 e^-γ(τ+T^k) (r(S^k,A^k,S^k+1,T^k,T^k+1,τ)+w_r)dτ].


At each decision epoch, the value function v(s^0)=sup_π∈Πu(s^0,π) can be represented by dynamic programming, i.e., 

    v(s^0)=sup_a^0∈𝒜(s^0)𝔼[∫_T^0^T^1 e^-γ (τ+T^0)r(s^0,a^0,S^1,T^0,T^1,τ)dτ+e^-γ T^1v(S^1)].


We assume a constant reward rate r_2(s^k,a^k,T^k,T^k+1,τ)=r̅_2(s^k,a^k) for simplicity. 
Then, (<ref>) can be transformed into an  equivalent  MDP form, i.e., ∀ s^0∈𝒮, 

    v(s^0)=sup_a^0∈𝒜(s^0)∑_s^1∈𝒮 tr(s^1|s^0,a^0) (r^γ(s^0,a^0,s^1)+z^γ(s^0,a^0,s^1)v(s^1)),

where z^γ(s^0,a^0,s^1):=∫_0^∞e^-γτ z(τ|s^0,a^0,s^1)dτ∈ [0,1] is the Laplace transform of the sojourn probability density z(τ|s^0,a^0,s^1) and the equivalent reward 
r^γ(s^0,a^0,s^1)
:=r_1(s^0,a^0,s^1)+r̅_2(s^0,a^0)/γ (1-z^γ(s^0,a^0,s^1))∈ [-m_c,m_c] is assumed to be bounded by a constant m_c. 

A classical regulation condition of SMDP to avoid the probability of an infinite number of transitions within a finite time is stated as follows:  there exists constants θ∈ (0,1) and δ>0 such that 

    ∑_s^1∈𝒮 tr(s^1|s^0,a^0) z(δ |s^0,a^0,s^1)≤ 1-θ , ∀ s^0∈𝒮, a^0 ∈𝒜(s^0).

It is shown in <cit.> that condition (<ref>) is equivalent to  
∑_s^1∈𝒮  tr(s^1|s^0,a^0) z^γ(s^0,a^0,s^1)∈ [0,1),
which serves as the equivalent  stage-varying discounted factor for the associated MDP. 
Then, the right-hand side of (<ref>) is a contraction mapping and there exists a unique optimal policy π^*=argmax_π∈Πu(s^0,π) which can be found by value iteration, policy iteration or linear programming. 



  §.§.§ Cost-Effective Policy

The computation result of our 13-state example system is illustrated in Fig. <ref>. 
The optimal policies at honeypot nodes n_1 to n_11 are represented by different colors. Specifically, actions a_E,a_P,a_L,a_H are denoted in red, blue, purple, and green, respectively. The size of node n_i represents the state value v(s_i).  

In the example scenario, the honeypot of database n_10 and  sensors  n_11 are the main and secondary targets of the attacker, respectively. Thus, defenders can obtain a higher investigation value when they manage to engage the attacker in these two honeypot nodes with a larger probability and for a longer time. 
However, instead of naively adopting high interactive actions,  
a savvy defender also balances the high implantation cost of a_H. Our quantitative results indicate that the high interactive action should only be applied at n_10 to be cost-effective. 
On the other hand, although the bridge nodes n_1,n_2,n_8 which connect to the normal zone n_12 do not contain higher investigation values than other nodes, the defender still takes action a_L  at these nodes. 
The goal is to either increase the probability of attracting attackers away from the normal zone or reduce the probability of attackers penetrating the normal zone from these bridge nodes. 



  §.§.§ Engagement Safety versus Investigation Values


Restrictive engagement actions endow attackers less freedom so that they are less likely to penetrate the normal zone. However, restrictive actions also decrease the probability of obtaining high-level IoCs, thus reduces the investigation values. 

To quantify the system value under the trade-off of the engagement safety and the reward from the investigation, we visualize the trade-off surface in Fig. <ref>. 
In the x-axis, a larger penetration probability p(s_N+1|s_j,a_j), j∈{s_1,s_2,s_8}, a_j ≠ a_E, decreases the value v(s_10). In the y-axis, a larger  reward r^γ(s_j,a_j,s_l), j∈𝒮∖{s_12,s_13},l ∈𝒮, increases the value. 
The figure also shows that value v(s_10) changes in a higher rate, i.e., are more sensitive when the penetration probability is small and the reward from the investigation is large. 
In our scenario, the penetration probability has less influence on the value than the investigation reward, which motivates a less restrictive engagement. 




§ RISK ASSESSMENT


Given any feasible engagement policy π∈Π, the SMDP becomes a semi-Markov process <cit.>. 

We analyze the evolution of the occupancy distribution and first passage time in Section <ref> and <ref>, respectively, which leads to three security metrics during the honeypot engagement. 
To shed lights on the defense of APTs, we investigate the system performance against attackers with different levels of persistence and intelligence in Section <ref>.  


 §.§ Transition Probability of Semi-Markov Process
 

Define the cumulative probability q_ij(t) of the one-step transition  from {S^k=i,T^k=t^k} to {S^k+1=j,T^k+1=t^k+t} as (S^k+1=j,T^k+1-t^k≤ t| S^k=i,T^k=t^k)=tr(j|i,π(i))  ∫_0^t z(τ|i,π(i),j)dτ, ∀ i,j∈𝒮,t≥ 0. 
Based on a variation of the forward Kolmogorov equation where the one-step transition lands on an intermediate state l∈𝒮 at time T^k+1=t^k+u, ∀ u∈ [0,t], the transition probability of the system in state j at time t, given the initial state i at time 0 can be represented as 

    p_ii(t)=1-∑_h∈𝒮 q_ih(t) +∑_l∈𝒮∫_0^t p_li(t-u)dq_il(u),  
        p_ij(t)=∑_l∈𝒮∫_0^t p_lj(t-u)dq_il(u)=∑_l∈𝒮  p_lj(t) ⋆dq_il(t)/dt, ∀ i,j∈𝒮, j≠ i, ∀ t≥ 0,

where 1-∑_h∈𝒮 q_ih(t)  is the probability that no transitions happen before time t. 
We can easily verify that ∑_l∈𝒮p_il(t)=1, ∀ i∈𝒮, ∀ t∈ [0,∞).

To compute p_ij(t) and p_ii(t), we can take Laplace transform and then solve two sets of linear equations. 

For simplicity, we specify z(τ| i,π(i),j) to be exponential distributions with parameters λ_ij(π(i)), and the semi-Markov process degenerates to a continuous time Markov chain. 
Then, we obtain the infinitesimal generator via the Leibniz integral rule, i.e., 

    q̅_ij:=d p_ij(t)/dt|_t=0=λ_ij(π(i)) · tr(j|i,π(i))>0, ∀ i,j ∈𝒮,  j≠ i, 
    
       q̅_ii:=d p_ii(t)/dt|_t=0=-∑_j∈𝒮∖{i}q̅_ij<0, ∀ i∈𝒮.

Define matrix 𝐐̅:=[q̅_ij]_i,j∈𝒮 and vector 𝐏_i(t)=[p_ij(t)]_j∈𝒮, then based on the forward Kolmogorov equation,

    d𝐏_i(t)/dt=lim_u→ 0^+𝐏_i(t+u)-𝐏_i(t)/u=lim_u→ 0^+𝐏_i(u)-𝐈/u𝐏_i(t)=𝐐̅𝐏_i(t).

Thus, we can compute the first security metric, the occupancy distribution of any state s∈𝒮 at time t starting from the initial state i∈𝒮 at time 0, i.e., 

    𝐏_i(t)=e^𝐐̅t𝐏_i(0), ∀ i∈𝒮.


We plot the evolution of p_ij(t), i=s_N+1, j∈{s_1,s_2,s_10,s_12}, versus t∈ [0,∞) in Fig. <ref> and  the limiting occupancy distribution p_ij(∞), i=s_N+1, in Fig. <ref>. 
In Fig. <ref>, although the attacker starts at the normal zone i=s_N+1, our engagement policy can quickly attract the attacker into the honeynet. 
Fig. <ref> demonstrates that the engagement policy can keep the attacker in the honeynet with a dominant probability of 91% and specifically, in the target honeypot n_10 with a high probability of 41%. 
The honeypots connecting the normal zone also have a higher occupancy probability than nodes n_3,n_4,n_5,n_6,n_7,n_9, which are less likely to be explored by the attacker due to the network topology. 


























 §.§ First Passage Time


Another quantitative measure of interest is the first passage time T_i𝒟 of visiting a set 𝒟⊂𝒮 starting from i∈𝒮∖𝒟 at time 0. 
Define the cumulative probability function f^c_i𝒟(t):=(T_i𝒟≤ t), then 
f^c_i𝒟(t)=∑_h∈𝒟 q_ih(t)+∑_l ∈𝒮∖𝒟∫_0^t f^c_l𝒟(t-u)dq_il(u).

In particular, if 𝒟={j}, then the probability density function f_ij(t):=df^c_ij(t)/dt satisfies 

    p_ij(t)=∫_0^t p_jj(t-u)df^c_ij(u)=p_jj(t)⋆ f_ij(t), ∀ i,j ∈𝒮, j≠ i.

Take Laplace transform p̅_ij(s):=∫_0^∞e^-s tp_ij(t)dt, and then take inverse Laplace transform on f̅_ij(s)=p̅_ij(s)/p̅_jj(s), we obtain

    f_ij(t)=∫_0^∞e^s tp̅_ij(s)/p̅_jj(s) ds,∀ i,j ∈𝒮, j≠ i.


We define the second security metric, the  attraction efficiency as the probability of the first passenger time T_s_12,s_10 less than a threshold t_th. 
Based on (<ref>) and (<ref>), the probability density function of T_s_12,s_10 is shown in Fig. <ref>. We take the mean denoted by the orange line as the threshold t_th and the attraction efficiency is 0.63, which means that the defender can attract the attacker from the normal zone to the database honeypot in less than t_th=20.7 with a probability of 0.63. 







  §.§.§ Mean First Passage Time

The third security metric of concern is the average engagement efficiency defined as the Mean First Passage Time (MFPT) t^m_i 𝒟=E[T_i𝒟],∀ i∈𝒮, 𝒟⊂𝒮. 
Under the exponential sojourn distribution, MFPT can be computed directly through the a system of linear equations, i.e.,  

    t_iD^m=0, i∈𝒟, 
        1+∑_l∈𝒮q̅_ilt^m_l𝒟=0, i∉𝒟.
 

In general,  the MFPT is asymmetric, i.e., t^m_ij≠ t^m_ji, ∀ i,j∈𝒮. 
Based on (<ref>), we compute the MFPT from and to the normal zone in Fig. <ref> and Fig. <ref>, respectively. The color of each node indicates the value of MFPT. 
In Fig. <ref>, the honeypot nodes that directly connect to the normal zone have the shortest MFPT, and it takes attackers much longer time to visit the honeypots of clients due to the network topology.  
Fig. <ref> shows that the defender can engage attackers in the target honeypot nodes of database and sensors for a longer time. The engagements at the client nodes are yet much less attractive. 
Note that two figures have different time scales denoted by the color bar value, and the comparison shows that it generally takes the defender more time and efforts to attract the attacker from the normal zone. 

The MFPT from the normal zone t^m_s_12,j measures the average time it takes to attract attacker to honeypot state j∈𝒮∖{s_12,s_13} for the first time. On the contrary, the MFPT to the normal zone  t^m_i,s_12 measures the average time of the attacker penetrating the normal zone from honeypot state i∈𝒮∖{s_12,s_13} for the first time. 
If the defender pursues absolute security and ejects the attack once it goes to the normal zone, then Fig. <ref> also shows the attacker's average sojourn time in the honeynet starting from different honeypot nodes. 

































 §.§ Advanced Persistent Threats


In this section, we quantify three engagement criteria on attackers of different levels of persistence and intelligence in Fig. <ref> and Fig. <ref>, respectively. 
The criteria are the stationary probability of normal zone p_i,s_12(∞), ∀ i∈𝒮∖{s_13}, the utility of normal zone v(s_12), and the expected utility over the stationary probability, i.e.,  ∑_j∈𝒮 p_ij(∞)v(j), ∀ i∈𝒮∖{s_13}. 

As shown in Fig. <ref>, when the attacker is at the normal zone i=s_12 and the defender chooses action a=a_A, a larger λ:=λ_ij(a_A), ∀ j∈{s_1,s_2,s_8}, of the exponential sojourn distribution indicates that the attacker is more inclined to respond to the honeypot attraction and thus less time is required to attract the attacker away from the normal zone. 
As the persistence level λ increases from 0.1 to 2.5, the stationary probability of the normal zone decreases and the expected utility over the stationary probability increases, both converge to their stable values. The change rate is higher during λ∈ (0,0.5] and much lower afterward.  On the other hand, the utility loss at the normal zone decreases approximately linearly during the entire period λ∈ (0,2.5]. 



As shown in Fig. <ref>, when the attacker becomes more advanced with a larger failure probability of attraction, i.e.,  p:=p(j|s_12,a_A), ∀ j∈{s_12,s_13}, he can stay in the normal zone with a larger probability.  A significant increase happens after p≥ 0.5.  
On the other hand, as p increases from 0 to 1, the utility of the normal zone reduces linearly, and the expected utility over the stationary probability remains approximately unchanged until p≥ 0.9. 

Fig. <ref> and Fig. <ref> demonstrate that the expected utility over the stationary probability receives a large decrease only at the extreme cases of a high transition frequency and a large penetration probability. 
Similarly, the stationary probability of the normal zone remains small for most cases except for the above extreme cases. 
Thus, our policy provides a robust expected utility as well as a low-risk engagement over a large range of changes in the attacker's persistence and intelligence. 



§ REINFORCEMENT LEARNING OF SMDP
 





Due to the absent knowledge of an exact SMDP model, i.e., the investigation reward, the attacker's transition probability (and even the network topology), and the sojourn distribution, the defender has to learn the optimal engagement policy based on the actual experience of the honeynet interactions. 
As one of the classical model-free reinforcement learning methods, the Q-learning algorithm for SMDP has been stated in <cit.>, i.e., 

    Q^k+1(s^k,a^k):=   (1-α^k(s^k,a^k))Q^k(s^k,a^k)+ α^k(s^k,a^k)[ r̅_1(s^k,a^k,s̅^k+1)
    
       
    +r̅_2(s^k,a^k)(1-e^-γτ̅^k)/γ-e^-γτ̅^kmax_a'∈𝒜(s̅^k+1) Q^k(s̅^k+1,a')],

where s^k is the current state sample,  a^k is the current selected action, α^k(s^k,a^k)∈ (0,1) is the learning rate, s̅^k+1 is the observed state at next stage, r̅_1,r̅_2 is the observed investigation rewards, and τ̅^k is the observed sojourn time at state s^k. 
When the learning rate satisfies ∑_k=0^∞α^k(s^k,a^k)=∞, ∑_k=0^∞ (α^k(s^k,a^k))^2<∞, ∀ s^k∈𝒮, ∀ a^k∈𝒜(s^k), and all state-action pairs are explored infinitely, max_a'∈𝒜(s^k)
Q^k(s^k,a'), k→∞,  in (<ref>) converges to value v(s^k) with probability 1. 

At each decision epoch k∈{0,1,⋯}, the action a^k is chosen according to the ϵ-greedy policy, i.e., the defender chooses the optimal action argmax_a'∈𝒜(s^k) Q^k(s^k,a') with a probability 1-ϵ, and a random action with a probability ϵ. 
Note that the exploration rate ϵ∈ (0,1] should not be too small to guarantee sufficient samples of all state-action pairs. The Q-learning algorithm under a pure exploration policy ϵ=1 still converges yet at a slower rate. 



In our scenario, the defender knows the reward of ejection action a_A and v(s_13)=0, thus does not need to explore action a_A to learn it. 
We plot one learning trajectory of the state transition and sojourn time under the  ϵ-greedy exploration policy in Fig. <ref>, where the chosen actions a_E,a_P,a_L,a_H are denoted in red, blue, purple, and green, respectively. 
If the ejection reward is unknown, the defender should be restrictive in exploring a_A which terminates the learning process. Otherwise, the defender may need to  engage with a group of attackers who share similar behaviors to obtain sufficient samples to learn the optimal engagement policy. 

In particular, we choose α^k(s^k,a^k)=k_c/k_{s^k,a^k}-1+k_c, ∀ s^k∈𝒮, ∀ a^k∈𝒜(s^k), to guarantee the asymptotic convergence, where k_c ∈ (0,∞) is a constant parameter and  k_{s^k,a^k}∈{0,1,⋯} is the number of visits to state-action pair {s^k,a^k} up to stage k. 
We need to choose a proper value of k_c to guarantee a good numerical performance of convergence in finite steps as shown in Fig. <ref>. We shift the green and blue lines vertically to avoid the overlap with the red line and 
represent the corresponding theoretical values in dotted black lines. 
If k_c is too small as shown in the red line, the learning rate decreases so fast  that new observed samples hardly update the Q-value and the defender may need a long time to learn the right value. 
However, if k_c is too large as shown in the green line, the learning rate decreases so slow that new samples contribute significantly to the current Q-value. It causes a large variation and a slower convergence rate of max_a'∈𝒜(s_12) Q^k(s_12,a'). 

We show the convergence of the policy and value under k_c=1,ϵ=0.2, in the video demo (See URL: <https://bit.ly/2QUz3Ok>). 
In the video, the color of each node n^k distinguishes the defender's action a^k at state s^k and the size of the node is proportional to max_a'∈𝒜(s^k) Q^k(s^k,a') at stage k. 
To show the convergence, we decrease the value of ϵ gradually to 0 after 5000 steps. 
 
Since the convergence trajectory is stochastic, we run the simulation for 100 times and plot the mean and the variance of Q^k(s_12, a_P) of state s_12 under the optimal policy π(s_12)=a_P in Fig. <ref>. The mean in red converges to the theoretical value in about 400 steps and the variance in blue reduces dramatically as step k increases. 




 §.§ Discussion


In this section, we discuss the challenges and related future directions about reinforcement learning in the honeypot engagement. 


  §.§.§ Non-cooperative and Adversarial Learning Environment

The major challenge of learning under the security scenario is that the defender lacks full control of the learning environment, which limits the scope of feasible reinforcement learning algorithms. 
In the classical reinforcement learning task, the learner can choose to start at any state at any time, and repeatedly simulate the path from the target state. 
In the adaptive honeypot engagement problem, however, the defender can remove attackers but cannot arbitrarily draw them to the target honeypot and force them to show their attacking behaviors because the true threat information is revealed only when attackers are unaware of the honeypot engagements.  
The future work could generalize the current framework to an adversarial learning environment where a savvy attacker can detect the honeypot and adopt deceptive behaviors to interrupt the learning process. 




  §.§.§ Risk Reduction during the Learning Period
 
Since the learning process is based on samples from real interactions, the defender needs to concern the system safety and security during the learning period. 
For example, if the visit and sojourn in the normal zone bring a significant amount of losses, we can use the SARSA algorithm to conduct a more conservative learning process than Q-learning.  
Other safe reinforcement learning methods are stated in the survey <cit.>, which are left as future work. 



  §.§.§ Asymptotic versus Finite-Step Convergence

Since an attacker can terminate the interaction on his own, the engagement time with attacker may be limited. 
Thus, comparing to an asymptotic convergence of policy learning, the defender aims more to conduct speedy learning of the attacker's behaviors in finite steps, and meanwhile, achieve a good engagement performance in these finite steps. 

Previous works have studied the convergence rate  <cit.> and the non-asymptotic convergence <cit.>  in the MDP setting.  For example,  <cit.> have shown a relationship between the convergence rate and the learning rate of Q-learning, <cit.> has provided the performance bound of the finite-sample convergence rate, and  <cit.> has proposed E^3 algorithm which achieves near-optimal with a large probability in polynomial time.  
However, in the honeypot engagement problem, the defender does not know the remaining steps that she can interact with the attacker because the attacker can terminate on his own. Thus, we cannot directly apply the E^3 algorithm which depends on the horizon time.  
Moreover, since attackers may change their behaviors during the long learning period, the learning algorithm needs to adapt to the changes of SMDP model quickly. 

In this preliminary work, we use the ϵ-greedy policy for the trade-off of the exploitation and exploration during the finite learning time. The ϵ can be set at a relatively large value without the gradual decrease so that the learning algorithm persistently adapts to the changes in the environment. 
On the other hand, the defender can keep a larger discounted factor γ to focus on the immediate investigation reward. 
If the defender expects a short interaction time, i.e.,  the attacker is likely to terminate in the near future, she can increase the discounted factor in the learning process to adapt to her  expectations. 


  §.§.§ Transfer Learning

In general, the learning algorithm on SMDP converges slower than the one on MDP because the sojourn distribution introduces extra randomness. 
Thus, instead of learning from scratch, the defender can attempt to reuse the past experience with attackers of similar behaviors to expedite the learning process, which motivates the investigation of transfer learning in reinforcement learning <cit.>. Some side-channel information may also contribute to the transfer learning. 














§ CONCLUSION

A honeynet is a promising active defense scheme.  
Comparing to traditional passive defense techniques such as the firewall and intrusion detection systems, the engagement with attackers can reveal a large range of Indicators of Compromise (IoC) at a lower rate of false alarms and missed detection. 
However, the active interaction also introduces the risks of attackers identifying the honeypot setting, penetrating the production system, and a high implementation cost of persistent synthetic traffic generations. 
Since the reward depends on honeypots' type, the defender aims to lure the attacker into the target honeypot in the shortest time. 
To satisfy the above requirements of security, cost, and timeliness, we leverage the Semi-Markov Decision Process (SMDP) to model the transition probability, sojourn distribution, and investigation reward. 
After transforming the continuous time process into the equivalent discrete decision model, we have obtained long-term optimal policies that are risk-averse, cost-effective, and time-efficient. 

We have theoretically analyzed the security metrics of the occupancy distribution, attraction efficiency, and average engagement efficiency based on the transition probability and the probability density function of the first passenger time. 
The numerical results have shown that the honeypot engagement can engage the attacker in the target honeypot with a large probability and in a desired speed. 
In the meantime, the penetration probability is kept under a bearable level for most of the time. 
The results also demonstrate that it is a worthy compromise of the immediate security to allow a small penetration probability so that a high investigation reward can be obtained in the long run.  

Finally, we have applied reinforcement learning methods on the SMDP  in case the defender can not obtain the exact model of the attacker's behaviors.  
Based on a prudent choice of the learning rate and exploration-exploitation policy, 
 we have achieved a quick convergence rate of the optimal policy and the value. Moreover, the variance of the learning process has decreased dramatically with the number of observed samples. 







 splncs04


