## 4 Man-in-the-Middle (MITM) Attacks
### Federating Learning to Mitigate MITM Attacks: An IoT Case
Centralised CNN-B results that were published in [2] are listed in Table 2 as a baseline in addition to CNN-B+, an improved version of CNN-B in which the loss function is tailored to reduce the revenue cost due to energy theft and the CNN hyperparameters are optimised. Next, the results of FL-CNN are summarised in Table 2 with different numbers of clients, \(C=\{2,5,10\}\). It should be noted that FL-CNN is not limited to the \(C\) values listed in Table 2; these are selected to enable the comparison with the state-of-the-art work [29] that uses the same dataset SGCC. As expected, compared with centralised methods, the FL-based methods (both [29] and FL-CNN) result in a degradation of the ETD performance as seen in the true positive rate (TPR) and cost in Table 2. TPR is a metric that quantifies the rate of successfully detected theft samples compared to all theft samples. Moreover, Table 2 highlights an important trend regarding the effect of the number of clients (_distribution substations_) on the performance of FL methods, whereby an increase in clients generally decreases the TPR for both FL-CNN and FedDetect. The trends observed in both methods with regard to the false positive rate (FPR), which represents the rate of misclassified honest data points compared to all honest samples, differ. This is expected since the FedDetect loss function is not designed to account for the data imbalance and, with more clients (smaller local training dataset), the model tends to classify most data points as honest. FL-CNN, on the other hand, is trained to prioritise the detection of theft and, with a smaller training dataset, is more prone to misclassify honest data points as theft. The energy-aware framework proposed in [2] provides a realistic metric for comparing different methods as it portrays the actual revenue loss of an energy provider due to both undetected theft and false theft alarms; both require an in-person visit to the premises but the former results in a prolonged period of unbilled energy consumption before being identified. Furthermore, Table 2 shows the reproduced results based on our implementation of [29] using the GitHub repository ([[https://github.com/xierongpytorch/FedDetect/blob/main/FedDetect.py](https://github.com/xierongpytorch/FedDetect/blob/main/FedDetect.py)]([https://github.com/xierongpytorch/FedDetect/blob/main/FedDetect.py](https://github.com/xierongpytorch/FedDetect/blob/main/FedDetect.py)), accessed on 28 December 2023) provided by the authors, together with the preprocessed dataset depicted in Table 3. Similar to our findings in [2], we again reveal the alarming energy-aware performance of published models despite the attractive yet misleading reported results. In this context, the accuracy results (reported in [29] and reproduced in Table 2) seem to outperform the FL-CNN and centralised learning methods. However, upon a closer look at the energy-aware performance represented by TPR and FPR, and the related costs, we can see that [29] has the worst performance as it leads to the highest revenue loss due to energy theft. Indeed, FedDetect [29] resulted in a very poor theft detection rate (16.37%-34.77%) and the highest costs, i.e., \(K3871\)\(GBP\)-\(K4799\)\(GBP\) for 2-10 clients, resulting in the highest accuracy values, i.e., \(\sim\)92% (see Table 2). This is not surprising since, given the 92.55% share of honest users in the dataset (see Table 4), if all users are classified as honest, then the classification accuracy would be 92.55%. Our proposed FL-CNN method achieves the best results whilst contributing to data privacy for the three common implementations--2, 5, and 10 clients with cost savings of 41%, 33%, and 72% for each scenario, respectively.