Delivered remotely for a business based in Amsterdam, Netherlands. Names withheld by agreement.
Project Overview
Credential-harvesting campaigns rarely rely on static blocklists anymore. Attackers host single-use forms on compromised SaaS buckets, chain multi-hop open redirects through reputable marketing trackers, and serve benign landing pages whenever datacenter IP addresses probe a link. Legacy mail filters that check only static domain reputation or simple regular expressions routinely miss freshly minted impersonation sites until employees have already submitted tokens.
To close that detection gap, we designed and shipped a phishing detection platform anchored in Amsterdam for European enterprises and managed security providers. Built with Python, FastAPI, and layered ML pipelines, the platform evaluates raw MIME messages, standalone URLs, and certificate-transparency lookalike streams, returning deterministic risk breakdowns to automated mail gateways and human SOC teams through a unified web console and REST API.
Threat Detection Blind Spots
Security engineering teams evaluating incoming phishing feeds confronted four operational weaknesses across existing rule engines:
- Evasive redirect chains: Links buried inside legitimate document-sharing notifications or URL shorteners masked final credential forms from shallow static scanners.
- Zero-hour brand spoofing: Attackers registered typosquatted domains minutes before launching campaigns, leaving historical reputation feeds completely blank.
- Opaque risk verdicts: Binary block/allow scores without supporting forensic artifacts forced SOC analysts to open suspicious links manually inside local VMs.
- Gateway latency constraints: Inline mail inspection could not afford multi-second browser rendering on every routine newsletter link without stalling enterprise email delivery.
Architectural Strategy
We structured detection as a confidence-tiered cascade rather than a single monolithic classifier. Cheap, deterministic checks execute first; expensive sandboxing runs selectively when signals conflict or ambiguity persists.
FastAPI ingests messages and URL submissions, computing normalized canonical indicators and querying Redis for recently evaluated hashes. When an indicator misses cache, Tier-1 Python ML models inspect lexical entropy, Punycode character substitutions, authentication headers (SPF, DKIM, DMARC), and ASN age. Indicators scoring in the uncertain middle band—or targeting monitored corporate brands—flow through RabbitMQ into isolated Playwright sandboxes where DOM structures, form action endpoints, and rendered screenshots undergo multimodal classification.
Core Capabilities
- Multimodal Threat Scoring: Fuses header anomaly vectors, URL structural features, HTML form-target analysis, and visual brand-similarity embeddings into one calibrated risk payload.
- Lookalike Domain Surveillance: Continuously permutes monitored domains across homoglyphs, combosquatting patterns, and newly issued TLS certificates to flag infrastructure before mail delivery starts.
- Isolated URL Detonation: Follows JavaScript-driven redirects inside sandboxed Playwright workers, capturing HAR network traces, script hashes, and full-page screenshots.
- Explainable Evidence Cards: Surfaces human-readable reasons—such as external credential POST targets or mismatched brand favicon hashes—directly inside the React analyst workbench.
- SOAR & Gateway Webhooks: Pushes quarantine recommendations, STIX-formatted indicators, and takedown evidence packets to downstream mail relays and ticketing queues.
Technical Architecture
Ingestion decouples low-latency synchronous scoring from asynchronous deep inspection. Mail plugins and SOAR tools submit JSON payloads or raw .eml blobs to FastAPI, which emits an immediate Tier-1 verdict or returns a correlation token while RabbitMQ dispatches deep detonation jobs.
Flow: Mail Gateway / SOAR Submission (FastAPI) → Indicator Canonicalizer & Redis Cache → Tier-1 Lexical & Header ML Models → RabbitMQ Deep-Inspection Queue → Isolated Playwright Detonation → DOM & Visual Brand ML Fusion → PostgreSQL Audit Ledger & React SOC Console
Every feature vector extracted during scoring is serialized alongside the model version that evaluated it. Storing immutable evaluation snapshots in PostgreSQL guarantees that incident responders inspecting an alert weeks later see the exact DOM tree, redirect path, and classifier weights active at detection time.
Technology Stack
| Category | Technology detail |
|---|---|
| API Gateway | Python FastAPI exposing synchronous verdict endpoints and webhook ingestion |
| ML Inference | Python ensemble models scoring lexical URLs, email headers, and DOM features |
| Visual Matching | Computer vision embeddings comparing rendered login pages against protected brand assets |
| Headless Sandbox | Ephemeral Playwright containers executing redirects and capturing final DOM snapshots |
| Task Broker | RabbitMQ routing fast-path header checks separately from heavy browser detonation |
| Feature Cache | Redis caching WHOIS lookups, ASN reputation, and recent URL verdict hashes |
| Threat Ledger | PostgreSQL persisting indicator lineage, analyst overrides, and training feedback |
| Analyst Console | React triage workspace displaying evidence graphs, DOM diffs, and screenshot captures |
| DNS Telemetry | Passive certificate transparency and lookalike domain permutation monitors |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Executing headless browsers on every email URL exhausts compute budgets | Implemented tiered scoring where fast lexical and header ML resolves clear verdicts immediately, reserving Playwright detonation for ambiguous or high-value brand targets. |
| Visual logo detectors trigger false positives on legitimate vendor login pages | Paired perceptual screenshot embeddings with domain allowlists and TLS issuer verification inside the fusion layer; adds governance upkeep for brand lists in exchange for sharp alert precision. |
| Phishing kits serve blank pages when detecting standard headless Chromium user agents | Customized Playwright launch profiles with realistic browser properties and egress proxy rotation, accepting slightly heavier worker footprints to expose cloaked forms. |
| Model updates occasionally shift score distributions for downstream SOAR thresholds | Enforced shadow-scoring evaluation against curated regression corpora in PostgreSQL and calibrated probability outputs before shifting production FastAPI traffic. |
Security & Sandbox Isolation
Detonating hostile URLs inside multi-tenant infrastructure demands rigid containment. Playwright containers run unprivileged with read-only root filesystems, strict memory and CPU ceilings, and custom DNS resolvers that block internal address spaces, RFC 1918 subnets, and cloud instance metadata IPs.
Downloaded scripts and rendered screenshots never touch shared worker disks; artifacts stream directly into tenant-scoped object storage encrypted with per-organization keys. API clients authenticate via short-lived scoped tokens, and strict MIME sanitization strips active attachments prior to preview rendering inside the React triage UI.
Performance & Resilience
Mail traffic spikes sharply at business-hour boundaries and during coordinated spam waves. Redis deduplicates identical tracking URLs across thousands of recipients by normalizing volatile query parameters while preserving path and redirect targets, ensuring a campaign hitting an entire company triggers deep detonation once rather than thousands of times.
RabbitMQ separates interactive user-reported phishing triage onto high-priority queues so bulk certificate-transparency crawls never delay analyst-submitted investigations. FastAPI worker pools scale horizontally behind health-checked inference processes with preloaded ML models in memory, avoiding cold-start deserialization penalties under sudden burst loads.
Operational Outcomes
Consolidating header forensics, ML classification, and sandboxed page inspection into a single pipeline gave SOC and brand-protection teams measurable operational clarity:
- Faster analyst triage: Responders review rendered screenshots, redirect hops, and DOM form targets side by side instead of manually inspecting suspicious links in local sandboxes.
- Earlier impersonation visibility: Continuous certificate and lookalike domain monitoring uncovers attacker staging infrastructure before mass credential campaigns begin.
- Consistent verdict explainability: Structured signal attributions eliminate black-box scoring disputes between mail administrators and security operations teams.
- Continuous model improvement: Analyst disposition clicks feed directly into curated retraining datasets, keeping ML classifiers aligned with shifting obfuscation tactics.