{'fraction_non_alphanumeric': 0.05067815249266862, 'fraction_numerical': 0.008064516129032258, 'mean_word_length': 4.081490104772992, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Man-in-the-Middle and Denial of Service Attacks in Wireless Secret Key Generation

Wireless secret key generation (W-SKG) from shared randomness (e.g., from the wireless channel fading realizations), is a well established scheme that can be used for session key agreement. W-SKG approaches can be of particular interest in delay constrained wireless networks and notably in the context of ultra reliable low latency communications (URLLC) in beyond fifth generation (B5G) systems. However, W-SKG schemes are known to be malleable over the so called"advantage distillation"phase, during which observations of the shared randomness are obtained at the legitimate parties. As an example, an active attacker can act as a man-in-the-middle (MiM) by injecting pilot signals and/or can mount denial of service attacks (DoS) in the form of jamming. This paper investigates the impact of injection and reactive jamming attacks in W-SKG. First, it is demonstrated that injection attacks can be reduced to - potentially less harmful - jamming attacks by pilot randomization; a novel system design with randomized QPSK pilots is presented. Subsequently, the optimal jamming strategy is identified in a block fading additive white Gaussian noise (BF-AWGN) channel in the presence of a reactive jammer, using a game theoretic formulation. It is shown that the impact of a reactive jammer is far more severe than that of a simple proactive jammer


I. INTRODUCTION
In the past two decades a large number of studies and patents appeared on the topic of wireless secret key generation (W-SKG) schemes that exploit channel reciprocity as the source of shared randomness (see [1] for a comprehensive review and [2] for a tutorial on physical layer security including W-SKG). Additionally, W-SKG over unauthenticated channels has been proposed in [3]. To overcome trivial higherlayer man-in-the-middle (MiM) attacks, as with MiM attacks on unauthenticated Diffie-Hellman schemes, physical layer security technologies have been combined with standard authentication and encryption (AE) schemes [4]. Furthermore, a large number of practical demonstrators have provided "proof of concept" [5], [6]. A resurgence of interest in W-SKG has been witnessed recently as these technologies could be considered for application in B5G systems [1], in particular in the context of Internet of things (IoT) [7] and -potentially -URLLC applications. W-SKG could be a good fit in these systems as the limited computational resources and strict delay constraints can render challenging the use of standard security protocols such as the transport layer security protocol (TLS) protocol and it's IoT friendly version, the datagram transport layer security (DTLS) protocol.
In recent works it has been shown that building semantically secure AE protocols using the W-SKG procedure is straightforward, as long as the channel probing phase of the scheme is robust against active attacks [4], [8]. Therefore, an important next step is to study MiM and denial of service (DoS) attacks during the channel excitation phase of the W-SKG protocol, commonly referred to as "advantage distillation" [4]. In this paper, two such active attacks, during channel probing are discussed.
Firstly, MiM attacks, referred to as "injection" attacks, are investigated in Section II: an active adversary tries to control part of the generated secret key by spoofing the channel estimation phase of the W-SKG scheme. Existing works have considered jamming attacks and formulate these in gametheoretic form [9], [10]. However, they have not considered the close relationship between injection and jammming. Here we propose a simple approach to mount such a MiM attack, assuming that the adversary has one additional antenna with respect to the legitimate users. This is a very mild assumption with respect to the adversary's capabilities and reveals a critical vulnerability of W-SKG, that needs to be addressed. As a countermeasure, we propose a concrete pilot randomization scheme using quadrature amplitude phase shift keying (QPSK) modulated random pilots. We prove that the source of shared randomness remains Gaussian and that the adversary can no longer mount the MiM attack. An interesting conclusion of our analysis is that the MiM injection attack is reduced to a jamming attack when pilot randomization is employed.
Motivated by this result, in Sections III and IV, DoS in the form of reactive jamming is studied for BF-AWGN channels -used as an abstraction for orthogonal frequency division multiplexing (OFDM) modulation systems. The attacker's optimal strategies are derived. In the present contribution we assume that the legitimate users blindly adopt a uniform power allocation policy, the level of which we optimally identify; the more general case of an arbitrary power allocation for the legitimate parties will be investigated in the future. Our study demonstrates that a reactive jammer can have a far more serious impact on the W-SKG process compared to a simple proactive jammer. In the future, frequency hopping as well as energy harvesting approaches to mitigate the impact of reactive jammers [11] will be explored. Finally, conclusions and further work are discussed in Section V.

II. MIM IN W-SKG SYSTEMS: INJECTION ATTACKS
MiM in the form of injection attacks constitutes one of the most critical limitations in W-SKG systems that extract secret keys from received signal strength (RSS) measurements [12]- [14]. Recently, various possible approaches for injection attacks have been published: in [12], the attacker controlled the movement of objects in an indoor wireless network, thus generating predictable changes in the RSS, (e.g., by obstructing, or not, a line-of-sight). In [13], whenever similar channel envelope measurements in the links to the legitimate nodes were observed, the MiM spoofed the W-SKG process by injecting a strong signal. In the following we will prove that -even when full CSI is used to extract the keys -it suffices that the adversary has one additional antenna with respect to the legitimate users to be able to mount an injection MiM attack.
To capture the main components of MiM attacks in W-SKG systems, we employ the system model depicted in Fig. 1, comprising three nodes: a legitimate transmitter, its intended receiver, and a MiM, referred to as Alice, Bob and Mallory, respectively. Alice and Bob are assumed to have a single antenna each for simplicity, while Mallory has two transmit antennas. 1 The fading channel realization in the link Alice-Bob is denoted by the complex circularly symmetric Gaussian random variable H ∼ CN (0, σ 2 ). To obtain estimates of H, Alice and Bob exchange pilot signals X with E[|X| 2 ] ≤ P . Furthermore, following [13], we assume Mallory has perfect knowledge of the channel vectors in the multiple input single output (MISO) links Mallory-Alice and Mallory-Bob. The channel coefficients are assumed to be independent and identically distributed (i.i.d.), i.e., ; this assumption is realistic since Mallory can estimate the channel vectors while Alice and Bob exchange pilot signals, as long as the channel's coherence time is respected (a plausible scenario in slow fading, low mobility environments).
To mount the attack, Mallory transmits a signal X J , suitably precoded as PX J . The precoding matrix P = [P 1 , P 2 ] T is chosen such that the same signal is "injected" at both Alice and Bob, i.e., where, due to the i.i.d. assumption and to the continuous distribution of the channels, H A1 = H B1 almost surely. As a result, Mallory can select a suitable precoding matrix (among infinite possibilities). Assuming a total power constraint E[|PX J | 2 ] ≤ Γ for Mallory's transmission, P 2 should be chosen as This procedure, illustrated in Fig. 1, shows that it is possible to generalize the injection attack presented in [13], in which an attacker injected a strong signal whenever the RSS in the Mallory-Alice and Mallory-Bob links were similar. More importantly, the presented injection attack accounts not only for the RSS but for the full CSI, i.e., it includes the signal phase.
The observations at Alice and Bob, denoted by Z A and Z B , are where W = H A T PX J = H B T PX J denotes the observed injected signal at Alice and Bob which is identical at both due the precoding matrix P; and, N A , N B denote zero-mean unit variance i.i.d. complex circularly symmetric Gaussian random noise variables, i.e., N A , N B ∼ CN (0, 1). The secret key rate controlled by Mallory is upper bounded by [8] Identifying the optimal injection signal W , corresponds to finding the capacity achieving input signal of the twolook Gaussian channel in (3)-(4). This signal is known to be Gaussian [15]; hence, a good choice for X J is to be constant, so that, the overall injected signal is an optimal complex zero-mean circularly symmetric Gaussian signal, W ∼ CN (0, σ 2 J Γ). A countermeasure to injection attacks can be built by randomizing the pilot sequence exchanged between Alice and Bob [8], [14]. Here, we propose to randomize the pilots by drawing them from a (scaled) QPSK modulation, as follows: instead of transmitting the same probing signal X, Alice and Bob transmit independent, random probe signals X and Y , respectively, drawn from i.i.d. zero-mean discrete uniform , the pilots are randomly chosen QPSK signals. Alice's observation Z A is modified accordingly as while Bob's observation is given in (4). To establish shared randomness in spite of the pilot randomization, Alice and Bob post-multiply Z A and Z B by their randomized pilots, obtaining local observationsZ A andZ B (unobservable by Mallory), expressed as: Lemma 1: The source of shared randomness, when the pilots are randomized QPSK symbols, is a circularly symmetric zero mean Gaussian random variable, XY H ∼ CN (0, P 2 σ 2 ).
Proof: We treat the two orthogonal axes (real and imaginary) independently. Looking only at the real values of the pilots and of the channel coefficient X, Y, H denoted here by X R = Re(X), Y R = Re(Y ) and H R = Re(H), we express the underlying discrete uniform pdf f XR (x) and f YR (y) and the continuous pdf f HR (h) as The pdf of the product X R H R is given as by substituting r = P/2 at the last derivation, i.e., . A similar result holds for the products involving also the imaginary parts of X and H: X I H I , X I H R and X R H I , so that XH ∼ CN (0, P σ 2 ). Extending this result, we find that XHY ∼ CN (0, P 2 σ 2 ).
Furthermore, due to the fact that X and Y are independent and have zero mean, the variables XW and Y W are uncorrelated, circularly symmetric zero-mean Gaussian random variables, and, therefore independent, while the same holds for XN A , Y N B , i.e., (XW, Y W ) ∼ CN (0, σ 2 J P ΓI 2 ) and (XN A , Y N B ) ∼ CN (0, P I 2 ). Alice and Bob extract the common key from the modified source of common randomness XY H as opposed to XH. On the other hand, since XW, Y W, XN A , Y N B are i.i.d. complex circularly symmetric Gaussian random variables, the proposed scheme reduces injection attacks to uncorrelated jamming attacks, i.e., using Lemma 1 we get that III. JAMMING ATTACKS ON W-SKG Building on the results of the previous section, we next examine in detail the scenario in which Mallory acts as a reactive jammer. Reactive jamming is a stealthy jamming approach in which the jammer first senses the spectrum and jams only when she detects an ongoing transmission. Due to the effectiveness and difficulty to be detected, reactive jammers are considered as the most harmful [16], [17]. Furthermore, as OFDM is used in many actual systems (and will be used at least in the first deployments of 5G), in our analysis we assume a BF-AWGN channel as in [11]. In this context, we assume that Alice and Bob perform W-SKG over a BF-AWGN channel with N parallel blocks (referred to as subcarriers for clarity). The notation introduced in Section II is extended with the introduction of a carrier index i ∈ {1, . . . , N }, i.e., X i , Y i denote the randomized pilots on the i-th subcarrier, H i denotes the channel coefficient in the link Alice-Bob, W i the signal injected by Mallory on the i-th subcarrier and N A,i , N B,i noise variables. As a reactive jammer, Mallory senses the spectrum and jams a specific subcarrier only when the power on it exceeds a certain threshold p th . Two scenarios are considered: i) when p th is fixed (determined in essence by the carrier sensing capability of Mallory's receiver); ii) when p th is variable (its choice forms part of her strategy).
We can reformulate the expressions of Alice's and Bob's local observations on the i-th W-SKG subcarrier as follows: for i = 1, . . . , N with H i ∼ CN (0, σ 2 ), W i ∼ CN (0, σ 2 J γ i ), N A,i ∼ CN (0, 1), N B,i ∼ CN (0, 1). In this work, we assume that Alice and Bob use the same power p on all pilots, in agreement with common practice during the advantage distillation phase; the more general scenario of an arbitrary power allocation across the subcarriers will be investigated in the future. Based on this assumption we have that On the other hand, we let Mallory choose the power allocation vector to maximize the impact of her attack. The power Mallory uses on the i-th subcarrier is denoted by γ i , so that E[|W i | 2 ] = σ 2 J γ i . Denoting the average available power for jamming by Γ and the power allocation of the jammer by γ = (γ 1 , . . . , γ N ), we assume the following short-term power constraint: Assuming that H i is uncorrelated with H A,i , H B,i , i = 1, . . . , N and that the pilot randomization approach proposed in Section II is employed, the W-SKG rate R(p, γ i ) = I ÄZ A,i ;Z B,i ä on the i-th subcarrier, can be expressed as a function of p and γ i , i = 1, . . . , N as [11]: . (17) Note that the rate in (17) is independent of the instantaneous realizations of the fading coefficients; instead, the variations of the channel gains expressed through the variances σ 2 , σ 2 J determine the rate of the secret keys that can be extracted from the wireless medium. The overall W-SKG sum-rate can then be simply expressed as follows:

IV. OPTIMAL POWER ALLOCATION STRATEGIES
Alice and Bob's common objective is to maximize C K (p, γ) with respect to (w.r.t.) p, while Mallory wants to minimize C K (p, γ) w.r.t. γ. Given the opposed objectives, a non-cooperative zero-sum game can be formulated to study the strategic interaction between the legitimate users and the jammer: γ)). The game G has three components. Firstly, there are two players: player L representing the legitimate users (Alice and Bob are considered to act as a single player) and player J representing the jammer (Mallory). Secondly, player L has a set of possible actions A L = [0, P ] while player J's set of actions is (19) At last, C K (p, γ), denotes the payoff function of player L.
Due to the fact that Mallory first observes the transmit power of the legitimate users on the subcarriers and then decides which strategy to choose (a consequence of player J being a reactive jammer), we study a hierarchical game in which player L is the leader and player J is the follower. In this hierarchical game, the solution is the Stackelberg equilibrium (SE) -rather than Nash -defined as a strategy profile (p SE , γ SE ) where player L chooses his optimal strategy first, by anticipating the strategic reaction of player J (i.e., its best response). This can be rigorously written as: where γ * (p) denotes the jammer's best response (BR) function to any strategy p ∈ A L chosen by player L, defined as follows: We also denote by γ * i (p) the i-th component of γ * (p).

A. Stackelberg equilibrium with fixed p th
In the following, we evaluate the SE of the game G assuming that the threshold p th is predefined and fixed. The case P ≤ p th is trivial as γ SE = (0, . . . , 0), whereas, the legitimate users will optimally use the maximum available power so that (p SE = P ). Indeed, because of the badly chosen threshold or low sensing capabilities of Mallory, the legitimate transmission will never be detected on any of the subcarriers and hence will not be jammed. In the following, we assume that: P > p th .
Lemma 2: The BR of the jammer for any p ∈ A L chosen by the leader defined in (21) is the uniform power allocation, such that: Proof: Note that R(p, γ i ) is a monotonically decreasing convex function w.r.t γ i , i = 1, . . . , N for any p > 0. We show that the jamming power should be equally distributed on all of the subcarriers. To prove this, we apply Jensen's inequality using δ i > 0, Applying the power constraint N i=1 Γ/b i ≤ N Γ on the LHS of (23), for any p > p th we have: which shows that in order to minimize C K , Mallory has to distribute her power equally on all subcarriers. In light of this result, the W-SKG sum rate can have two forms: which simplifies the players' options. Next, we address the question of how Alice and Bob should choose their power p optimally by considering the actions available to the players in the game at the key points i.e. at P and p th . Theorem 1: Depending on the available power P for W-SKG, player L will either transmit at P or p th on all subcarriers. The SE point of the game is unique when P = p th (σ 2 J Γ + 1) and is given by When P = p th (σ 2 J Γ + 1), the game G has two SEs: , (0, . . . , 0)), (P, (Γ, . . . , Γ))}.
Proof: Given the BR in (22) and the simplification in (24), player L wants to find the optimal p ∈ A L that maximizes: Given that R(p, γ) is monotonically increasing with p for fixed γ, two cases are distinguished: a) p ∈ [0, p th ], b) p ∈ (p th , P ]. The optimal p in each case is given by a) arg max To simplify the three possibilities, we focus on the case when transmitting at full power R(P, Γ) (hence being sensed and jammed) is equal to the case when player L is transmitting at threshold p th (the jammer is silent) i.e., R(P, Γ) = R(p th , 0). Using this equality, and by substituting appropriately into (17), we obtain a quadratic equation in P : which has a unique positive root equal to p th (σ 2 J Γ + 1). Given that, the leading coefficient of (27): (2σ 2 p th + 1) ≥ 0 and that P > 0, we can say that the inequalities R(P, Γ) > R(p th , 0) and R(P, Γ) < R(p th , 0) are equivalent to P > p th (σ 2 J Γ + 1) and P < p th (σ 2 J Γ + 1), respectively. Some numerical results are presented in Fig. 2 for a total number of SKG subcarriers N = 10 (pertinent to narrowband IoT applications), p th = 2, Γ = 4, and σ 2 = σ 2 J = 1. The top figure compares the achievable rates of the SE strategy and of two alternative strategies consisting in transmitting with fixed p = P or p = p th . The bottom figure depicts the following quantities: where F and D represent the jammer's gain (or legitimate users' loss) if player L deviates from the SE point (indeed, if player L transmits at P > p th , the jammer will jam at γ * i (P ) = Γ; and if player L transmits at p th the jammer will not detect it and will remain silent). Both figures show that deviating from the SE point can decrease the achievable sumrates by up to 85%.

B. Stackelberg equilibrium with strategic p th
Finally, we investigate how Mallory could optimally adjust p th and how her choice will impact Alice's and Bob's strategies. Allowing p th to vary modifies the game under study as followsĜ = ({L, J}, {A L ,Â J (p)}, C K (p, γ, p th )), where: The BR of jammer can then be defined as: Lemma 3: The BR of player J in this case is a set of strategies: Proof: The problem that the jammer wants to solve is: min (γ,pth)∈ÂJ (p) C K (p, γ, p th ), which can be split as follows: The solution of the inner minimization is already known from (22). For the outer problem we have to find the optimal p th ≥ 0 that minimizes C K (p, γ * (p), p th ). Given that: and that R(p, Γ, p th ) < R(p, 0, p th ) the jammer can optimally choose any threshold such that p th = ǫ, ∀ǫ < p. meaning, any ongoing transmission is sensed and jammed.
Theorem 2: The gameĜ has an infinite number of SEs: ( p SE , γ SE , p th SE ) ∈ { (P, (Γ, . . . , Γ), ǫ), ∀ǫ < P }. (34) Proof: Given the BR of player J, we will now evaluate the SE of the gameĜ. The definition for p SE is given as: Since the jammer will act as in (31), we have: and the fact that R(p, Γ, ǫ) is monotonically increasing with p results in p SE = P . Fig. 3 and Fig. 4 illustrate the gain of the jammer (or the loss in W-SKG rate) when p th is part of her strategy, with utility function C K (p, γ, p th ), compared to the case when it is not, with utility function C K (p, γ). We evaluate this gain by: As in Fig. 2 the total number of subcarriers is N = 10 and σ 2 J = 1. The non-strategic threshold on Fig. 3 is set to p th = 2 and the quantity E is evaluated for different values of σ 2 and Γ. The numerical results demonstrate that when p th is part of Mallory's strategy, she can be a significantly more effective opponent, compared to the case when p th is fixed, confirming that reactive jammers can indeed pose a serious threat. This is also confirmed by the results on Fig. 4 where the relative gain of the jammer is presented for different p th . As expected with decreasing the threshold her gain increases.

V. CONCLUSIONS
In this study, injection and reactive jamming attacks were analyzed in W-SKG systems and optimal power allocation policies were investigated in BF-AWGN channels. It was shown that pilot randomization can reduce injection MiM attacks to less harmful jamming attacks. An intelligent reactive jammer should optimally jam with equal power on the whole spectrum. Furthermore, a strategically chosen jamming threshold just below the power level used by the legitimate users, allows the adversary to launch a much more effective attack. In this case, the legitimate users have no choice but to transmit at full power.