betaFeedback

WorksComputer Science

Development of an Effective Federated Learning-Based Defense System Against Phishing Attacks on Mobile Platforms

Abstract

Phishing remains one of the most pervasive and damaging cyber threats, exploiting both technical flaws and human behavior to compromise sensitive data. We present a privacy-preserving, real-time defense that analyzes full webpage source code on mobile platforms. Our system combines a lightweight Convolutional Neural Network (CNN) for end-to-end feature extraction with a Federated Learning (FL) framework that updates models collaboratively on user devices without transferring raw data-supporting regulatory compliance and personalization. Evaluated on a large and diverse dataset, the model attains 86.02% accuracy, 90.35% precision, 80.64% recall, and 92.78% ROC-AUC. While some centralized, classical approaches may report higher accuracy, our design emphasizes a practical balance among accuracy, user privacy, and real-time performance on resource-constrained devices. We further demonstrate an end-to-end integration within the open-source Lightning Android browser, achieving real-time detection with low computational overhead. This work shows that privacy-first, AI-driven phishing detection is both feasible and scalable across mobile and IoT settings, delivering robust protection while keeping user data on-device.

Introduction

The widespread adoption of information technologies has significantly transformed communication and data exchange, but it has also expanded the cyber attack surface. In Turkiye, household internet access reached 96.2% and internet usage among individuals aged 16–74 rose to 90.9% in 2025 [44], contributing to rising incidents of data breaches, malware, and particularly phishing attacks [19, 7].

Phishing remains a major threat by exploiting both technical vulnerabilities and human behavior. Reports from the Anti-Phishing Working Group (APWG) show that global phishing volumes have continued to climb, exceeding 1.1 million attacks in a single quarter of 2025—among the highest quarterly totals ever recorded [Anti-Phishing Working Group (APWG), 2024, 2025]. These attacks typically deceive users into revealing sensitive information (e.g., credentials or financial data) via fraudulent emails, messages, or websites [45, 24, 8]. Recent studies show that 85% of organizations experienced phishing incidents within a year, often leading to financial and reputational damage [20, 41] (Wasserman et al. 2023).

While phishing detection has been extensively studied for desktop environments, mobile platforms introduce additional challenges. Limited screen size, simplified interfaces, device heterogeneity, and constrained resources reduce the effectiveness of traditional detection methods [49, 14, 47]. Existing countermeasures include user education, blacklist-based filtering, and machine learning approaches [3, 27]. However, blacklists quickly become outdated, and centralized ML models raise privacy concerns due to the need for aggregating user data. Federated Learning (FL) offers a promising alternative by enabling collaborative model training without sharing raw data, thereby preserving user privacy while improving generalization [50, 11, 9, 12]. When combined with deep learning models such as Convolutional Neural Networks (CNNs), which can extract hierarchical patterns directly from web page source code, FL enables robust and privacy-aware phishing detection.

Despite its advantages, deploying FL in mobile environments introduces challenges, including limited computational resources, communication overhead, device heterogeneity, and security risks such as model poisoning. Addressing these constraints requires lightweight architectures and efficient training strategies.

In this study, we propose a real-time, CNN-based phishing detection system integrated with federated learning for mobile platforms. The system performs automatic feature extraction from HTML source code while ensuring that sensitive data remain on-device. Although designed for mobile use, the proposed framework is also applicable to IoT environments, where privacy-preserving, distributed intelligence is increasingly critical [33, 36].

Objectives and Contributions

This paper proposes a privacy-preserving, real-time phishing detection framework leveraging federated learning and deep neural networks. Unlike many previous works that either focus on pure centralized detection or rely on limited feature resources, this study emphasizes on-device learning, adaptive feature extraction from full source code, and scalability in architecture to IoT infrastructures. The main objectives and contributions of the work are summarized below.

  • To design a federated learning framework that allows continuous adaptive model training across mobile devices without violating user privacy.

  • To propose a lightweight CNN model capable of extracting deep, dynamic features from complete web page source code, ensuring robustness against obfuscation and zero-day phishing patterns.

  • To validate the proposed framework on real-world, large-scale datasets and compare it against both centralized and classical ML baselines concerning practical privacy and resource constraints for mobile deployment.

  • To analyze federated performance trade-offs, including communication cost, model robustness, and privacy–utility balance, and provide practical insights for deployment in mobile and IoT environments.

Research Questions and Hypotheses

This study addresses the following research questions:

  1. How effectively can a lightweight CNN detect phishing from web page source code on mobile devices (accuracy, precision, recall)?

  2. Can the model be deployed in a mobile browser for real-time detection under constraints of latency and model size?

  3. Does federated learning improve generalization and detection performance compared to centralized training?

  4. How does the proposed CNN+FL approach overcome limitations of shallow-feature and centralized mobile phishing detection systems?

Based on these questions, we hypothesize that: (i) a lightweight CNN combined with efficient FL can meet mobile resource constraints; (ii) the federated model achieves competitive performance (≥85%\ge85\% accuracy) while preserving privacy; (iii) FL enables personalization and adaptability to user behavior; and (iv) secure aggregation and client-side optimization mitigate poisoning risks and communication overhead.

The remainder of the paper is organized as follows: § 2 reviews related work; § 3 presents the methodology; § 4 reports experimental results; and § 5 concludes the study.

Related Work

Phishing attack detection is one of the most actively explored topics in cybersecurity literature, owing to the growing diversity of attack strategies and the rapid expansion of mobile device usage [42]. In this section, we present an overview of the main approaches and advancements in the field, focusing on (i) traditional and machine learning-based methods, (ii) deep learning developments, (iii) phishing detection on mobile platforms, (iv) the role of federated learning and data privacy, and (v) the specific research gap that this study aims to address.

Classical and Machine Learning-Based Phishing Detection

Early automated phishing detection systems primarily relied on blacklists, whitelists, and rule-based approaches [52]. Although these techniques were effective against known threats, they quickly became outdated as attackers developed new, unreported methods, leading to a gradual decline in detection rates over time [42]. Consequently, researchers began adopting machine learning techniques that leverage multidimensional features, including statistical properties of URLs, domain structures, the presence of HTTPS certificates, page forms, hyperlinks, and both HTML and JavaScript content [31, 27].

Large-scale open datasets such as the UCI Machine Learning Repository, PhishTank, OpenPhish, and Alexa Top Sites have facilitated the training and benchmarking of models like Decision Trees, Random Forests, and Support Vector Machines (SVMs), achieving detection accuracies exceeding 95% in numerous studies [22, 26]. The integration of HTML and Document Object Model (DOM)-based features alongside static URL and text features has further enhanced performance. For instance, the CANTINA algorithm applies Term Frequency–Inverse Document Frequency (TF–IDF) analysis to assess HTML keyword density and has reported content-based detection rates as high as 94–97% [52]. Subsequent studies expanded these feature sets by incorporating address bar indicators, page content, form structures, and script analysis, thereby improving the robustness of detection systems against evolving threats [27].

Advances in Deep Learning for Phishing Detection

In recent years, deep learning models have become a new benchmark in phishing detection. Architectures such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Long Short-Term Memory (LSTM), and Graph Convolutional Networks (GCNs) can automatically learn complex structural and semantic relationships, offering superior accuracy and adaptability compared to traditional machine learning techniques [26, 25, 38].

CNN-based models directly analyze HTML, DOM, JavaScript, and visual features, using n-gram representations and layout information to differentiate phishing websites from legitimate ones [25, 38]. Notably, models like HTMLPhish have achieved detection rates exceeding 97% through HTML-only analysis [35]. GCN-based methods, on the other hand, exploit the graph structure of a page’s DOM tree, achieving up to 7% higher accuracy than classical approaches [26].

Another research direction focuses on visual similarity-based detection, with models such as PhishZoo and Goldphish evaluating how closely fake websites mimic the visual design of legitimate ones—offering an additional protective layer [27, 22].

Phishing Detection on Mobile Platforms

Phishing attacks targeting mobile devices have increased dramatically in recent years [32]. Factors such as small screen sizes, reduced user attention, and hidden address bars provide attackers with new ways to deceive users. Most existing mobile-focused studies rely on lightweight machine learning algorithms, using features derived from URLs, basic HTML, and form elements to support efficient, real-time detection [21, 40].

In both Turkish and international research, phishing detection on mobile devices using HTML/DOM features—with models such as Decision Tree, SVM, Random Forest, and rule-based filters—has achieved accuracy rates exceeding 90% [16] (Akpınar and Kıyak 2022). Innovative Android applications like UnPhishMe have introduced new techniques for identifying fake login forms and verifying page authenticity [32]. However, while many existing mobile detection systems rely on features drawn from URLs, form elements, and basic HTML properties, fewer studies have explored automatically extracting complex and dynamic representations from full web page source code using end-to-end deep learning models. Applying such comprehensive, real-time analysis on mobile platforms—particularly within a privacy-preserving federated learning framework—remains a major gap in current research.

Data Privacy with Federated Learning in Mobile and IoT Systems

One of the most groundbreaking approaches in recent years is FL, which enables collaborative model training directly on user devices without uploading raw data to a central server [10, 13, 15, 23, 43] (Li et al. 2023). In FL, model updates are encrypted and aggregated, preserving user privacy and minimizing the risk of data exposure. Google’s implementation of FL in its Gboard keyboard app has demonstrated substantial improvements in personalization and security while maintaining user privacy [23].

For phishing detection, FL provides additional advantages, including real-time adaptability to new attack patterns and user behaviors, while maintaining the confidentiality of sensitive data [1] (Li et al. 2023). Multiple studies have compared FL-based phishing detection with conventional centralized training, often finding that FL achieves similar or even superior accuracy with stronger privacy guarantees [43].

The decentralized and privacy-preserving characteristics of FL make it particularly suitable for Internet of Things (IoT) infrastructures, which consist of numerous distributed, resource-limited devices generating sensitive data across different environments [51]. IoT systems frequently involve data such as health metrics, location information, household activity, and environmental sensor readings—making privacy protection essential [37]. Traditional centralized approaches expose this data to greater privacy risks, whereas FL enables local model training on devices without transferring raw information, thereby minimizing exposure.

By employing FL, edge devices like smart home appliances, wearable technologies, industrial IoT components, and gateways can collaboratively train models while keeping user data on-device. This approach not only reduces communication overhead but also maintains strong privacy safeguards. Furthermore, FL removes the dependence on centralized servers, increasing resilience against common IoT-specific threats such as eavesdropping [29], data manipulation [17], and model poisoning attacks [6]. The architecture supports compliance with regulations such as GDPR and KVKK while enhancing security and scalability across decentralized networks. Therefore, FL serves as a promising foundation not only for mobile-based systems but also for developing robust, privacy-aware AI solutions across a wide range of IoT ecosystems.

Research Gap and Contribution of This Study

Despite substantial progress, our literature review identifies a critical gap: the absence of a system that jointly provides (i) real-time, personalized phishing detection, (ii) deep and dynamic feature extraction from the complete page source via CNNs, (iii) robust operation on mobile platforms, and (iv) a privacy-preserving federated learning framework for continual adaptation. Prior work makes important advances, yet most studies either focus on desktop-based CNN analysis of page code or on mobile implementations that, while efficient, rely on hand-crafted, shallow features rather than end-to-end learning on the full source code [26, 25, 16] (Akpınar and Kıyak 2022).

This study addresses that gap by introducing an integrated mobile solution that performs CNN-based dynamic feature extraction directly from page source code, supports privacy-preserving federated learning, and delivers real-time, personalized anti-phishing protection. By unifying these previously separate dimensions, our approach is practical and scalable, with strong potential for real-world deployment and societal impact.

Methodology

This study proposes a privacy-preserving phishing detection system that operates on mobile devices using CNN-based feature extraction and federated learning (FL). The system performs real-time analysis of web page source code while keeping both inference and training on-device.

System Overview

The system analyzes visited web pages in real time by processing their source code through a lightweight CNN model. Federated learning enables collaborative model updates without sharing raw data, ensuring privacy while adapting to evolving threats and user behavior.

Research Design

The workflow consists of the following stages:

  1. Data Preparation: Collect, clean, and tokenize source code from phishing and legitimate websites.

  1. Model Development: Design a CNN to extract discriminative features directly from source code.

  1. Optimization & Training: Tune hyperparameters via Bayesian optimization and evaluate using standard metrics.

  1. Federated Learning: Enable on-device training and global model aggregation.

  1. Deployment: Integrate the model into the Lightning browser for real-time detection.

  1. Evaluation: Measure latency, resource usage, and accuracy across devices.

An overview is shown in Figure 1.

Overview of the proposed federated, CNN-based phishing detection pipeline

Figure 1. Overview of the proposed federated, CNN-based phishing detection pipeline. The workflow is organized into stages (distinct from the federated-learning communication rounds used during training), spanning data preparation, model development and optimization, federated training, on-device deployment, and evaluation.

Data Collection and Preprocessing

Data Sources: Datasets were compiled from multiple repositories, including Alexa Top Sites, Google Search results, PhishTank, OpenPhish, PhishStats, Kaggle datasets, and a benchmark dataset [46].

Preprocessing: Because virtually every token in web source code can be informative, we deliberately omit the stopword removal and stemming steps of traditional NLP pipelines so as to preserve the structural information of the code. Normalization consists of lowercasing, removing punctuation and non-alphanumeric symbols, and collapsing repeated whitespace; multiple character encodings (e.g., UTF-8, Latin-1) are handled during file reading.

Tokenization: We use a word-level tokenizer. After normalization, the source code is split into word tokens and a frequency-ranked word index is built. A token is retained only if it is between 3 and 20 characters long and occurs at least 60 times in the corpus; overly rare, short, or long tokens are discarded. Each document is then mapped to a sequence of token indices and padded or truncated to a fixed length of 500 tokens. This reduces the vocabulary from roughly 20 million to about 406,000 tokens—filtering ≈98%\approx98\% of the unique tokens—while retaining the most informative, structure-bearing terms.

Model Architecture

A lightweight CNN architecture is employed due to its balance between performance and efficiency. It consists of:

  • embedding layer

  • 1D convolutional layers

  • max and global pooling

  • dense layers with dropout

  • sigmoid output for binary classification

The input consists of tokenized source code sequences, and the output is a binary label (phishing vs. legitimate).

Hyperparameter Optimization

Bayesian optimization is used to efficiently tune key hyperparameters (e.g., learning rate, filter size, network depth), improving performance while reducing computational cost.

The best-performing configuration identified by Bayesian optimization is summarized in Table 1.

ParameterValue
Maximum sequence length500
Embedding vector size64
Number of Conv1D filters128
Kernel size5
Dense units (ELU activation)64
Dropout rate0.2
Learning rate0.0001
Mini batch size32
EpochsUp to 50 (with early stopping)

Table 1. CNN model hyperparameters.

This configuration provided a balanced, stable performance across both training data and real-world test sets.

Model Training and Evaluation

Model Training

The model was implemented and trained in TensorFlow within a Jupyter Notebook environment. To obtain reliable estimates and curb overfitting, the dataset was split into training, validation, and test sets. We used the Adam optimizer for its adaptive learning-rate updates and fast convergence. Early stopping served as regularization by monitoring validation loss and halting training when no improvement was observed for a predefined patience window. All training, hyperparameter searches, and evaluations were run on a high-performance Apple M2 Pro laptop.

Model Evaluation

We evaluated performance using complementary metrics that capture both accuracy and robustness, the classification performance metrics used in this study are summarized in Table 2.

MetricDefinition / Formula
TP, TN, FP, FNTP: correctly predicted positive TN: correctly predicted negative FP: false positive (Type I error) FN: false negative (Type II error)
AccuracyTP+TNTP+TN+FP+FN\frac{TP+TN}{TP+TN+FP+FN}
PrecisionTPTP+FP\frac{TP}{TP+FP}
RecallTPTP+FN\frac{TP}{TP+FN}
F1-score2⋅Precision⋅RecallPrecision+Recall2 \cdot\frac{\mathrm{Precision}\cdot\mathrm{Recall}}{\mathrm{Precision}+\mathrm{Recall}}
ROC-AUC∫01TPR d(FPR)\int_{0}^{1}\mathrm{TPR}\,\mathrm{d}(\mathrm{FPR})<br>TPR=TPTP+FN,FPR=FPFP+TN\mathrm{TPR}=\frac{TP}{TP+FN},\quad\mathrm{FPR}=\frac{FP}{FP+TN}
PR-AUC∫01Precision(r) dr\int_{0}^{1}\mathrm{Precision}(r)\,\mathrm{d}r
MCCTP⋅TN−FP⋅FN(TP+FP)(TP+FN)(TN+FP)(TN+FN)\frac{TP\cdot TN-FP\cdot FN}{\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN)}}
Log Loss−1N∑i=1N[yilog⁡(pi)+(1−yi)log⁡(1−pi)]-\frac{1}{N}\sum_{i=1}^{N}[y_i\log(p_i)+(1-y_i)\log(1-p_i)]

Table 2. Classification performance metrics

The target criteria were set to achieve accuracy above 80% and a false positive rate below 20%, reflecting practical real-world deployment thresholds.

System Implementation Overview

To support reproducibility and technical transparency, this section outlines the algorithmic design and key implementation components of the federated phishing-detection system. The implementation is modular, enabling efficient processing of large-scale web content while meeting privacy and performance requirements.

  • Overall System Workflow: The end-to-end pipeline comprises three phases: preparation, training, and deployment.

  • Memory-Efficient Data Processing: Chunk-based loaders handle large datasets without exhausting memory.

  • Intelligent Vocabulary Construction: Filtering reduces the vocabulary from roughly 20 million tokens to 406,000, cutting noise while preserving coverage.

  • CNN Training with Early Stopping: Training uses early stopping and continuous monitoring to stabilize and optimize performance.

  • Federated Learning Framework: On-device updates enable privacy-preserving collaboration without sharing raw user data.

  • Model Export and Mobile Deployment: The final model is optimized for mobile deployment while retaining federated-update capability.

The system is realized through a set of modular algorithms designed to ensure efficiency, accuracy, and seamless deployment within a federated learning paradigm. The overall workflow is coordinated by Algorithm 1, which organizes the process into three primary stages. Data preparation and preprocessing are handled in Algorithm 2, where raw inputs are cleaned, tokenized, and partitioned into federated subsets. The federated training loop, including client-side local updates and secure aggregation, is specified in Algorithm 3. Finally, the conversion of the trained model for on-device execution and packaging for mobile environments is described in Algorithm 4. This structured separation improves clarity, reproducibility, and maintainability, while enabling straightforward future extensions such as alternative model architectures or privacy-enhancing mechanisms.

Algorithm 1 Main Workflow of the Federated Phishing Detection System.

Input: Raw website data DrawD_{raw}; system configuration PconfigP_{config}

Output: Deployed mobile model MdeployedM_{deployed}

{Phase 1: Data Preparation}

(Tokenizer,Dfederated)←PREPAREDATA⁡(Draw)(Tokenizer, D_{federated}) \leftarrow\operatorname{PREPAREDATA}(D_{raw}) (see Algorithm 2)

{Phase 2: Federated Training}

Minitial←INITIALIZECNNMODEL⁡(Pconfig)M_{initial} \leftarrow\operatorname{INITIALIZECNNMODEL}(P_{config})

Mtrained←FEDERATEDTRAINING⁡(Minitial,Dfederated,Pconfig)M_{trained} \leftarrow\operatorname{FEDERATEDTRAINING}(M_{initial}, D_{federated}, P_{config}) (see Algorithm 3)

{Phase 3: Deployment}

Mdeployed←DEPLOYMODEL⁡(Mtrained,Tokenizer)M_{deployed} \leftarrow\operatorname{DEPLOYMODEL}(M_{trained}, Tokenizer) (see Algorithm 4)

return MdeployedM_{deployed}

Algorithm 2 Data Preparation.

1: Function PREPAREDATA(DrawD_{raw}) 2: Dclean←D_{clean} \leftarrow clean, normalize, and balance DrawD_{raw} 3: Frequencies←Frequencies \leftarrow tokenize DcleanD_{clean} and compute token frequencies 4: Vocabulary←Vocabulary \leftarrow filter FrequenciesFrequencies using thresholds 5: Tokenizer←Tokenizer \leftarrow build tokenizer from VocabularyVocabulary 6: Dvectorized←D_{vectorized} \leftarrow convert DcleanD_{clean} to sequences using TokenizerTokenizer 7: Dfederated←D_{federated} \leftarrow partition DvectorizedD_{vectorized} across client devices 8: return (TokenizerTokenizer, DfederatedD_{federated})

Algorithm 3 Federated Training Process.

1: Function FEDERATEDTRAINING(MglobalM_{global}, DfederatedD_{federated}, PconfigP_{config}) 2: for r=1r = 1 to Pconfig.RoundsP_{config}.Rounds do 3: Cselected←C_{selected} \leftarrow random subset of clients 4: Updates←∅Updates \leftarrow\varnothing 5: for each client c∈Cselectedc \in C_{selected} in parallel do 6: Mlocal←M_{local} \leftarrow TRAINLOCAL(MglobalM_{global}, DcD_c) 7: Δlocal←Mlocal−Mglobal\Delta_{local} \leftarrow M_{local} - M_{global} 8: append encrypted Δlocal\Delta_{local} to Updates 9: end for 10: Δagg←\Delta_{agg} \leftarrow AGGREGATE(UpdatesUpdates) using FedAvg McMahan et al. [ [30] 11: Mglobal←Mglobal+ΔaggM_{global} \leftarrow M_{global} + \Delta_{agg} 12: if EARLYSTOPPINGCRITERIONMET() then 13: break 14: end if 15: end for 16: return MglobalM_{global}

Algorithm 4 Model Deployment.

1: Function DEPLOYMODEL(MtrainedM_{trained}, TokenizerTokenizer) 2: Mlite←M_{lite} \leftarrow convert MtrainedM_{trained} to TFLite (Float16 quantization) 3: Tconfig←T_{config} \leftarrow export tokenizer metadata 4: Mpackage←M_{package} \leftarrow PACKAGE(MliteM_{lite}, TconfigT_{config}) for mobile integration 5: Assert: MpackageM_{package} size ≤120\le120MB and latency ≤0.4\le0.4s 6: return MpackageM_{package}

Federated Learning Implementation

To ensure reproducibility and transparency, we report the key parameters and configuration details of the federated-learning setup.

Simulation Environment

Experiments were conducted with TensorFlow Federated (TFF), an open-source framework by Google. The simulation consists of a single central server for aggregation and multiple client devices for local training, mirroring real-world deployment while remaining fully privacy-preserving.

Federated Learning Process

The federated workflow proceeds in five stages:

  • Global Model Distribution: The central server broadcasts the pretrained global weights to all participating clients.

  • Local Model Training: Each client trains the model locally using only its own browsing history and the source code of visited pages. Weights are updated independently on-device from client-specific data.

  • Secure Transmission of Updates: After local training, clients send only model updates (gradients or weight deltas) back to the server. No raw data or user-identifying information is shared, and all updates are encrypted in transit.

  • Aggregation and Global Update: The server aggregates received updates via federated averaging (FedAvg) or a comparable method, producing a refreshed global model that reflects collective learning across clients [34].

  • Redistribution and Iteration: The updated global model is redistributed, and the cycle repeats. Iteration enables continual adaptation to new phishing tactics and evolving user behavior.

Client Configuration and Data Distribution

  • Number of Clients: The experiments used five simulated clients, emulating a small cohort of user devices under a controlled setup and matching the five Android devices used for the on-device evaluation (§ 3.8.1).

  • Data Partitioning: The training set was partitioned across clients under a Non-IID assumption to emulate real-world heterogeneity (e.g., differing phishing/legitimate ratios per client).

Federated Training Protocol

  • Aggregation Algorithm: FedAvg was used on the server side, computing a weighted average of client weights proportional to each client’s local dataset size.

  • Communication Rounds: Each round comprised global distribution, local client training, and server-side aggregation; training continued over successive rounds until an early-stopping criterion was met, and the federated results reported in § 4 correspond to the resulting aggregated global model over the five clients.

  • Client Participation Rate: All 5 clients participated in every round (100% participation).

Local Client Training

In each communication round, clients trained with the following configuration:

  • Local Epochs: In each round, every client performed four local training epochs on its own data—using the same optimizer and batch settings as the centralized model—to balance local adaptation with overfitting risk.

  • Local Hyperparameters: Batch size of 32 and Adam optimizer with a learning rate of 0.0001, matching the centralized setup.

The federated learning paradigm offers two principal benefits: strong privacy guarantees—since no sensitive personal data ever leaves the user’s device—and continuous adaptation with personalization. By training on a broad stream of up-to-date, real-world data, the model can learn device- and user-specific security patterns, improving robustness and accuracy against emerging phishing threats.

To further protect privacy and data integrity, all communication between clients and the server is encrypted via Transport Layer Security (TLS/SSL). In addition, cryptographic checks verify the integrity and authenticity of model updates throughout the pipeline. These technical and governance safeguards support compliance with applicable data-protection regulations, including the General Data Protection Regulation (GDPR) and Türkiye’s Personal Data Protection Law (KVKK), thereby reinforcing user trust and system reliability.

Integration into Anti-Phishing Browser

The final CNN model was integrated into the open-source Lightning web browser for Android [39]. The anti-phishing module analyzes page source code in the background and issues real-time pop-up warnings when a threat is detected. The application presents a minimalist, user-friendly interface that clearly communicates security alerts.

Performance Evaluation and Optimization

Performance Testing

We evaluated speed, memory footprint, and accuracy across a range of Android devices. On average, per-page analysis completed in ≈0.4\approx0.4 s, and the combined size of the model and tokenizer remained below 120 MB (targets: <5< 5 s per Top-10 frequent tokens: class, div, span, href, https, data, com, quot, width, content.

TypeSourceTrain (raw/sample)Test (raw/sample)
PhishingPhishTank, OpenPhish, PhishRepo100,000 (34,666)29,997 (8,999)
LegitimateAlexa Top Sites, Webpage Rank, Google49,524 (34,666)49,990 (8,999)

Table 3. Sources and Sizes of Training and Test Datasets

MetricCount
Total unique words19,971,995
Words used after filtering406,060
Filtered-out word ratio97.97%

Table 4. Word distribution and filtering results.

page, < 200 MB storage). These results indicate that the deployment comfortably meets the real-time and storage constraints for mobile usage.

Statistical Analysis and Optimization

Collected metrics (e.g., accuracy, error rate) were compared across device cohorts to assess robustness under heterogeneous hardware conditions. Based on these findings and user feedback, we iteratively refined hyperparameters, network architecture, and software components, yielding consistent accuracy gains without compromising latency or on-device resource usage.

Security and Privacy Measures

  • Encrypted Communication: All client–server exchanges employed TLS/SSL to protect confidentiality and integrity.

  • Legal Compliance: The system design aligns with GDPR, KVKK, and other applicable regulations, supporting responsible data handling and user privacy.

Experimental Results and Discussion

This section reports a comprehensive evaluation of the proposed deep learning–based phishing detector. We analyze performance using accuracy, precision, recall, F1-score, ROC-AUC, and complementary metrics, and we summarize the training dynamics, data characteristics, and statistical findings with supporting tables and figures.

Properties of Training and Test Datasets

The training corpus comprises 100,000 phishing and 49,524 legitimate website source codes. After class balancing, we used 34,666 samples per class for training. The test set contains 8,999 phishing and 8,999 legitimate samples (17,998 total). Drawing from multiple independent sources increases robustness to real-world variability in site distributions and content.

Word Distribution and Tokenization Analysis

After preprocessing and filtering, only 406,060 of the 19,971,995 unique tokens were retained. This reduction shrinks the tokenizer’s vocabulary and helps the model emphasize informative features over noise. The most frequent tokens predominantly correspond to HTML, Cascading Style Sheets (CSS), and JavaScript structures, suggesting that the model captures structural distinctions between legitimate and phishing pages.

Model Training and Learning Curves

Figure 2 shows the evolution of training and validation metrics across epochs. The model rapidly reaches high training accuracy with low loss. A subsequent rise in validation loss indicates some overfitting—expected given distributional differences between training and test data—yet the overall trajectory demonstrates good generalization to unseen, real-world samples.

Training and validation loss/accuracy curves

Figure 2. Training and validation loss/accuracy curves.

MetricValue
Accuracy0.8602
Precision0.9035
Recall0.8064
F1-score0.8522
Specificity0.9139
ROC-AUC0.9278
PR-AUC0.9230
Matthews correlation0.7245
Log loss0.5730

Table 5. Performance metrics on the test set.

Classification Performance and Confusion Matrix

Table 5 reports test-set performance, and Figure 3 visualizes the confusion matrix. The model attains 86.02% accuracy, 90.35% precision, 80.64% recall, 85.22% F1-score, and 92.78% ROC-AUC, indicating reliable separation of phishing and legitimate pages with a low false-positive rate.

Confusion matrix of the test set

Figure 3. Confusion matrix of the test set.

From Figure 3, the classifier correctly identifies 8,224 legitimate sites and mislabels 775 as phishing; for phishing pages, it detects 7,257 correctly and misses 1,742 (i.e., classifies them as legitimate). These counts correspond to a false-positive rate of 1−Specificity=0.08611 - \text{Specificity} = 0.0861 and a false-negative rate of 1−Recall=0.19361 - \text{Recall} = 0.1936, supporting the model’s practical suitability for real-world mobile security applications.

ROC and Precision–Recall Curves

The ROC and Precision–Recall (PR) curves in Figure 4a and Figure 4b illustrate the model’s discriminative ability across thresholds. The areas under the curves—ROC-AUC = 0.9278 and PR-AUC = 0.9230—indicate strong separability and reliable performance, including under class-imbalance conditions.

ROC curve

(a) ROC curve (AUC = 0.9278)

PR curve

(b) PR curve (AUC = 0.9230)

Figure 4. Performance curves: (a) ROC and (b) Precision–Recall.

Prediction Analysis and Model Calibration

Figure 5 summarizes prediction score distributions, box plots, performance-versus-threshold trends, and a calibration curve. The model generally assigns high probabilities to the correct class, and the calibration plot suggests that predicted probabilities are well aligned with observed frequencies, albeit not perfectly calibrated.

Prediction probability distributions, threshold analysis, and calibration results

Figure 5. Prediction probability distributions, threshold analysis, and calibration results.

Model Size and Device Performance

The final model occupies 99.38 MB (with tokenizer: 116.52 MB). Tests across five Android devices show an average per-page inference time of ≈ 0.4 s, confirming suitability for real-time mobile use.

Federated Learning Performance and Comparison with the Initial Model

To assess the benefits of federated learning, updates from five client devices were aggregated on the central server to produce a new global model. We then compared this federated model to the initial model—the centrally trained, Bayesian-optimized CNN without federation—over key metrics (Table 6). For reference, the table also reports an unoptimized CNN baseline (without Bayesian hyperparameter optimization), which performed roughly 3–5% below the optimized model across metrics, quantifying the contribution of the optimization step. Overall, federated training improves accuracy, recall, F1, ROC-AUC, and PR-AUC, with a small trade-off in precision—consistent with a model that is slightly more sensitive to phishing while maintaining a low false-positive rate.

MetricUnoptimized CNNOptimized CNNFederated CNNRel. change (%)
Accuracy0.82490.86020.8776+2.0
Precision0.87190.90350.8960−0.8
Recall0.77010.80640.8251+2.3
F1-score0.81780.85220.8589+0.8
ROC-AUC0.89260.92780.9431+1.6
PR-AUC0.88500.92300.9385+1.7

Table 6. Configuration ablation across the pipeline: an unoptimized CNN, the centrally trained Bayesian-optimized CNN (the initial model), and the federated global model (after FedAvg aggregation). The last column reports the relative change of the federated model over the optimized CNN.

As summarized in Table 6, the federated model yields clear gains over the initial baseline—most notably in accuracy (+2.0%), recall (+2.3%), and ROC-AUC (+1.6%). These improvements indicate that aggregating updates from heterogeneous clients enhances generalization and strengthens robustness to real-world phishing attempts. The higher recall, in particular, reflects more effective detection of phishing sites, which is critical for end-user protection.

A modest drop in precision (–0.8%) suggests a slight increase in false positives; however, this trade-off is outweighed by the broader performance gains and does not materially undermine practical reliability. Increases in F1-score and PR-AUC further confirm a better balance between sensitivity and specificity.

Comparison with Literature and Applicability

To the best of our knowledge, no prior work performs real-time phishing detection on mobile devices by jointly leveraging full web page source code, CNN-based feature extraction, and federated learning (FL). Existing mobile solutions typically rely on shallow features (e.g., URLs, HTML tags, form attributes) and classical machine learning models (e.g., Decision Trees, SVMs, Random Forests), often reporting accuracies above 90%. However, these approaches neither exploit deep representations of full source code nor address privacy and personalization through FL.

In contrast, the proposed system enables (i) code-centric, automatic feature extraction via CNNs and (ii) privacy-preserving, adaptive learning through FL in a real-time mobile setting. Although the achieved accuracy (86.02%) is slightly lower than some classical baselines, this reflects the increased complexity of full-source-code analysis and the constraints of on-device deployment. Importantly, FL enhances privacy while enabling continual adaptation to evolving attacks and heterogeneous user behavior.

Prior deep learning studies are typically limited to centralized, desktop environments, whereas mobile implementations remain shallow-feature-based. This work bridges that gap by integrating deep, code-level analysis with federated, real-time operation on mobile platforms.

Overall, the proposed framework advances the literature by combining deep learning and FL into a practical, privacy-aware, and adaptive mobile phishing detection system.

Conclusion and Discussion

We present a real-time, privacy-preserving phishing detection system that analyzes full web page source code using a CNN and is continuously updated via FL [18]. The approach enables on-device training without transmitting user data, ensuring strong privacy while maintaining generalization across heterogeneous data sources.

The model achieved 86.02% accuracy, 90.35% precision, and 92.78% ROC-AUC on large-scale datasets. Deployment within the open-source Lightning browser on Android demonstrated practical feasibility, with an average inference latency of 0.4 s and a total package size below 120 MB. While the accuracy is slightly lower than some centralized baselines, the system prioritizes a balanced trade-off between accuracy, privacy, real-time performance, and deployability. Notably, accuracy improved to 87.76% after one FL round, highlighting its adaptability to evolving threats.

The main contribution is the integration of (i) code-level feature extraction via CNNs, (ii) real-time mobile inference, (iii) privacy preservation through FL, and (iv) continuous model updates—capabilities typically addressed separately in prior work.

Although evaluated primarily on mobile devices, the lightweight and decentralized design suggests applicability to resource-constrained environments such as IoT. The FL framework further aligns with data protection regulations (e.g., GDPR, KVKK), making it suitable for privacy-sensitive deployments.

Limitations include evaluation in a simulated FL setting. Future work should validate the system at scale in real-world environments, incorporate advanced privacy mechanisms (e.g., differential privacy), and extend platform support. Overall, the proposed system demonstrates that real-time, AI-driven phishing detection can provide an effective and privacy-aware alternative to static blacklist-based approaches.

Future Work

Future research will focus on improving model capacity, scalability, and deployment flexibility:

  • Advanced Architectures: Explore Transformers and Graph Neural Networks (GNNs) while maintaining low latency and memory usage.

  • Cross-lingual Generalization: Extend evaluation across languages and regions.

  • Attack Diversity: Improve detection of varied phishing types (e.g., spear-phishing, smishing).

  • Platform Expansion: Support iOS, IoT, and embedded systems.

  • Continual Learning: Incorporate real-world feedback to reduce false positives/negatives.

  • Error Analysis: Analyze misclassifications (e.g., obfuscation, adversarial inputs).

  • Security Enhancements: Strengthen FL against poisoning and inference attacks using secure aggregation and differential privacy.

  • Open Deployment: Promote adoption via open-source and public-sector collaborations.

Disclosure statement

The authors declare that they have no conflict of interest.

Author Contribution

Eren Dogan; Conceptualization, Data curation, Formal analysis, Investigation, Methodology, Resources, Software, Writing - original draft, Writing - review and editing. Busra Buyuktanir; Supervision, Writing - original draft, Writing - review and editing. Dr. Gozde Karatas-Baydogmus; Supervision, Writing - original draft, Writing - review and editing. Dr. Kazim Yildiz; Supervision, Writing - original draft, Writing - review and editing.

Acknowledgments

This work was supported by TUBİTAK under the 2209-A Research Project Program.

References

References

  1. [1]F. Ahmad, S. Ali, and A. A. Ghorbani. A Federated Learning Approach for Privacy-Preserving Phishing Detection in Real Time. Computers & Security, 112, 2022.
  2. [3]A. Aleroud and L. Zhou. Phishing Environments, Techniques, and Countermeasures: A Survey. Computers & Security, 68:160–196, 2017.DOI
  3. [6]N. Baracaldo, B. Chen, H. Ludwig, A. Safavi, and R. Zhang. Detecting Poisoning Attacks on Machine Learning in IoT Environments. In 2018 IEEE International Congress on Internet of Things (ICIOT), pages 57–64, San Francisco, CA, USA, 2018. IEEE. doi:10.1109/ICIOT.2018.00015.DOI
  4. [7]E. Bıçakcı, S. Ergun, and M. Çelikpala. Cybersecurity: Threats and Solutions. SETA Publications, Istanbul, Turkiye, 2016.
  5. [8]R. Buber. Social Engineering and Phishing Attacks: Case Studies in Türkiye. In Proceedings of the National Cybersecurity Conference, pages 78–84, 2017.
  6. [9]B. Buyuktanir. New Generation Model Education Approach: Federated Learning. In UBAK: International Scientific Compilation Research Congress, pages 208–212, 2024.
  7. [10]B. Buyuktanir, K. Yildiz, E. E. Ulku, and T. Buyuktanir. du-CBA: Data-Agnostic and Incremental Classification-Based Association Rules Extraction Architecture. Journal of the Faculty of Engineering and Architecture of Gazi University, 38(3):1919–1930, 2023.
  8. [11]B. Buyuktanir, S. Altinkaya, G. Karatas Baydogmus, and K. Yildiz. Federated Learning in Intrusion Detection: Advancements, Applications, and Future Directions. Cluster Computing, 28(7):473, 2025a.DOI
  9. [12]B. Buyuktanir, Z. Ciplak, A. E. Cil, O. Yakar, M. B. Adoum, and K. Yildiz. DDoS_FL: Federated Learning Architecture Approach against DDoS Attack. Pamukkale Üniversitesi Mühendislik Bilimleri Dergisi, 31(6):1004–1018, 2025b.DOI
  10. [13]B. Buyuktanir, G. Karatas Baydogmus, E. E. Ulku, and K. Yildiz. Enhancing Employee Retention Prediction through Federated Learning and Associative Classification Using FedCBA: A Case Study on IBM HR Analytics. Arabian Journal for Science and Engineering, pages 1–28, 2026.DOI
  11. [14]G. Canova, M. Volkamer, C. Bergmann, R. Borza, B. Berens, S. Stockhardt, and R. Tenberg. Learn to Spot Phishing URLs with the Android NoPhish App. In IFIP Advances in Information and Communication Technology, volume 453, pages 87–100. Springer, Cham, Switzerland, 2015. doi:10.1007/978-3-319-18500-2_8.DOI
  12. [15]Z. Ciplak, K. Yildiz, and S. Altinkaya. FEDetect: A Federated Learning-Based Malware Detection and Classification Using Deep Neural Networks. Arabian Journal for Science and Engineering, 50:16107–16134, 2025. doi:10.1007/s13369-025-10043-x.DOI
  13. [16]M. Çolhak and E. Duman. Mobile Phishing Detection Using HTML Features: A Comparative Study. International Journal of Information Security Science, 13(2):85–98, 2024.
  14. [17]M. J. Covington and R. Carskadden. Threat Implications of the Internet of Things. In 2013 5th International Conference on Cyber Conflict (CyCon), pages 1–12, Tallinn, Estonia, 2013. IEEE.
  15. [18]A. Demir, A. Y. Kulaksız, B. Buyuktanir, G. Karatas Baydogmus, and K. Yildiz. Decentralized Disease Prediction: A Federated Learning Perspective. Afyon Kocatepe Üniversitesi Fen Ve Mühendislik Bilimleri Dergisi, pages 337–353, 2026. Advance online publication.
  16. [19]Ö. Demir. Analysis of Phishing Attacks in Türkiye: Trends and Solutions. Cybersecurity Journal, 11(1):44–58, 2023.
  17. [20]Department for Science, Innovation and Technology (DSIT). Cyber Security Breaches Survey 2025. Technical report, Department for Science, Innovation and Technology (DSIT), London, UK, 2025. URL https://www.gov.uk/government/statistics/cyber-security-breaches-survey-2025/cyber-security-breaches-survey-2025. Accessed: 14 June 2026.DOI
  18. [21]K. Dhanavanthi and V. Sumathy. Machine Learning-Based Mobile Phishing Detection. Procedia Computer Science, 185:220–227, 2021.
  19. [22]X. Dou, I. Khalil, A. Khreishah, A. Al-Fuqaha, and M. Guizani. Phishing Website Detection through Deep Learning. In CyberC, pages 278–281, 2017.
  20. [23]A. Hard, K. Rao, R. Mathews, S. Ramaswamy, et al. Federated Learning for Mobile Keyboard Prediction. arXiv preprint arXiv:1811.03604, 2018.arxiv.org/abs/1811.03604
  21. [24]S. Hekim. Analysis of the Effectiveness of Phishing Warnings. Turkish Journal of Information Security, 3(2):40–48, 2015.
  22. [25]R. Islam, S. Ghafoor, and A. Alzain. HTMLPhish: Detecting Phishing Websites Using HTML Content. Future Generation Computer Systems, 54, 2020.
  23. [26]A. Jain, R. Rao, and B. B. Gupta. A Hybrid Deep Learning Model for Phishing Detection Using Convolutional and Graph Neural Networks. Expert Systems with Applications, 221, 2023.
  24. [27]A. K. Jain and B. B. Gupta. Phishing Detection: Analysis of Visual Similarity-Based Approaches. Computers & Security, 112, 2022.
  25. [29]C.-H. Liao, H.-H. Shuai, and L.-C. Wang. Eavesdropping Prevention for Heterogeneous IoT Systems. In 2018 15th IEEE Annual Consumer Communications Networking Conference (CCNC), pages 1–2, Las Vegas, NV, USA, 2018. IEEE.
  26. [30]H. B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. Agüera y Arcas. Communication-Efficient Learning of Deep Networks from Decentralized Data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), volume 54 of Proceedings of Machine Learning Research, pages 1273–1282, Fort Lauderdale, FL, USA, 2017. PMLR.arxiv.org/abs/1602.05629
  27. [31]R. M. Mohammad, F. Thabtah, and L. McCluskey. Intelligent Phishing Detection System for E-Banking Using Fuzzy Data Mining. Expert Systems with Applications, 41(13):6123–6134, 2014.
  28. [32]A. Ndibwile et al. Mobile Phishing Attacks and Defense Mechanisms: State-of-the-Art and Open Challenges. IEEE Communications Surveys & Tutorials, 25(1):456–478, 2023.
  29. [33]D. C. Nguyen, M. Ding, P. N. Pathirana, A. Seneviratne, J. Li, and H. V. Poor. Federated Learning for Internet of Things: A Comprehensive Survey. IEEE Communications Surveys & Tutorials, 23(3):1622–1658, 2021.DOI
  30. [34]A. O. Onlu, B. Akca, B. Buyuktanir, K. Yildiz, and G. Karatas Baydogmus. An Investigation and Performance Evaluation of Aggregation Algorithms in Federated Learning Architecture. In 2025 Innovations in Intelligent Systems and Applications Conference (ASYU), pages 1–6. IEEE, 2025.DOI
  31. [35]C. Opara, B. Wei, and Y. Chen. HTMLPhish: Enabling Phishing Web Page Detection by Applying Deep Learning Techniques on HTML Analysis. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1–8, Glasgow, UK, 2020. IEEE. doi:10.1109/IJCNN48605.2020.9207707.DOI
  32. [36]O. Ozturk, B. Buyuktanir, G. Karatas Baydogmus, and K. Yildiz. Differential Privacy in Federated Learning: Mitigating Inference Attacks with Randomized Response. arXiv preprint arXiv:2509.13987, 2025.arxiv.org/abs/2509.13987
  33. [37]C. Perera, R. Ranjan, L. Wang, S. U. Khan, and A. Y. Zomaya. Big Data Privacy in the Internet of Things Era. IT Professional, 17(3):32–39, 2015.DOI
  34. [38]R. Rao, A. Jain, and B. B. Gupta. Graph Convolutional Network-Based Phishing Detection Using Webpage DOM Tree. IEEE Access, 11:19032–19046, 2023.
  35. [39]A. Restaino. Lightning Browser (Android), 2014. URL https://github.com/anthonycr/Lightning-Browser.
  36. [40]S. Routhu et al. PhishAlert: Real-Time Phishing Detection in Mobile Platforms. In ACM Conference on Security and Privacy in Wireless and Mobile Networks, pages 127–138, 2019.
  37. [41]S. Sharif. Large-Scale Data Breaches and the Rise of Phishing. Journal of Cyber Risk, 9(1):22–38, 2022.
  38. [42]Y. Sun, Z. Xue, and H. Wang. Survey on Machine Learning-Based Phishing Detection Approaches. IEEE Access, 10:49257–49271, 2022.
  39. [43]C. Thapa et al. A Survey of Federated Learning for Privacy-Preserving Cybersecurity. IEEE Transactions on Industrial Informatics, 19(3):2039–2050, 2023.
  40. [44]Turkish Statistical Institute (TUIK). Household Information and Communication Technology Usage Survey, 2025. Technical report. Turkish Statistical Institute (TUIK), Ankara, Turkiye, 2025. URL https://data.tuik.gov.tr. Accessed: 14 June 2026.
  41. [45]M. Unver and A. G. Mirzaoğlu. The Impact of Social Engineering Attacks on User Security Awareness. Information Security Bulletin, 13(4):21–29, 2011.
  42. [46]B. van Dooremaal, P. Burda, L. Allodi, and N. Zannone. Phishing Website Dataset, 2021. URL https://doi.org/10.5281/zenodo.4922598.
  43. [47]G. Varshney, M. Misra, and P. K. Atrey. Why Mobile Devices Are Vulnerable to Phishing. International Journal of Mobile Security, 7(3):101–109, 2016.
  44. [49]K. Wu. Phishing Attacks on Mobile Devices: Trends and Solutions. Mobile Computing and Security, 4(2):32–40, 2015.
  45. [50]Q. Yang, Y. Liu, T. Chen, and Y. Tong. Federated Machine Learning: Concept and Applications. ACM Transactions on Intelligent Systems and Technology, 10(2):1–19, 2019. doi:10.1145/3298981.DOI
  46. [51]T. Zhang, L. Gao, C. He, M. Zhang, B. Krishnamachari, and A. S. Asvithmer. Federated Learning for the Internet of Things: Applications, Challenges, and Opportunities. IEEE Internet of Things Magazine, 5(1):24–29, 2022.arxiv.org/abs/2111.07494
  47. [52]Y. Zhang, J. Hong, and L. Cranor. CANTINA: A Content-Based Approach to Detect Phishing Websites. In Proceedings of the 16th International Conference on World Wide Web (WWW ’07), pages 639–648, Banff, Alberta, Canada, 2007. Association for Computing Machinery.

Paper details

vlnc:W_mg2kmexj
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents