Preprint
Concept Paper

This version is not peer-reviewed.

Beyond Benchmark Accuracy: A Hybrid Framework for Phishing URL and Email Detection

Submitted:

31 October 2026

Posted:

04 November 2026

You are already at the latest version

Abstract
Phishing detectors can achieve almost perfect accuracy on benchmark datasets and still struggle with the links people encounter in practice. This paper investigates that gap and describes a hybrid framework for assessing URLs and emails through machine learning, language analysis, header inspection, and transparent rules. Our URL model combines character-level TF-IDF with 17 lexical features in a logistic regression classifier. Analysis of the 235,795 URLs in PhiUSIIL revealed pronounced differences in how the two classes were represented: every legitimate example used a simple HTTPS domain format, while 59.9% of phishing URLs included a path and 51.3% used HTTP. A classifier trained on raw URLs achieved 99.71% test accuracy, yet incorrectly marked 26 of 30 ordinary legitimate links as phishing. To limit reliance on these patterns, we trained a second classifier on 197,591 unique registered domains. On held-out domains, it achieved 86.02% accuracy, a ROC-AUC of 0.892, and 89.02% phishing precision. We then combined its predictions with URL-pattern checks, NLTK-based email cues, and SPF, DKIM, and DMARC evidence in a Flask prototype that reports a risk score and supporting reasons. The results show why dataset composition and realistic tests matter as much as headline accuracy when evaluating phishing detection.
Keywords: 
;  ;  ;  ;  ;  

1. Introduction

Phishing attacks try to persuade people to disclose credentials, payment details, or access to their accounts. Messages commonly impersonate familiar organisations and create a sense of urgency, making a fraudulent request appear routine or time-sensitive. A useful detector therefore needs to consider several sources of evidence: who appears to have sent a message, what the message asks the recipient to do, and where its links actually lead.
Many machine-learning studies report URL classification accuracy above 99% on public datasets. Those results are encouraging, but they can hide a practical problem. When legitimate and malicious URLs have been collected in different ways, a model may distinguish their formatting instead of learning patterns associated with phishing. That distinction matters because genuine websites often contain subdomains, paths, and query strings—features that should not be treated as suspicious by themselves.
We examine this issue using the PhiUSIIL Phishing URL Dataset [1] and build a prototype that brings together a registered-domain classifier, explainable URL rules, email-language cues, and header checks. The system is implemented with Python, Scikit-learn, NLTK, and Flask. This paper makes five contributions:
  • We quantify structural shortcuts in PhiUSIIL and show why a raw-URL classifier can perform exceptionally well on its test split while making mistakes on ordinary links.
  • We evaluate a registered-domain classifier that combines character n-gram TF-IDF with 17 lexical features, reducing its exposure to URL-path and protocol shortcuts.
  • We add transparent checks for suspicious subdomains, paths, and query parameters that are not visible to the domain-level classifier.
  • We develop an email-analysis pipeline that examines language cues, SPF/DKIM/DMARC results, sender-address inconsistencies, display-name impersonation, and links.
  • We provide a Flask interface and JSON API that report both a verdict and the evidence used to reach it.

3. Dataset

The PhiUSIIL dataset [1], downloaded from the UCI Machine Learning Repository, includes 235,795 URLs: 134,850 labelled legitimate (1) and 100,945 labelled phishing (0). Each record contains a URL, a page title, and 54 features derived from the URL or downloaded webpage. Since a detector evaluating a link in an email may have only the URL, we use the URL and label fields and extract our own features directly from the URL string.UCI Machine Learning Repository

3.1. Shortcut Biases

The two classes in PhiUSIIL differ noticeably in their URL structure. All 134,850 legitimate examples have the form https://www.<domain>, without a path or query. In contrast, 59.9% of phishing examples contain a path, 51.3% use HTTP, and 54.4% contain a subdomain other than www. A model can therefore separate many records by learning how the dataset was assembled, even if those patterns are not reliable signs of malicious intent.
These strong associations explain how a raw-URL model can excel on a conventional test split yet reject harmless URLs with normal paths. For instance, https://github.com/pallets/flask is a legitimate project page, but a model that treats paths as a phishing signal may assign it a high risk score. Section 5 explores this behaviour using a small, separate set of legitimate URLs.
Figure 1. · PhiUSIIL, all 235,795 URLs · computed from the URL column.
Figure 1. · PhiUSIIL, all 235,795 URLs · computed from the URL column.
Preprints 241693 g001
Popular hosting and redirect services create another complication. Some familiar domains occur in PhiUSIIL only within phishing-labelled entries because attackers used their redirects or hosted malicious pages there. Without careful treatment, a classifier may learn to distrust the entire platform rather than the abusive URL.

3.2. Preparation

We first reduced each URL to its registered domain, as described in Section 4.1. We then removed duplicate domains, excluded 30 major trusted domains, and discarded domains associated with conflicting labels. This left 197,591 unique registered domains: 132,075 legitimate and 65,516 phishing. A stratified 80/20 split (random seed 42) produced 158,072 training domains and 39,519 test domains. No exact registered domain appears in both sets, although other forms of dataset bias may remain.

4. Methodology

The framework assesses URLs, suspicious URL patterns, email wording, and message headers. These signals are combined into a risk score between 0 and 1. The prototype labels scores below 0.4 as legitimate, scores from 0.4 to below 0.7 as suspicious, and scores of at least 0.7 as phishing. These thresholds were chosen for the implementation; they were not calibrated on an independent labelled email dataset.

4.1. URL Feature Extraction

For classification, we use tldextract and the Public Suffix List, including private hosting suffixes, to identify each URL’s registered domain. Thus, a.b.paypal.com.evil.web.app is reduced to evil.web.app, while docs.python.org becomes python.org. We build two sets of features from this representation:
  • Character n-grams: TF-IDF over character 2- to 5-grams (minimum document frequency 3, at most 300,000 features, sub-linear term frequency).
  • 17 lexical features: length, number of dots, hyphens and digits, digit ratio, IP-address host, TLD length, domain-label length, Shannon entropy, vowel ratio, longest consonant run, longest token, count of suspicious words (e.g. login, verify, secure), a brand name that is not the registered domain, free-hosting platform, punycode (xn--) and digit-letter switches. These are standardised before training.
A URL submitted on its own goes straight to the URL-analysis module. When the input is an email, the system parses the message before examining its headers, written content, and embedded links.
Figure 2. system architecture.
Figure 2. system architecture.
Preprints 241693 g002

4.2. URL Classifier

We combine the character n-gram TF-IDF representation and the standardised lexical features with Scikit-learn’s FeatureUnion, then train L2-regularised logistic regression (C = 4, liblinear solver). We chose logistic regression because it is computationally lightweight, predicts quickly, and offers coefficients that are easier to inspect than those of many more complex models. Training on roughly 158,000 domains took about 81 seconds in our experiment.

4.3. URL Heuristics

A registered domain does not reveal every suspicious detail in a complete URL. We therefore examine subdomains, paths, and query parameters separately through a rule-based module. Each matched pattern adds the predefined weight listed in Table 1.
Rule Weight
@ in the authority part hides the real host 0.35
Brand name in the sub-domain of an unrelated domain 0.35
Host is a raw IP address 0.30
Link to an executable or archive 0.30
Sub-domain imitates another domain (paypal.com.) 0.25
Punycode / internationalised domain 0.25
URL shortener; free hosting platform; brand in path 0.20
Non-standard port; open redirect; credential words in path or sub-domain; deep sub-domains 0.15
No HTTPS; redirect-style // in path 0.10
We combine the model probability p with these rule weights using a noisy-OR calculation. Under this design, matched rules increase the URL risk score rather than lowering it:
Rurl = 1 − (1 − p) × ∏i (1 − wi)
We also maintain a list of 30 prominent domains to reduce false alarms associated with the dataset. For these domains, the model probability is capped at 0.02, but the URL rules still apply. This is a pragmatic adjustment rather than a substitute for testing against a representative collection of legitimate URLs.

4.4. NLP Analysis of Email Text

The email-text module processes the subject and body using NLTK. It tokenises the text, converts it to lowercase, removes English stop words, and lemmatises the remaining terms. It then looks for seven groups of social-engineering cues: credential requests, threats, urgency, financial themes, rewards, generic greetings, and calls to action (Table 2). Lemmatization helps relate forms such as “suspend” and “suspended.”
Cue category Weight Examples
Credential request 0.25 password, verify, sign in, SSN
Threat 0.20 suspend, locked, unusual activity
Urgency 0.15 immediately, within 24, expire
Financial 0.15 invoice, wire, refund, wallet
Reward 0.15 winner, prize, gift card
Generic greeting 0.10 dear customer, valued customer
Call to action 0.10 click here, open the attachment
Each detected cue adds a manually assigned weight. Repeated matches can increase that contribution to a maximum of twice the category’s base weight. Heavy use of capital letters and exclamation marks also contributes smaller adjustments. The prototype supports an optional TF-IDF/logistic-regression email-text model, but we do not report an evaluation of that component because PhiUSIIL contains no labelled emails.

4.5. Header Inspection

We parse raw RFC 822 messages with Python’s email package and examine the following indicators:
  • SPF, DKIM and DMARC results from Authentication-Results and Received-SPF (fail, softfail, none).
  • Registered-domain mismatches between From and Reply-To, Return-Path and Message-ID.
  • A display name that contains a different email address or a brand that the sender domain does not match.
  • A brand display name sent from a free webmail domain.
  • Missing From, Message-ID or Date headers.

4.6. Email Body and Score Fusion

The HTML parser extracts visible text, links, and forms. Each link is scored by the URL module. The system also checks whether displayed link text matches its destination and flags HTML forms or potentially risky attachment types. It combines the header score (H), content score (C), highest link score (U), and other flags through the weighted noisy-OR expression in Equation (2). The weights are manually chosen and still require validation on labelled email data.
Remail = 1 − (1 − 0.8H) × (1 − 0.7C) × (1 − 0.85U) × ∏j (1 − wj)

4.7. Implementation

We implemented the prototype in Python 3.10 with Scikit-learn 1.7 [11], NLTK 3.10 [12], and Flask 3.1. Users can analyse URLs or emails through the web interface, while POST /api/url and POST /api/email provide JSON access. Responses include component-level scores and readable explanations. We also developed 14 pytest tests covering URL features, text processing, header checks, and API behaviour.

5. Experiments and Results

On previously held-out registered domains, our proposed classifier reached 86.02% accuracy and a ROC-AUC of 0.892. These figures are lower than the raw-URL benchmark scores, but the domain model was less likely to flag ordinary legitimate links in a separate probe set. We report both results to show how the evaluation setup changes the interpretation of performance.

5.1. Setup

We trained each model using an 80/20 stratified split with seed 42, but the input unit differed. B1 and B2 used raw URLs (47,159 test URLs); B3 used hostnames (43,819 test hosts); and P1–P3 used registered domains (39,519 test domains). Phishing was the positive class, and precision, recall, and F1 were calculated with a threshold of 0.5.
Because the same dataset patterns can appear in both training and testing, a standard split may not expose shortcut learning. We therefore assembled a separate probe set of 30 legitimate URLs with ordinary paths and subdomains, including pages from GitHub, BBC, and PyPI. A phishing prediction on these URLs counted as a false positive. The set was chosen manually, so the result is an illustration of model behaviour—not a reliable estimate of real-world false-positive rates.

5.2. URL Classifier Results

Table 3. URL models on PhiUSIIL. Accuracy, precision, recall and F1 are percentages on each model’s test split. The last column counts false positives on the 30 probe URLs (lower is better).
Table 3. URL models on PhiUSIIL. Accuracy, precision, recall and F1 are percentages on each model’s test split. The last column counts false positives on the 30 probe URLs (lower is better).
Model Input Accuracy Precision Recall F1 ROC-AUC Probe false positives
B1 Char n-gram LR Raw URL 99.71 100.00 99.33 99.66 0.999 26 / 30
B2 Random forest, 22 PhiUSIIL URL features Raw URL 99.99 100.00 99.98 99.99 1.000 not computable¹
B3 Char n-gram + lexical LR Hostname 88.36 92.97 75.44 83.29 0.925 10 / 30
P1 Gradient boosting, lexical only Registered domain 81.16 89.69 48.80 63.21 0.805 0 / 30
P2 Char n-gram LR Registered domain 85.91 88.66 65.92 75.62 0.891 7 / 30
P3 Char n-gram + lexical LR (proposed) Registered domain 86.02 89.02 65.97 75.78 0.892 4 / 30
P3 + rules + trusted list (full detector) Full URL — — — — — 1 / 30²
¹ URLSimilarityIndex and TLDLegitimateProb are derived from the dataset’s own legitimate-URL list, so they cannot be reproduced for new URLs. ² 12 of the 30 probe URLs are on the trusted list; the one remaining false positive is login.microsoftonline.com.
Three findings stand out from the comparison:
  • The highest benchmark scores did not translate into dependable predictions on familiar legitimate links. Although the raw-URL character n-gram baseline achieved 99.71% accuracy, it classified 26 of the 30 probe URLs as phishing. The random-forest baseline also depended heavily on URLSimilarityIndex and HTTPS indicators, both closely associated with how PhiUSIIL was collected.
  • Restricting the model to hostnames or registered domains reduced benchmark accuracy but also reduced false alarms in the probe set. Accuracy was 99.71% for raw URLs, 88.36% for hostnames, and 86.02% for registered domains; the corresponding probe false positives were 26, 10, and 4. Because these models use different input units, this comparison does not isolate the effect of architecture alone.
  • Adding lexical features to character n-grams produced a small gain over the individual feature approaches. The proposed registered-domain model reached 75.78% F1 and 0.892 ROC-AUC. Its phishing recall was only 65.97%, however, showing that a domain string cannot reveal every malicious case.

5.3. Email Case Studies

PhiUSIIL contains URLs, not email messages, so it cannot be used to evaluate the email-analysis modules. As an initial functional check, we ran five illustrative email cases through the integrated prototype. Table 4 shows their header (H), content (C), and URL (U) scores, along with the final risk score and principal evidence. These examples demonstrate how the system behaves, not how accurately it would perform across a real email population.
The cases show why combining evidence can help, while also exposing the limits of the current scoring scheme. The legitimate password-reset message (E3) contains terms that might look suspicious on their own; nevertheless, its authentication results and trusted destination keep its final risk relatively low. The gift-card scam without a link (E4), by contrast, is labelled only suspicious because the available evidence consists mainly of a reply-address mismatch and persuasive wording. Evaluation on a larger labelled email corpus is needed before drawing conclusions about reliability.

5.4. Efficiency

On a laptop with an Intel Core i9-9880H CPU, training on 158,072 domains took 81 seconds. The saved model occupies 4.5 MB. Across 200 URLs, prediction averaged 2.7 ms per URL, while the full analysis of the E1 sample email took 246 ms.

6. Discussion and Limitations

Our results illustrate why benchmark accuracy should be read alongside the characteristics of the dataset. Raw-URL models surpassed 99.7% accuracy on PhiUSIIL, yet they frequently flagged normal links in the independent probe set. For the random-forest baseline, URLSimilarityIndex accounted for 48% of feature importance and IsHTTPS for 17%. This dependence makes a strong case for examining collection effects before claiming that a URL detector is robust.
Removing the most obvious shortcuts reveals another challenge: registered-domain text alone is not enough to identify many phishing sites. Our model achieved approximately 66% recall at 89% precision, which means a substantial share of phishing domains remained undetected. Some malicious domains simply do not look unusual. Signals such as registration history, DNS behaviour, hosting infrastructure, or webpage content may help. In the email setting, header and language cues offer additional context, but we have not yet measured their contribution on a representative corpus.
Several limitations should be kept in mind:
  • The email components have not been validated with labelled email data. PhiUSIIL includes no emails, and the language, header, and score-fusion weights were assigned manually. Our case studies demonstrate functionality rather than statistical performance.
  • The trusted-domain list is a manual correction. It addresses platform domains that appear in phishing-labelled records, but it requires upkeep. Twelve of the 30 probe URLs are on the list, which makes the full detector’s probe result look more favourable.
  • The probe sample is small and manually chosen. Thirty ordinary links are enough to reveal a potential shortcut problem, but not to estimate a dependable false-positive rate.
  • Attackers can adapt to explicit rules. Avoiding suspicious terms or familiar brand names may prevent some flags from triggering, although the underlying machine-learning score still applies.
  • Header evidence depends on the receiving email system. SPF, DKIM, and DMARC results depend on trustworthy Authentication-Results information, and those results are unavailable when only an email body is pasted into the application.

7. Conclusion and Future Work

We developed a phishing-detection prototype that combines registered-domain classification, URL-pattern checks, email-language analysis, and header inspection, and explains the evidence behind its verdicts. The main lesson from our experiments is methodological: 99.71% accuracy on the PhiUSIIL raw-URL benchmark did not prevent the model from misclassifying 26 of 30 ordinary legitimate links. A model trained on registered domains achieved 86.02% accuracy, 89.02% phishing precision, and 0.892 ROC-AUC on held-out domains, with fewer false alarms on the probe set. These findings do not establish production readiness. They do show why inspecting dataset bias and testing realistic examples are essential before interpreting high benchmark scores as evidence of robust phishing detection.
Future work will focus on the following priorities:
  • Train and test the email-text classifier on labelled messages, then calibrate the fusion weights rather than setting them manually.
  • Construct a representative legitimate-URL evaluation set that includes real paths and subdomains, using browsing data or web crawling where appropriate.
  • Explore domain-registration age, DNS information, and certificate-related signals as additional evidence.
  • Compare character-level neural networks and gradient-boosted ensembles on the same registered-domain task.
  • Investigate visual brand impersonation, including homoglyphs and logos, and consider integration into an email client.

References

  1. Prasad; Chandra, S. PhiUSIIL: A diverse security profile empowered phishing URL detection framework based on similarity index and incremental learning. Comput. Secur. Dataset: UCI Machine Learning Repository. 2024, vol. 136, 103545. [Google Scholar] [CrossRef]
  2. Ma, J.; Saul, L. K.; Savage, S.; Voelker, G. M. Beyond blacklists: Learning to detect malicious web sites from suspicious URLs. Proc. ACM SIGKDD, 2009; pp. 1245–1254. [Google Scholar]
  3. Sahingoz, K.; Buber, E.; Demir, O.; Diri, B. Machine learning based phishing detection from URLs. Expert Syst. With Appl. 2019, vol. 117, 345–357. [Google Scholar] [CrossRef]
  4. Le, H.; Pham, Q.; Sahoo, D.; Hoi, S. C. H. URLNet: Learning a URL representation with deep learning for malicious URL detection. arXiv 2018, arXiv:1802.03162. [Google Scholar]
  5. Fette, I.; Sadeh, N.; Tomasic, A. Learning to detect phishing emails. Proc. 16th Int. Conf. World Wide Web (WWW), 2007; pp. 649–656. [Google Scholar]
  6. Kitterman, S. Sender Policy Framework (SPF) for authorizing use of domains in email, version 1. IETF, 2014; p. RFC 7208.
  7. Crocker, D.; Hansen, T.; Kucherawy, M. DomainKeys Identified Mail (DKIM) signatures; IETF, 2011; p. RFC 6376. [Google Scholar]
  8. Kucherawy, M.; Zwicky, E. Domain-based Message Authentication, Reporting, and Conformance (DMARC); IETF, 2015. [Google Scholar]
  9. Geirhos, R.; et al. Shortcut learning in deep neural networks. Nat. Mach. Intell. 2020, vol. 2, 665–673. [Google Scholar] [CrossRef]
  10. Kaufman, S.; Rosset, S.; Perlich, C.; Stitelman, O. Leakage in data mining: Formulation, detection, and avoidance. ACM Trans. Knowl. Discov. From Data 2012, vol. 6(no. 4). [Google Scholar]
  11. Pedregosa, F.; et al. Scikit-learn: Machine learning in Python. J. Mach. Learn. Res. 2011, vol. 12, 2825–2830. [Google Scholar]
  12. Bird, S.; Klein, E.; Loper, E. Natural Language Processing with Python; O’Reilly Media, 2009. [Google Scholar]
Table 4. Email case studies.
Table 4. Email case studies.
Case H C U Risk score Verdict Main evidence
E1 PayPal credential phish 0.82 0.66 1.00 0.98 phishing SPF and DMARC fail, Reply-To on gmail.com, brand display name, link text shows paypal.com but points to a web.app page
E2 GitHub release notice 0.00 0.00 0.02 0.02 legitimate All authentication passes; link on github.com
E3 Genuine Microsoft password reset 0.00 0.25 0.17 0.29 legitimate Credential words, but authentication passes and the link is on a trusted domain
E4 CEO gift-card scam, no links 0.30 0.37 0.00 0.44 suspicious Reply-To differs from From; urgency and reward cues
E5 Personal message, body only — 0.00 0.00 0.00 legitimate No cues
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.