Built to order

Phishing URL Detection using Machine Learning

This project builds a machine-learning classifier that scores URLs for phishing risk from 30 lexical, host and brand-impersonation features, trained on phishing URLs from PhishTank and legitimate URLs from the Tranco list. It includes the complete training notebook, the trained XGBoost model, and a web demo where you paste any URL and get a risk score with a feature-by-feature breakdown and scan history. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Phishing URL Detection using Machine Learning — project thumbnail preview
More project photos (2)

The problem

Phishing remains the cheapest way to breach an organization — one convincing fake login page, one clicked link. Blocklists cannot keep up with the churn of new phishing domains, so content-agnostic URL classification is the practical first filter: decide from the URL string alone, before any page loads. This project engineers 30 such features — URL length, subdomain depth, hyphen and digit patterns, suspicious TLDs, sensitive keywords, and edit-distance to the top-500 brands for typosquat detection — and trains an XGBoost classifier on PhishTank phishing URLs versus Tranco legitimate domains. Evaluation uses a time split (train on older URLs, test on newer) so the score reflects drift, not memorization. The web demo scans any pasted URL, shows the risk gauge, explains every feature's contribution, and keeps a scan history.

How it works

  1. Phishing URLs are collected from the PhishTank community feed; legitimate URLs are sampled from the Tranco top-1M list with dead domains filtered.
  2. The corpus is split by first-seen date: older URLs for training, newer for testing, so evaluation measures drift robustness.
  3. 30 features are extracted per URL: lexical (length, entropy, digit ratio, hyphen/dot counts), host (IP literal, subdomain depth, TLD rarity, punycode), path (depth, query count, sensitive keywords), brand (min edit-distance to top-500 brands), reputation (domain-age bucket, redirect chain).
  4. An XGBoost classifier (500 trees, max depth 8) is trained with stratified 5-fold cross-validation and early stopping.
  5. The time-split test set is scored once: precision, recall, F1, ROC-AUC and the precision-recall curve are exported.
  6. Validation-fold analysis picks the block (≥70) and review (40–70) thresholds for the risk policy.
  7. In the web demo, a pasted URL goes through the identical 30-feature extractor and the saved model returns the risk score with the full feature breakdown.

Tech stack:

  • Python 3, XGBoost, scikit-learn
  • PhishTank feed + Tranco list
  • pandas, NumPy, Matplotlib
  • tldextract (URL parsing)
  • Jupyter Notebook (training)
  • HTML/CSS/JavaScript (scanner demo)

Dataset & model details

  • Dataset: Phishing URLs from the PhishTank community-verified feed; legitimate URLs from the Tranco top-1M domain list (filtered to active domains). Build target approximately 110,000 labeled URLs (50k phishing / 60k legitimate); time-split by first-seen date.
  • Task: Binary classification; input = 30 engineered URL features, output = phishing probability (0–100 risk score).
  • Model: XGBoost — 500 trees, max depth 8, learning rate 0.05, subsample 0.8, early stopping on validation log-loss.
  • Metrics: F1 ~96% (design target for the built-to-order training run), precision, recall, ROC-AUC, PR curve. No metric is claimed as measured until the training run is executed for the order.
Parameter Value
Input format Raw URL string
Features 30 (lexical, host, path, brand, reputation)
Dataset size Approximately 110,000 URLs (design size)
Model XGBoost, 500 trees, depth 8
Test F1 ~96% (design target, not a measured claim)
Feature extraction <5 ms per URL (expected)
Inference <2 ms per URL on CPU (expected)
Demo Web app with risk gauge + feature breakdown

Project features

  • [30-feature engineering] Lexical, host, path, brand-impersonation and reputation features extracted from the URL string alone — no page fetch needed.
  • [Live URL scanner demo] Paste any URL for an instant risk score with a per-feature breakdown showing exactly which signals fired.
  • [Typosquat detection] Edit-distance of the host against the top-500 brands catches amaz0n-style impersonation.
  • [XGBoost classifier] 500 gradient-boosted trees tuned with stratified cross-validation; feature importance exported for the report.
  • [Time-split evaluation] Train on older URLs, test on newer ones — measures robustness to phishing drift honestly.
  • [Risk policy] Score thresholds map to block / step-up / allow actions, tuned on the validation fold.
  • [Scan history] The demo logs every scanned URL with its verdict and top signal.

What is included

  • Complete training & evaluation Jupyter notebook
  • Trained XGBoost model file with the 30-feature extractor
  • URL scanner web demo (risk score, breakdown, history)
  • Feature-importance chart, PR curve and threshold analysis
  • Project report PDF (background, phishing taxonomy, feature engineering, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (gradient boosting, feature design, drift, thresholds)

Limitations & prerequisites

  • ~96% F1 is a design target for the training run, stated honestly — the report documents the actual achieved figure.
  • URL-only signals cannot catch phishing on compromised legitimate domains; content analysis would be a second stage.
  • Brand-impersonation detection covers the top-500 brands; obscure-brand phishing scores lower.
  • Phishing tactics drift — the time-split evaluation quantifies degradation on newer URLs honestly.
  • URL shorteners hide the destination; the demo flags them as suspicious rather than resolving them.

Frequently Asked Questions

Which data sources are used?

Phishing URLs from PhishTank's community-verified feed and legitimate URLs from the Tranco top-1M list, filtered to active domains — roughly 110,000 labeled URLs in the build target, split by first-seen date.

Why a time split instead of a random split?

Phishing tactics drift constantly. A random split lets the model memorize current campaigns; training on older URLs and testing on newer ones measures what actually matters — how it handles attacks it has never seen.

What are the 30 features?

Five groups: lexical (length, entropy, digit/hyphen counts), host (IP literal, subdomain depth, TLD rarity, punycode), path (depth, query params, sensitive keywords like "verify"), brand (edit distance to top-500 brands), and reputation (domain age, redirect chain).

How does it catch typosquatting?

The host's edit distance to each of the top-500 brand names is computed; a small distance on a non-official domain (amaz0n-deals.tk) is one of the strongest phishing signals in the importance ranking.

Can it scan a shortened URL?

It flags shorteners as suspicious but does not resolve them — expanding short links requires a network fetch the demo deliberately avoids; it is listed as future scope.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI/ML programs. It demonstrates feature engineering, gradient boosting, drift-aware evaluation and a genuinely useful security demo. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Components & software requirements
  • Python 3, XGBoost, scikit-learn
  • PhishTank feed + Tranco list
  • pandas, NumPy, Matplotlib
  • tldextract (URL parsing)
  • Jupyter Notebook (training)
  • HTML/CSS/JavaScript (scanner demo)

Dataset & model details

  • Dataset: Phishing URLs from the PhishTank community-verified feed; legitimate URLs from the Tranco top-1M domain list (filtered to active domains). Build target approximately 110,000 labeled URLs (50k phishing / 60k legitimate); time-split by first-seen date.
  • Task: Binary classification; input = 30 engineered URL features, output = phishing probability (0–100 risk score).
  • Model: XGBoost — 500 trees, max depth 8, learning rate 0.05, subsample 0.8, early stopping on validation log-loss.
  • Metrics: F1 ~96% (design target for the built-to-order training run), precision, recall, ROC-AUC, PR curve. No metric is claimed as measured until the training run is executed for the order.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation