## 2 System Model and Problem Formulation  
We consider a CF m-MIMO-based IoT network consisting of \(K\) distributed APs, denoted as \(A_{k}\), each equipped with \(N\) antennas, serving \(I\) single-antenna IoT devices, denoted as \(D_{i}\), in the presence of \(J\) active eavesdroppers, denoted as \(E_{j}\), as shown in Figure 1. All APs are linked to a centralized processing unit (CPU) and operate over the same time-frequency resources to simultaneously serve \(D_{i}\) while mitigating interference from \(E_{j}\). The system follows a time-division duplex (TDD) protocol, where each coherence interval is divided into two phases: uplink training and downlink data transmission [46; 47]. During the uplink training phase, each device \(D_{i}\) and eavesdropper \(E_{j}\) transmit a pilot sequence to the APs to facilitate channel estimation. The received pilot signals at the APs are used to estimate the CSI, which is then utilized for precoding during downlink transmission. The channel fading coefficients from AP \(A_{k}\) to device \(D_{i}\) and eavesdropper \(E_{j}\) are expressed as:  
\[\mathbf{H}_{kD_{i}}=\sqrt{\Gamma_{kD_{i}}}\mathbf{X}_{kD_{i}}, \tag{1}\]  
\[\mathbf{H}_{kE_{j}}=\sqrt{\Gamma_{kE_{j}}}\mathbf{X}_{kE_{j}}, \tag{2}\]  
where \(\Gamma_{kD_{i}}\) and \(\Gamma_{kE_{j}}\) represent the large-scale fading coefficients, incorporating both path loss and shadowing between AP \(A_{k}\) and either device \(D_{i}\) or eavesdropper \(E_{j}\). The terms \(\mathbf{X}_{kD_{i}}\in\mathbb{C}^{N\times 1}\) and \(\mathbf{X}_{kE_{j}}\in\mathbb{C}^{N\times 1}\) denote small-scale Rayleigh fading, whose elements are independent and identically distributed (i.i.d.) random variables following \(\mathcal{CN}(0,1)\). The small-scale fading remains constant over a single coherence interval but varies independently across different coherence blocks. In contrast, large-scale fading evolves at a much slower rate and remains unchanged for multiple coherence intervals [48]. For the uplink training, we assume that all IoT devices \(D_{i}\) simultaneously transmit \(\tau_{p}\) mutually orthogonal pilot sequences to \(K\) APs. As per [49], we require \(\tau_{p}\geq K\). Let \(\mathbf{\
abla}_{i}\in\mathbb{C}^{\tau_{p}\times 1}\) be the pilot sequence for device \(D_{i}\), where \(\|\mathbf{\
abla}_{i}\|^{2}=1\), and the sequences satisfy the orthogonality condition \(\mathbf{\
abla}_{i}^{H}\mathbf{\
abla}_{i^{\prime}}=0\) for \(i\
eq i^{\prime}\). Since pilot sequences are publicly known, eavesdroppers may exploit them to launch pilot contamination attacks by transmitting  
Figure 1: The proposed system model for multi-device multi-eavesdropper CF m-MIMO-enabled IoT Network. sequences identical to those of legitimate devices. As a result, the received pilot signal at the \(k\)th AP is modeled as:  
\[\mathbf{Z}_{p,k}=\sqrt{\tau_{p}\rho_{D}}\sum_{i=1}^{I}\mathbf{H}_{kD_{i}} \mathbf{\Psi}_{i}^{H}+\sqrt{\tau_{p}\rho_{E}}\sum_{j=1}^{J}\mathbf{H}_{kE_{j}} \mathbf{\Psi}_{i}^{H}+\mathbf{V}_{p,k}, \tag{3}\]  
where \(\rho_{D}\) and \(\rho_{E}\) denote the respective normalized signal-to-noise ratios (SNRs) for legitimate devices and eavesdroppers. The term \(\mathbf{V}_{p,k}\in\mathbb{C}^{N\times\tau_{p}}\) represents additive white Gaussian noise (AWGN) at \(A_{k}\), modeled as \(\mathcal{CN}(0,1)\). For channel estimation at AP \(A_{k}\), we project the received pilot signal onto \(\mathbf{\Psi}_{i}\):  
\[\mathbf{z}_{p,kD_{i}}=\mathbf{Z}_{p,k}\mathbf{\Psi}_{i}. \tag{4}\]  
Thus, the projected received signal is given by:  
\[\mathbf{z}_{p,kD_{i}}= \begin{cases}\sqrt{\tau_{p}\rho_{D}}\mathbf{H}_{kD_{i}} +\mathbf{V}_{p,k}\mathbf{\Psi}_{i},&i\
eq i^{\prime}\\ \sqrt{\tau_{p}\rho_{D}}\mathbf{H}_{kD_{i}}+\sqrt{\tau_{p}\rho_{E}}\sum_{j=1}^ {J}\mathbf{H}_{kE_{j}}+\mathbf{V}_{p,k}\mathbf{\Psi}_{i},&i=i^{\prime}\end{cases}  \tag{5}\]  
Applying the linear minimum mean-square-error (LMMSE) estimator [50], the estimated channel coefficient from AP \(A_{k}\) to device \(D_{i}\) is obtained as:  
\[\mathbf{\hat{H}}_{kD_{i}}=