Uniform Resource Locators (URLs) are frequently exploited as entry points for cyberattacks such as phishing, malware distribution, and website defacement. Detecting malicious URLs directly from their lexical structure, without page retrieval, is essential for low-latency defense but remains challenging due to adversarial obfuscations (e.g., homoglyphs, zero-width insertions, subdomain stuffing) and severe class imbalance in real-world corpora. To address these issues, we propose an attacker-aware lexical classification pipeline that combines structure-preserving tokenization, a library of attacker-style augmentations, supervised contrastive (SupCon) pretraining, and class-weighted focal loss fine-tuning. The Transformer encoder serves as the feature extraction model, while a lightweight MLP head performs classification. Empirical evaluations performed on the large Kaggle malicious phishing dataset show that the proposed methodology achieves the accuracy of 99.57% and the macro-F1 score of 99.38% on a hold-out test set, and thus consistently outperforms previously established state-of-the-art baselines. Notably, minority classes, which includes malware, achieves an accuracy and macro-G1 score greater than 99% in all aspects of measurement, highlighting the resentment of the method to adversarial string perturbations. The framework developed is computationally efficient, content agnostic and capable of deployment in a real-time operational scenario that provides a pragmatic defence mechanism against modern cyber threats.

Attacker-aware contrastive learning for robust malicious URL classification / Afzal, S., Gebrehiwot, A., Khan Farrukh, A., Lauria Filippo, M.. - (2026). (IntelliSecAI - 2025 International Conference on Computational Intelligence, Security, and Artificial Intelligence Al Khobar, Saudi Arabia 17–18/12/2025) [10.1109/intellisecai66368.2025.11472972].

Attacker-aware contrastive learning for robust malicious URL classification

Afzal Sara
;
2026

Abstract

Uniform Resource Locators (URLs) are frequently exploited as entry points for cyberattacks such as phishing, malware distribution, and website defacement. Detecting malicious URLs directly from their lexical structure, without page retrieval, is essential for low-latency defense but remains challenging due to adversarial obfuscations (e.g., homoglyphs, zero-width insertions, subdomain stuffing) and severe class imbalance in real-world corpora. To address these issues, we propose an attacker-aware lexical classification pipeline that combines structure-preserving tokenization, a library of attacker-style augmentations, supervised contrastive (SupCon) pretraining, and class-weighted focal loss fine-tuning. The Transformer encoder serves as the feature extraction model, while a lightweight MLP head performs classification. Empirical evaluations performed on the large Kaggle malicious phishing dataset show that the proposed methodology achieves the accuracy of 99.57% and the macro-F1 score of 99.38% on a hold-out test set, and thus consistently outperforms previously established state-of-the-art baselines. Notably, minority classes, which includes malware, achieves an accuracy and macro-G1 score greater than 99% in all aspects of measurement, highlighting the resentment of the method to adversarial string perturbations. The framework developed is computationally efficient, content agnostic and capable of deployment in a real-time operational scenario that provides a pragmatic defence mechanism against modern cyber threats.
2026
979-8-3315-6576-3
Chaos driving, Malicious URL detection, Adversarial robustness, Contrastive learning, Focal loss, Transformer encoder
File in questo prodotto:
File Dimensione Formato  
Attacker-Aware_Contrastive_Learning_for_Robust_Malicious_URL_Classification.pdf

Accesso riservato

Descrizione: Attacker-Aware Contrastive Learning for Robust Malicious URL Classification
Tipologia: Versione Editoriale (PDF)
Licenza: Copyright dell'editore
Dimensione 755.66 kB
Formato Adobe PDF
755.66 kB Adobe PDF   Visualizza/Apri   Richiedi una copia

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.11771/44738
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus ND
  • OpenAlex 0
social impact