Skip to main content
QUICK REVIEW

[Paper Review] A Transformer-based Model to Detect Phishing URLs

Pingfan Xu|arXiv (Cornell University)|Sep 5, 2021
Spam and Phishing DetectionComputer Science25 references6 citations
TL;DR

This paper proposes a lightweight Transformer-based model for phishing URL detection, leveraging self-attention mechanisms to analyze URL sequences and achieve 97.3% test accuracy. It outperforms six classical machine learning models across all metrics, demonstrating the effectiveness of attention-based architectures in malicious URL classification.

ABSTRACT

Phishing attacks are among emerging security issues that recently draws significant attention in the cyber security community. There are numerous existing approaches for phishing URL detection. However, malicious URL detection is still a research hotspot because attackers can bypass newly introduced detection mechanisms by changing their tactics. This paper will introduce a transformer-based malicious URL detection model, which has significant accuracy and outperforms current detection methods. We conduct experiments and compare them with six existing classical detection models. Experiments demonstrate that our transformer-based model is the best performing model from all perspectives among the seven models and achieves 97.3 % of detection accuracy.

Motivation & Objective

  • To address the ongoing challenge of evolving phishing attacks that bypass traditional detection mechanisms.
  • To develop a lightweight yet high-performing model for real-time malicious URL detection using deep learning.
  • To evaluate the proposed model against established classical models in terms of accuracy, precision, recall, and F1-score.
  • To demonstrate the viability of Transformer architectures in URL-based phishing detection, a relatively underexplored application area.
  • To provide a robust, scalable solution for integration into browser security or enterprise anti-phishing systems.

Proposed method

  • The model employs a Transformer encoder architecture to process input URLs as tokenized sequences, capturing long-range dependencies through multi-head self-attention.
  • Input URLs are tokenized into subword units using a learned vocabulary, enabling effective representation of diverse URL patterns.
  • Learned positional embeddings are added to token embeddings to preserve sequence order, crucial for detecting obfuscation patterns in URLs.
  • The model is trained end-to-end using cross-entropy loss on a dataset combining PhishTank and UNB phishing URL collections.
  • A feed-forward network head is applied to the [CLS] token representation to produce binary classification output (malicious/benign).
  • Model training uses Adam optimizer with cosine learning rate decay and early stopping to prevent overfitting on the validation set.

Experimental results

Research questions

  • RQ1Can a Transformer-based architecture achieve superior performance in phishing URL detection compared to classical machine learning models?
  • RQ2How does the attention mechanism in Transformers improve the detection of obfuscated or visually deceptive URLs?
  • RQ3What is the comparative performance of the proposed model across key metrics like accuracy, precision, recall, and F1-score?
  • RQ4Does the model generalize well to unseen, real-world phishing URLs not present in the training data?
  • RQ5Can the model maintain high performance while remaining lightweight and suitable for real-time deployment?

Key findings

  • The proposed Transformer model achieved 97.3% test accuracy, outperforming all six classical models (Decision Tree, Random Forest, Multi-layer Perceptrons, XGBoost, SVM, Autoencoder) in every evaluation metric.
  • The model recorded a precision of 98.4%, recall of 96.2%, and F1-score of 97.3%, indicating strong balance between minimizing false positives and false negatives.
  • Among the seven models, the Transformer model had the highest F1-score, demonstrating the best overall performance in balancing precision and recall.
  • The confusion matrix confirmed high true positive and true negative rates, with only 19 false positives and 21 false negatives on the test set.
  • The model significantly outperformed the next-best model (Random Forest) by 12.4 percentage points in accuracy and 15.0 percentage points in F1-score.
  • The results validate that self-attention mechanisms effectively capture structural and syntactic patterns in malicious URLs, even when obfuscated.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.