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.

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.
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.
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
Intended users
University students, lecturers and staff, non-technical internet users, and campus IT and cybersecurity-awareness teams.
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
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.
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.
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.
Screenshots





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.
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
Continue reading
AI / Machine Learning
Student Performance Prediction
A Linear Regression model on a 1,000-record dataset achieving R² = 0.8875 and MAE = 4.07, benchmarked against a tuned Random Forest (R² = 0.860).
Case studyAI / Machine Learning
Adult Income Classifier
A deployed machine learning app that predicts whether an individual’s annual income exceeds $50,000 from UCI Adult census data — a Decision Tree model served by a FastAPI backend with a static web frontend.
Case study