Master's Thesis Project | Metropolia University of Applied Sciences Student: Osamah Amer (2026)
Field: Information Technology / Cyber Security
Topic: Evaluating Authentication Resilience against Adversary-in-the-Middle (AiTM) Attacks: A Comparative Study of Reverse-Proxy Mechanics and FIDO2/WebAuthn Defenses.
The Phishing Defense Lab is a professional full-stack simulation environment designed to analyze the mechanics of modern phishing attacks—specifically Reverse Proxy (AiTM) attacks like Evilginx2—and evaluate the efficacy of various defense mechanisms.
Unlike standard vulnerable web applications, this platform focuses exclusively on Authentication Security, providing a comparative analysis of legacy protocols versus hardware-bound credentials (FIDO2/WebAuthn).
The project follows a decoupled, containerized architecture designed for consistent deployment across local and cloud environments:
- Frontend (Victim UI): A React/Vite SPA with a "Security-Ops" aesthetic. It implements active client-side defenses (DOM/Hostname analysis).
- Backend (Security Engine): A Node.js/Express API handling session management, cryptographic WebAuthn challenges, and active threat detection.
- Database: PostgreSQL for persistent storage and an active Token Blacklist for immediate session revocation.
- Infrastructure: Nginx acting as a Reverse Proxy with Docker Compose for full-stack orchestration.
The laboratory is structured into five levels, representing the evolution of web security:
- Level 1: Legacy Auth (Cookies): State-based sessions using
HttpOnlycookies. High susceptibility to session hijacking via proxy forwarding. - Level 2: Modern SPA (JWT): Stateless JSON Web Tokens. INTERCEPT-ready during the initial handshake in non-hardened environments.
-
Level 3: Server-Side Traffic Analysis:
- Fingerprinting: Inspects HTTP headers (
X-Evilginx) to detect default tool signatures. - Host Validation: Enforces strict "Source of Truth" checks against
HostandX-Forwarded-Hostheaders to detect proxy forwarding discrepancies.
- Fingerprinting: Inspects HTTP headers (
-
Level 4: Client-Side Integrity (Domain Guard):
- Zero Trust Validation: JavaScript execution verifies the
window.location.hostnameagainst a strict whitelist. - Anti-Mirroring (Obfuscation): Uses Base64-encoded configuration payloads to defeat Evilginx's "Content Replacement" filters (Reality Mirroring), triggering a kill-switch if the decoded origin does not match the browser's URL bar.
- Zero Trust Validation: JavaScript execution verifies the
- Level 5: Hardware-Bound Auth (FIDO2): Uses WebAuthn/FIDO2 to cryptographically bind authentication to the origin. This renders AiTM attacks mathematically impossible as proxies cannot forge the origin signature.
The following defense mechanisms are proposed for future iterations to counter evolving AiTM tactics:
-
Advanced Turing Tests (Captcha Defense):
- Objective: To block automated "pre-flight" probes used by Evilginx bots.
- Mechanism: Implementing Cloudflare Turnstile or hCaptcha to force human interaction before the login form renders.
-
Dynamic Input Randomization:
- Objective: To break the static Regex capturers defined in Evilginx Phishlets.
- Mechanism: Dynamically randomizing HTML input
nameandidattributes (e.g., generatingpassword_x92instead ofpassword) on every page load to render static phishlets ineffective.
This lab demonstrates how specific defenses break the Evilginx kill chain:
| Defense | How it Defeats Evilginx |
|---|---|
| Header Analysis (Lab 3) | Detects inconsistencies in Host headers and identifies signatures left by default proxy configurations. |
| Base64 Obfuscation (Lab 4) | Evilginx attempts to "Mirror Reality" by replacing real domains in the response with fake ones. By encoding the domain in Base64 (dGhlc...), the proxy cannot find/replace the string, revealing the deception to the client-side code. |
| Origin Binding (Lab 5) | Cryptographically binds the session to the domain name. Even if a proxy intercepts the traffic, it cannot generate a valid signature for the fake domain. |
The project includes a Unified Setup Script (setup.sh) that automates environment configuration, dependency checks, and security provisioning.
-
Ensure Docker Desktop is running.
-
Run the initializer:
chmod +x setup.sh ./setup.sh
-
Select your mode:
- Option 1 (Local): Deploys to
http://localhost. - Option 2 (Production): Automates SSL (Certbot/HTTPS) generation and deploys to your custom domain on AWS/VPS.
- Option 1 (Local): Deploys to
-
Retrieve Admin Credentials: The system generates a secure, random password for
admin@lab.comon the first run. To retrieve it, check the backend logs:docker logs phishing_lab_backend
Look for the line:
[ADMIN SEED] Admin Initialized | Email: admin@lab.com | Password: xxxxxxxxxxxxxxxx
To support academic research and threat analysis, the backend generates real-time forensic audit trails in the backend/logs/ directory:
terminated.txt: Records successful session revocations, including the full revoked token for replay-attack testing.blocked_attempts.txt: Logs detailed metrics of blocked attackers, including IP Address, User-Agent, and Geographic Metadata.
| Component | Technology | Description |
|---|---|---|
| Frontend | React 18, Vite | High-performance UI with custom security themes. |
| Backend | Node.js, Express | Security-hardened REST API (Non-root Docker user). |
| Database | PostgreSQL 14 | Relational storage with active session blacklisting. |
| Auth | SimpleWebAuthn | FIDO2/WebAuthn server-side implementation. |
| Infrastructure | Docker, Nginx | Container orchestration and SSL termination. |
/
├── backend/ # API Logic, Database Models & Forensic Logs
│ ├── logs/ # Audit trails (terminated.txt, blocked_attempts.txt)
│ ├── middleware/ # Active defense (Blacklist, ProxyDetect)
├── client/ # Frontend React Application & Nginx Config
│ ├── nginx.conf # Routing & Production SSL configurations
│ └── src/utils/ # Developer Branding & Console Signatures
├── setup.sh # Multi-OS Automation Script (Local/Prod)
├── docker-compose.yml # Production-ready orchestration (Ports 80/443)
└── .env.example # Environment variable template
This software is a research prototype developed for educational and academic purposes. It contains code designed to demonstrate vulnerabilities. Do not deploy the vulnerable configurations (Levels 1 & 2) in a production environment exposed to the public internet without proper firewalling.