URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection

Hung Le, Quang Pham, Doyen Sahoo, Steven C. H. HoiarXiv 2018

Abstract

Malicious URLs host unsolicited content and are used to perpetrate cybercrimes. Traditionally, detection relies on blacklists or machine learning models using lexical properties via Bag-of-words (BoW) features. These approaches suffer from an inability to capture semantic meaning, require manual feature engineering, and struggle with unseen features. We propose URLNet, an end-to-end deep learning framework that learns a nonlinear URL embedding directly from the raw string. By applying Convolutional Neural Networks (CNNs) to both characters and words, URLNet captures diverse semantic information. We also introduce advanced word-embeddings to address the prevalence of rare words. Extensive experiments on a large-scale dataset demonstrate significant performance gains over existing methods.

Introduction

The rapid generation of malicious URLs for phishing and malware distribution necessitates proactive detection systems. While blacklists are common, they are reactive and cannot identify new threats. Machine learning approaches, such as Support Vector Machines (SVMs) using Bag-of-Words features, have been explored but face significant limitations. Specifically, BoW models ignore the sequential order of characters and words, require extensive manual feature engineering, and fail to generalize to "rare words"—a major issue given that over 90% of unique words in URL corpora appear only once.

Methodology: The URLNet Architecture

URLNet addresses these challenges through a dual-branch CNN architecture that processes URLs at both the character and word levels.

The detailed architecture of URLNet, showing the parallel character-level and word-level CNN branches and the hybrid word embedding mechanism.

Dual-Branch Processing

  • Character-level CNN: This branch treats the URL as a sequence of characters, allowing the model to identify subtle obfuscations (e.g., g00gle.com) and handle any string regardless of vocabulary.
  • Word-level CNN: This branch segments the URL into words using delimiters like / and .. It captures the high-level structural semantics of the URL.

Advanced Word Embeddings

To mitigate the "rare word" problem, URLNet employs a hybrid embedding strategy. It combines a Global Word Embedding (standard lookup) with a Character-based Word Embedding. The latter generates a representation for a word by summing the embeddings of its constituent characters. This ensures that even if a word is unseen during training, the model can still derive a meaningful representation based on its sub-word structure.

Experimental Results

The model was evaluated on a massive dataset of 15 million URLs (5 million for training, 10 million for testing) sourced from VirusTotal. The dataset reflects real-world conditions with a 94% benign and 6% malicious distribution.

ROC curve comparing URLNet variants against traditional baselines like Bag-of-Words and expert-feature models.

URLNet significantly outperformed traditional baselines. It achieved an Area Under the Curve (AUC) of 0.9929, compared to 0.9208 for standard BoW SVMs. Crucially for security applications, at a 0.01% False Positive Rate, URLNet maintained a True Positive Rate (detection rate) of over 71%, whereas the best traditional baseline caught only approximately 20% of threats.

Conclusion

URLNet demonstrates that end-to-end deep learning can effectively replace manual feature engineering for malicious URL detection. By jointly optimizing character and word-level representations, the model achieves superior generalization, particularly against novel and obfuscated URLs. Future work may involve integrating page content (HTML/JS) and host-based features to further enhance detection capabilities.

Summary updated

BibTeX
@misc{le2018urlnet,
  author = {Hung Le and Quang Pham and Doyen Sahoo and Steven C. H. Hoi},
  title = {{URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection}},
  year = {2018},
  eprint = {1802.03162},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.03162},
}
Figure