URLTran: Improving Phishing URL Detection Using Transformers

Pranav Maneriker, Jack W. Stokes, Edir Garcia Lazo, Diana Carutasu, Farid Tajaddodianfar, Arun Gururajan

Introduction

Phishing remains a persistent and costly cybersecurity threat. While modern browsers employ blocklists and machine learning models to protect users, attackers continuously evolve their tactics, using short-lived domains and adversarial tricks like homoglyphs to bypass traditional filters. Detecting these malicious URLs is a "needle in a haystack" problem: phishing links are extremely rare compared to legitimate traffic, and the cost of a false positive (blocking a safe site) is prohibitively high for user experience. Consequently, models must achieve high detection rates at near-zero False Positive Rates (FPR), typically around 0.01%.

Methodology: The URLTran Architecture

Researchers from Microsoft and Ohio State University introduced URLTran, a deep learning framework that applies Transformer architectures to URL classification. Unlike previous state-of-the-art models that relied on Convolutional Neural Networks (CNNs), URLTran leverages the self-attention mechanisms that have revolutionized Natural Language Processing.

The URLTran architecture: input URLs are tokenized, encoded with positional and word embeddings, processed through L Transformer layers, and finally passed through a fully connected layer to produce a classification score.

The authors explored two primary strategies:

  1. Transfer Learning: Fine-tuning pre-trained models like BERT and RoBERTa on URL data.
  2. Domain-Specific Pre-training (URLTran_CustVoc): Training a Transformer from scratch using Masked Language Modeling (MLM) on a large corpus of URLs to learn the specific "grammar" of web addresses.

A critical component of URLTran is subword tokenization (e.g., Byte Pair Encoding). By breaking URLs into meaningful fragments rather than individual characters or whole words, the model can better generalize across variations. For instance, it can recognize the shared "bank" subword in bankofamerica and bankofcanada, making it more robust against brand-spoofing attempts.

Experimental Setup

The models were evaluated using a massive dataset derived from Microsoft Edge and Internet Explorer telemetry:

  • Training/Validation: 1.3 million records, down-sampled to a 1:20 phishing-to-benign ratio.
  • Testing: 1.78 million records, including 8,742 confirmed phishing URLs.
  • Adversarial Robustness: A synthetic "attack" set was created using homoglyph substitution and compound word splitting to test the model's resilience against sophisticated evasion techniques.

Key Results and Performance

URLTran significantly outperforms existing baselines. At the critical 0.01% FPR threshold, URLTran_BERT achieved a True Positive Rate (TPR) of 86.80%, representing a substantial improvement over the previous state-of-the-art, URLNet, which caught only 71.20%.

ROC curves comparing URLTran variants against baselines like URLNet and Texception. URLTran models consistently demonstrate higher True Positive Rates at extremely low False Positive Rates.

Key insights from the evaluation include:

  • Transfer Learning Efficacy: Fine-tuning general-purpose models (BERT) surprisingly outperformed domain-specific training from scratch, suggesting that natural language "common sense" aids in identifying suspicious URL patterns.
  • Model Efficiency: For custom-trained models, a 3-layer architecture provided the best balance of performance and generalization.
  • Inference Speed: The model is production-ready, with an average inference time of 0.36 ms per sample on a standard GPU.

Conclusion

URLTran represents a major advancement in phishing detection, offering a 21.9% relative improvement in detection rates at production-level false-positive thresholds. While the extreme class imbalance of the open web remains a challenge, the success of Transformer-based subword modeling provides a robust defense against evolving phishing tactics. Future research will focus on optimizing these models for mobile environments and improving detection of "zero-day" phishing campaigns.

Summary updated

Abstract

Browsers often include security features to detect phishing web pages. In the past, some browsers evaluated an unknown URL for inclusion in a list of known phishing pages. However, as the number of URLs and known phishing pages continued to increase at a rapid pace, browsers started to include one or more machine learning classifiers as part of their security services that aim to better protect end users from harm. While additional information could be used, browsers typically evaluate every unknown URL using some classifier in order to quickly detect these phishing pages. Early phishing detection used standard machine learning classifiers, but recent research has instead proposed the use of deep learning models for the phishing URL detection task. Concurrently, text embedding research using transformers has led to state-of-the-art results in many natural language processing tasks. In this work, we perform a comprehensive analysis of transformer models on the phishing URL detection task. We consider standard masked language modeling and additional domain-specific pre-training tasks, and compare these models to fine-tuned BERT and RoBERTa models. Combining the insights from these experiments, we propose URLTran which uses transformers to significantly improve the performance of phishing URL detection over a wide range of very low false positive rates (FPRs) compared to other deep learning-based methods. For example, URLTran yields a true positive rate (TPR) of 86.80% compared to 71.20% for the next best baseline at an FPR of 0.01%, resulting in a relative improvement of over 21.9%. Further, we consider some classical adversarial black-box phishing attacks such as those based on homoglyphs and compound word splits to improve the robustness of URLTran. We consider additional fine-tuning with these adversarial samples and demonstrate that URLTran can maintain low FPRs under these scenarios.
BibTeX
@inproceedings{maneriker2021urltran,
  author = {Pranav Maneriker and Jack W. Stokes and Edir Garcia Lazo and Diana Carutasu and Farid Tajaddodianfar and Arun Gururajan},
  title = {{URLTran: Improving Phishing URL Detection Using Transformers}},
  booktitle = {MILCOM},
  year = {2021},
  url = {https://openreview.net/forum?id=3p91kb95Nb},
}
Figure