Skip to content
BookantnaPublic

About

Lightweight, leakage-aware phishing detection research pipeline for browser deployment

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

phishMe

A lightweight phishing detection pipeline built around one question: does a model that looks near-perfect on its own benchmark still work on data it has never seen?

phishMe trains small classifiers on URL and DOM features that a browser can compute. Its evaluation is designed to prevent data leakage, and the trained linear model runs fully on-device in a Chrome extension.

Status: research prototype. Cross-dataset results show the current models do not generalize (see Results). The extension is experimental and is not a substitute for Chrome Safe Browsing.

Highlights

  • Leakage-aware splits: URLs are de-duplicated, then train, validation, and test sets are kept disjoint by registrable domain and phishing family, so near-duplicate sites never appear in more than one split.
  • Honest evaluation: thresholds and the primary model are chosen on validation data only. The holdout is scored once, and cross-dataset comparisons use paired bootstrap 95% confidence intervals (10,000 resamples).
  • Three model variants: a sparse linear classifier (SGD log-loss), a LightGBM gradient-boosted tree, and an out-of-fold stacking hybrid.
  • Browser deployment gates: a headless-Chrome harness checks that the model payload is at most 25 MB and that p95 scoring latency is at most 250 ms.
  • Python/JavaScript parity: browser feature extraction and scoring (web/scorer.js) are tested against the Python implementation.
  • Reproducibility: pinned dataset revisions, fixed seeds, and SHA-256 manifests for audited artifacts.

Results

In-distribution vs. cross-dataset

The three variants were trained on the PhishPedia benchmark (46,786 rows after de-duplication; 28,068 train / 9,356 validation / 9,362 test, seed 42). They were then scored on a 500-record slice (275 benign, 225 phishing) of the frozen PhreshPhish test split, which none of the models saw during training or tuning.

Variant Validation AP Validation F1 Cross-dataset AP Cross-dataset F1 Precision Recall FPR AUC
Linear 0.9999 0.9979 0.4398 0.5365 0.4341 0.7022 0.7491 0.4623
Tree 1.0000 0.9994 0.3970 0.5373 0.4045 0.8000 0.9636 0.3933
Hybrid 1.0000 0.9995 0.4024 0.5236 0.3981 0.7644 0.9455 0.4169

Finding (negative result): near-perfect in-distribution scores do not transfer. On unseen data, precision drops to 0.40–0.43, the false-positive rate rises to 75–96%, and AUC falls below 0.5. The models appear to learn characteristics of the source corpus rather than general phishing signals.

This slice is the first 500 records in stream order, so the confidence intervals are wide. A definitive result requires the full 168,060-record test split.

Browser deployment

The fully trained linear model (about 5.7 MB) passed both deployment gates in headless Chrome over 200 scoring runs. Per-page latency was below the harness's timer resolution.

How it works

PhishPedia archives ──► adapters ──► de-duplication ──► grouped splits ──► train 3 variants
                                                                               │
                                            validation-only threshold and model selection
                                                                               │
              ┌───────────────────────────────┬─────────────────────────────────┤
              ▼                               ▼                                 ▼
   in-distribution holdout       frozen PhreshPhish test set        export linear model (JSON)
     (scored once)              (paired bootstrap vs. PhishLang)               │
                                                                    web scorer / Chrome extension

The research question, data provenance, split rules, and metric definitions are documented in METHOD.md.

Project structure

src/phishme/     Python package: data adapters, features, models, training,
                 evaluation, cross-dataset runner, export, CLI
tests/           pytest suite
web/             browser scorer, benchmark page, Python/JS parity tests
extension/       Chrome Manifest V3 extension with unit and end-to-end tests
scripts/         PhishLang baseline scoring, browser measurement, utilities
notebooks/       Colab notebooks for dataset download and inspection
docs/            design specs and implementation plans

Getting started

Requirements: Python 3.9+, Node.js 18+, and Chrome or Chromium for the browser and extension tests.

git clone https://github.com/Bookantna/phishMe.git
cd phishMe
python -m venv .venv
source .venv/bin/activate            # Windows: .venv\Scripts\activate
python -m pip install -e '.[dev,tree,cloud]'
npm install

Run the checks:

python -m pytest                     # Python test suite
ruff check .                         # lint
npm test                             # parity and extension unit tests
npm run test:extension:e2e           # extension end-to-end tests (headless Chrome)

Optional extras: tree installs LightGBM, and cloud installs Hugging Face datasets for streaming PhreshPhish.

Usage

Datasets are not included. Download them from their official sources first (see Data and licenses).

Train all three variants on the official PhishPedia archives. The archives are read directly as ZIP files, with no extraction step:

python -m phishme v3-train \
  --phish-zip path/to/phish_sample_30k.zip \
  --benign-zip path/to/benign_sample_30k.zip \
  --output artifacts/v3

Evaluate on the frozen PhreshPhish test split and compare against PhishLang predictions using paired bootstrap:

python -m phishme v3-eval \
  --output artifacts/v3 \
  --phishlang-csv path/to/phishlang-predictions.csv \
  --records path/to/phreshphish-test.jsonl   # omit to stream the pinned split

Measure browser deployment metrics for an exported model:

python -m phishme v3-browser --model artifacts/v3/model-linear.json --output artifacts/v3/browser
Command Purpose
v3-train Train linear, tree, and hybrid variants; write models, validation-report.json, and run.json
v3-eval Cross-dataset evaluation; write cross-dataset-report.json
v3-browser Headless-Chrome latency and memory check; write browser-metrics.json
audit, local Earlier baseline on the PhiUSIIL dataset
phresh-smoke Bounded PhreshPhish streaming and training smoke test

Run python -m phishme <command> --help for all flags. Useful options include --limit for small smoke runs, --epochs, --batch-size, and --seed.

Chrome extension

The extension runs the exported linear model entirely in the browser. It extracts the same URL and DOM features as web/scorer.js, shows a per-tab badge, and displays a dismissible warning on positive classifications. Pages are never sent to a server, and the extension requests only storage and page access permissions.

npm run build:extension -- --model artifacts/v3/model-linear.json --outdir extension/dist

Then load extension/dist from chrome://extensions with Developer mode enabled. A negative result reads "No phishing signal detected," never "safe." See extension/README.md for details on permissions, privacy, and testing.

Data and licenses

Dataset Role Source License
PhishPedia Training and in-distribution evaluation Official site CC0-1.0
PhreshPhish Frozen cross-dataset test set Hugging Face, pinned revision eabec4b CC BY 4.0 (anti-phishing research only)
PhishLang Pretrained MobileBERT reference baseline UTA-SPRLab/phishlang See upstream

Raw datasets, HTML, model checkpoints, predictions, and generated reports are kept out of Git. PhreshPhish test records are never used for training, threshold selection, or tuning.

Roadmap

  • Leakage-safe PhishPedia training pipeline with audited artifacts
  • Cross-dataset evaluation on a PhreshPhish smoke slice
  • Browser deployment gates and a local Chrome extension
  • Batched-window PhishLang scoring (the current batch-1 scorer takes about 100–120 ms per window, which is too slow for large pages)
  • Full 168,060-record cross-dataset report with paired bootstrap against PhishLang
  • Feature and training changes aimed at cross-dataset generalization

Documentation

About

Lightweight, leakage-aware phishing detection research pipeline for browser deployment

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages