Skip to content
All projects
AI / Machine Learning2026In progress

ThreatLens AI — Explainable Phishing URL Detection

A web application that classifies a submitted URL as likely benign, suspicious or high risk with a trained machine-learning model, explains exactly why, and gives proportionate safety guidance — without ever contacting the destination website.

ThreatLens AI — Explainable Phishing URL Detection cover
01

Overview

ThreatLens AI analyses a submitted URL with a trained machine-learning model, explains why the URL received its classification, and gives safety guidance matched to the evidence. The analysis runs on the URL string alone, so the destination website is never contacted. It is a cybersecurity prototype I built as a student at the School of Computing & Informatics, Albukhary International University, and entered in the MMC Upstart 2026 Catalyst competition. It is an assistive screening tool, not a definitive security verdict.

02

The problem

Phishing attacks rely on deceptive URLs to harvest credentials and sensitive information. Students and other non-technical internet users, frequent targets of fake "bursary", "account blocked" and "scholarship" messages, have no practical way to inspect a link before interacting with it, and existing tools either give verdicts without reasoning or send the analysis to third-party infrastructure.

03

Objectives

  • Classify a URL as likely benign, suspicious or high risk, with an explicit uncertainty flag
  • Explain every prediction with the exact feature contributions behind it
  • Give safety recommendations matched to the evidence and state what the system cannot determine
  • Never contact the destination website
04

Intended users

University students, lecturers and staff, non-technical internet users, and campus IT and cybersecurity-awareness teams.

05

Features

  • URL scan with a classification, a risk score from 0 to 100 and an uncertainty flag
  • Exact per-URL explanation of the model's decision (decision-path decomposition), kept separate from rule-based observations
  • Safety guidance matched to the evidence, plus honest limitations for every result
  • Analysis on the URL string only: no network request to the destination, so it is safe against server-side request forgery by design
  • Sign-in with Supabase Auth, per-user scan history with search, filters and deletion, and a dashboard
  • Model performance page with the evaluation report generated by the training pipeline
06

Architecture & implementation

A React 19, TypeScript, Vite and Tailwind CSS single-page app talks to a Python 3.12 FastAPI service. The API verifies Supabase access tokens, validates the URL on the server, parses it without any network I/O, and computes 33 lexical features with one shared, versioned extractor that is used for both training and live inference. A scikit-learn Extra Trees model scores the URL and an explanation service decomposes the prediction exactly. Scan history is stored in SQLite locally or in Supabase Postgres with Row Level Security, so every query runs under the user's own token. The model is built in a reproducible Jupyter research notebook; a Dockerfile serves the API and the built app from one container.

07

My contribution

I designed and built the whole project on my own: the machine-learning research notebook (data collection and validation, feature engineering, model selection, evaluation and deployment of the model), the FastAPI backend with token verification, URL validation and the explanation service, the React frontend, the Supabase database schema with Row Level Security, the automated tests, the Docker setup and the project documentation.

08

Challenges & solutions

Challenge

Random train/test splits let the model memorise website domains and overstate its performance.

Solution

Domain-grouped splits so that no website domain appears in both training and test data; the study measured that random splits would have overstated PR-AUC by 0.04.

Challenge

Explanations had to be exact for every URL, not approximate global importances.

Solution

Only models with exact per-URL explanations were eligible; the decision-path decomposition was verified on 500 test URLs to reproduce the model's probabilities exactly.

Challenge

Features computed differently in training and in production would silently degrade predictions.

Solution

One shared, versioned feature extractor for training and inference, and a schema-version check that refuses to serve mismatched model files.

Challenge

Fetching a suspicious website to inspect it is risky and can alert the attacker.

Solution

The scan works on the URL string alone; no HTTP client exists in the scan path.

09

Screenshots

Scan result: classification, risk score, the model's explanation and the observed URL characteristics.
Scan result: classification, risk score, the model's explanation and the observed URL characteristics.
Model selection: tuned models compared under repeated domain-grouped cross-validation.
Model selection: tuned models compared under repeated domain-grouped cross-validation.
Confusion matrix of the selected Extra Trees model on 2,110 test URLs from unseen domains.
Confusion matrix of the selected Extra Trees model on 2,110 test URLs from unseen domains.
ROC and precision-recall curves of the candidate models on the test set.
ROC and precision-recall curves of the candidate models on the test set.
Exact per-URL explanations for three test URLs: the features that pushed each prediction.
Exact per-URL explanations for three test URLs: the features that pushed each prediction.
10

Outcomes & evaluation

The Extra Trees model was selected from eight learners and two baselines under domain-grouped cross-validation. On 2,110 test URLs from domains it never saw during training it reached PR-AUC 0.928 (95% CI 0.901–0.949), ROC-AUC 0.931, accuracy 85.7%, precision 89.4% and recall 77.1%, with an exact explanation for every URL. It flags 78.7% of 300 fresh OpenPhish URLs and about 3% of the 1,000 most-linked legitimate domains. 120 automated backend tests pass, and model inference takes about 55–60 ms per URL.

11

Lessons learned

  • Evaluate on unseen domains: random splits can make a URL classifier look better than it is
  • An explainable model that is only slightly less accurate can be the better choice when users must understand the decision
  • State uncertainty and limitations honestly instead of presenting an estimate as a verdict