Skip to main content
← CONCEPTS / SECURITY & IDENTITY
An end-to-end domain learning journey

MFA &
Risk-Based Authentication.

Risk-based Multi-Factor Authentication (RBA) evaluates contextual telemetry—device posture, ASN/GeoIP, impossible travel, and TLS fingerprints—in real time to dynamically step up high-risk logins to phishing-resistant WebAuthn/FIDO2 while keeping trusted sessions frictionless.
Start the journey7 sections· Last modified Oct 23, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When untrusted callers cross a trust boundary, static SMS/push MFA fails against AiTM reverse-proxy phishing and push bombing; pair a <50 ms risk-scoring engine with origin-bound FIDO2/WebAuthn passkeys and number-matched push fallback.

TL;DR30-second simplified summary
▾

Core Mechanics: Risk-Based Authentication (RBA) evaluates contextual signals at login time in <50 ms—device posture/cookie, IP reputation (Tor/VPN/residential proxy ASN), impossible travel (>800 km/h), and JA4 TLS fingerprint—and routes.

Visual & Structural Flow: Depicts Real-Time Risk Scoring & Authentication Decision Tree (LOW RISK (0-29) -> MEDIUM (30-69) -> HIGH (70-100)); Why WebAuthn Defeats Evilginx Reverse-Proxy Phishing (User Browser -> evil-login.com -> corp-idp.com).

Trade-Offs & Production: Compare MFA factors across phishing resistance, UX, and recovery complexity. Even with WebAuthn, a stolen session cookie (Set-Cookie) can be replayed from another machine.

Failure Modes & Application: Connect adaptive MFA to OAuth2/OIDC flows, JWT validation, and zero-trust service authentication.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
API Security: OAuth 2.1, JWT & mTLS
Modern API security pairs OAuth 2.0 (for delegated user/client authorization), signed JWTs (for stateless, verifiable claims), and Mutual TLS (mTLS) (for cryptographic workload and high-assurance client identity).
Full walkthrough · 7 stages
01
STAGE 01 · WHAT IT ISL4 · FUNDAMENTALS

What is Risk-Based MFA (RBA) & WebAuthn.

Why this matters: The mechanism: understand how Risk-Based MFA (RBA) & WebAuthn works from first principles.

Risk-Based Authentication (RBA) evaluates contextual signals at login time in <50 ms—device posture/cookie, IP reputation (Tor/VPN/residential proxy ASN), impossible travel (>800 km/h), and JA4 TLS fingerprint—and routes to frictionless SSO, number-matched push, or FIDO2/WebAuthn step-up.

FIDO2/WebAuthn signs a server challenge using a hardware/passkey private key cryptographically bound to the exact TLS origin (rpId), neutralizing reverse-proxy phishing.

Adaptive Step-Up

Real-Time Risk Scoring & Authentication Decision Tree

Unknown browser cookieTor exit / >800km/hFIDO2 rpId verifiedLOW RISK (0-29)MDM + known IP/JA4MEDIUM (30-69)New ASN / CGNAT hopHIGH (70-100)Tor / impossible travel

Trusted corporate devices stay frictionless while anomalous sessions trigger origin-bound FIDO2 step-up.

02
STAGE 02 · WHY WE NEED ITL4 · FUNDAMENTALS

Why AiTM Phishing Proxies and Push Bombing defeat legacy MFA.

Why this matters: The problem: see what breaks without Why AiTM Phishing Proxies and Push Bombing defeat legacy MFA under real concurrency or scale.

Credential stuffing and Adversary-in-the-Middle (AiTM) phishing proxies (e.g., Evilginx) relay passwords, SMS OTPs, and TOTP codes in real time, stealing the resulting Set-Cookie session token.

Meanwhile, MFA Fatigue (Push Bombing) floods a victim's phone with push prompts until they tap Approve by mistake.

AiTM Defense

Why WebAuthn Defeats Evilginx Reverse-Proxy Phishing

User Browserevil-login.comcorp-idp.com1. Relay WebAuthn challenge2. Sign clientDataJSON(origin=evil)3. IdP checks origin !=corp-idp.com

The browser signs the actual address-bar origin; an AiTM proxy on a lookalike domain cannot forge a valid rpId signature.

Engineering Decision Framework
Problem
How to implement MFA & Risk-Based Authentication without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
When untrusted callers cross a trust boundary, static SMS/push MFA fails against AiTM reverse-proxy phishing and push bombing; pair a <50 ms risk-scoring engine with origin-bound FIDO2/WebAuthn passkeys and number-matched push fallback.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When MFA & Risk-Based Authentication experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
STAGE 03 · WHERE IT IS USEDL5 · APPLIED DESIGN

Where Adaptive MFA applies (and where Workload Identity wins).

Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Think of Where Adaptive MFA applies (and where Workload Identity wins) as the intuition layer for MFA & Risk-Based Authentication: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Use RBA + WebAuthn for human interactive logins; use cryptographic workload identities for machines.

ChoiceWhat it buysWhat it costs
Good Candidate: Human SSO & High-Risk TransfersProtects OIDC/SAML gateways, admin consoles, and financial transfers without punishing known MDM devices.Must maintain offline break-glass recovery keys for P0 datacenter outages.
Avoid: Machine-to-Machine (M2M) Service AccountsUse short-lived OIDC workload identity tokens, SPIFFE/mTLS certificates, or asymmetric JWTs.Interactive MFA cannot run in headless automated pipelines.
04
STAGE 04 · HOW IT IS MANAGEDL5 · APPLIED DESIGN

Deterministic Risk Evaluation & Number-Matched Push Fallback.

Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.

Think of Deterministic Risk Evaluation & Number-Matched Push Fallback as the intuition layer for MFA & Risk-Based Authentication: Operational control: configure bounds, failure handling, and safe production defaults.

Evaluate ASN, impossible travel, and device trust in <50 ms, enforce WebAuthn rpId verification, and cap push attempts (e.g., max 3 per 15 min) with 2-digit number matching.

Lifecycle & Failure Recovery

Deterministic Risk Evaluation & Number-Matched Push Fallback

check pubkeyRBAC/ABAC matchkid/TTL mismatchUnauthenticatedSignature VerifiedPolicy AllowedExpired / Revoked
def evaluate_login_risk(ctx: dict) -> str:
    score = 0
    if ctx["asn_type"] in ("tor_exit", "hosting_vps"):
        score += 55
    if ctx["travel_kmh"] > 800 and not ctx["known_corporate_vpn"]:
        score += 45
    if not ctx["trusted_device_binding"]:
        score += 25
    if score >= 70:
        return "STEP_UP_WEBAUTHN_ONLY"  # Block TOTP/SMS; require FIDO2
    if score >= 30:
        return "STEP_UP_NUMBER_MATCH"   # 2-digit push or WebAuthn
    return "ALLOW_SESSION"
05
STAGE 05 · ALTERNATIVESL6 · SCALE & TRADE-OFFS

Alternatives: FIDO2/WebAuthn vs. Number-Matched Push vs. TOTP/SMS.

Why this matters: The trade-off: compare competing approaches across latency, consistency, and operational cost.

Think of Alternatives: FIDO2/WebAuthn vs. Number-Matched Push vs. TOTP/SMS as the intuition layer for MFA & Risk-Based Authentication: The trade-off: compare competing approaches across latency, consistency, and operational cost.

Compare MFA factors across phishing resistance, UX, and recovery complexity.

Request & State Flow

Alternatives: FIDO2/WebAuthn vs. Number-Matched Push vs. TOTP/SMS

Client / WorkloadEdge PolicyEnforcerIdP / JWKS / VaultProtected API1. Present signed token / mTLScert2. Verify signature via cachedJWKS3. Forward attenuated identityclaims4. Return scoped resource response
ChoiceWhat it buysWhat it costs
FIDO2 / WebAuthn / PasskeysOrigin-bound (immune to AiTM phishing), zero server shared secrets, one-tap biometric UX.Requires cross-device passkey sync or hardware backup keys for lost-device recovery.
Number-Matched Push MFADefeats blind MFA fatigue bombing by requiring the user to type a 2-digit screen code.Still vulnerable to social-engineered real-time AiTM proxies if the user reads the code aloud/into a proxy.
SMS / TOTPUniversal fallback across any phone.Vulnerable to SIM swapping (SMS) and real-time AiTM phishing relays (both).
06
STAGE 06 · PRODUCTION ARCHITECTUREL7 · STAFF / PRINCIPAL

Device-Bound Sessions (DBSC) + Offline Break-Glass.

Why this matters: Production architecture: see how the components compose end to end under real load.

Think of Device-Bound Sessions (DBSC) + Offline Break-Glass as the intuition layer for MFA & Risk-Based Authentication: Production architecture: see how the components compose end to end under real load.

Even with WebAuthn, a stolen session cookie (Set-Cookie) can be replayed from another machine. Modern IdPs pair WebAuthn with Device Bound Session Credentials (DBSC) / mTLS token binding and keep hardware-key break-glass admin accounts outside the risk engine.

CGNAT False-Positive Tuning

Mobile carriers rotate CGNAT IPs across cities; weight device-bound cookies and JA4 TLS fingerprints higher than raw GeoIP city hops.

Rate-Limit Push Prompts

Cap push notifications at 3 per 15 minutes and auto-lock/alert on repeated denials.

07
STAGE 07 · PROBLEMS SOLVED & FURTHER DEEP DIVEL7 · STAFF / PRINCIPAL

Related Security & Identity Concepts.

Why this matters: Applied problems: connect these internals to concrete system design and debugging scenarios.

Think of Related Security & Identity Concepts as the intuition layer for MFA & Risk-Based Authentication: Applied problems: connect these internals to concrete system design and debugging scenarios.

Connect adaptive MFA to OAuth2/OIDC flows, JWT validation, and zero-trust service authentication.

Component Topology

Related Security & Identity Concepts

ClientingressEdge GatewaycomputeJWKS / VaultstorageTarget ServicecontrolBearer / mTLSkey lookupscoped call
Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why is FIDO2/WebAuthn immune to Adversary-in-the-Middle (AiTM) reverse-proxy phishing attacks like Evilginx?

Recommended Learning Flow