
Securing Git Repos: Git Hooks & TruffleHog Scans
October 30, 2026A threat actor sitting in a coffee shop in Warsaw intercepted the Microsoft 365 credentials of a Fortune 500 CFO in 2024 — not by breaking encryption, but by transparently proxying every HTTP request between the victim and Microsoft’s legitimate login servers. Multi-factor authentication was enabled. The session cookie was stolen anyway. The attack framework responsible? Evilginx2 — and the adversary-in-the-middle (AitM) paradigm it represents has fundamentally obsoleted a decade of conventional phishing defense doctrine.
Unlike traditional credential-harvesting phishing pages that mimic a login portal, Evilginx2 acts as a real-time reverse proxy, forwarding live authentication traffic between the victim and the legitimate identity provider. The user completes their MFA challenge successfully. The attacker captures the authenticated session token on the way back. From that moment, the attacker possesses a post-authentication session cookie that carries the same privilege as a legitimately logged-in user — no password needed, MFA entirely circumvented.
This is not a theoretical vulnerability class. The 2024 Verizon Data Breach Investigations Report (DBIR) confirmed that phishing remains involved in over 36% of all breaches, and security researchers tracking AitM campaigns documented a 350% increase in toolkits like Evilginx2, Modlishka, and Muraena between 2022 and 2025. Understanding the mechanics — and deploying layered countermeasures — is no longer optional for enterprise security programs.
How Evilginx2 Works: The Mechanics of AitM Phishing
To defend against any attack class, you must first understand it with engineering-level precision. Evilginx2 is an open-source, command-line man-in-the-middle attack framework built on top of a custom DNS and HTTPS server. It uses configuration files called “phishlets” — declarative YAML-like definitions that describe how to intercept, relay, and selectively modify HTTP traffic for a specific target platform (Microsoft 365, Google Workspace, Okta, GitHub, and dozens more).
The Attack Chain: DNS, TLS, and Session Hijacking
The attack flow is elegantly systematic. The threat actor registers a convincing lookalike domain (e.g., m1crosoft-login.com or a homograph attack domain using Unicode characters), configures Evilginx2 to serve TLS certificates via Let’s Encrypt, and deploys phishlets targeting the intended identity provider. The victim receives a spear-phishing email containing the attacker-controlled URL. Upon clicking, their browser connects to Evilginx2’s server, which simultaneously opens a connection to the real Microsoft or Google authentication endpoint.
Every request — including MFA challenges delivered via TOTP codes, push notifications, or SMS — passes transparently through the proxy. The identity provider authenticates the session successfully and issues a session cookie. Evilginx2 captures that cookie before delivering it to the victim’s browser. The attacker imports the cookie into their own browser using tools like Cookie-Editor or a custom script and immediately assumes the victim’s authenticated session.
Why Traditional MFA Fails Against AitM
This is where enterprise security teams frequently encounter a dangerous blind spot. TOTP-based MFA (Google Authenticator, Microsoft Authenticator in code mode), SMS OTP, and push notification approvals all authenticate the session, not the device or the connection. Because Evilginx2 relays the real authentication exchange, the MFA challenge is legitimate — the user’s authenticator app is communicating with the real identity provider through the proxy. The session token issued post-authentication is what gets hijacked, rendering TOTP and push-based MFA ineffective at stopping AitM attacks.
A 2023 Microsoft Incident Response study of AitM campaigns found that in 78% of cases where victims had MFA enabled, attackers successfully obtained usable session tokens. The protection gap is real, measurable, and currently being exploited at scale.
Phishing-Resistant MFA: The Only Reliable Cryptographic Countermeasure
The security community’s consensus response to AitM frameworks is unambiguous: phishing-resistant MFA is the only authentication mechanism that cryptographically defeats this attack class. NIST SP 800-63B and CISA’s 2023 “Implementing Phishing-Resistant MFA” guidance both classify only two mechanisms as genuinely phishing-resistant: FIDO2/WebAuthn hardware security keys and certificate-based authentication (CBA).
FIDO2/WebAuthn: Cryptographic Channel Binding
FIDO2 defeats AitM through a property called origin binding. During the WebAuthn ceremony, the authenticator signs a challenge that includes the exact relying party origin (the domain name of the site the browser is communicating with). When Evilginx2 proxies the authentication exchange, the origin presented to the user’s FIDO2 key is the attacker’s domain — not Microsoft’s or Google’s. The authenticator’s signature will be cryptographically invalid for the real identity provider’s origin, and the authentication fails. The attacker cannot forge or replay a valid FIDO2 assertion across a different origin, by mathematical construction.
Microsoft’s deployment of FIDO2 across 220,000 employees found a complete elimination of credential phishing incidents for enrolled users. Google reported similar findings following its mandatory security key rollout in 2017, which stopped all account takeovers via phishing for its 85,000-person workforce — results confirmed in a peer-reviewed paper published in USENIX Security.
Certificate-Based Authentication and Passkeys
Enterprise PKI-based CBA similarly binds the authentication assertion to the TLS channel through Mutual TLS (mTLS), making interception impossible without possession of the client certificate’s private key. Passkeys — the consumer-facing implementation of FIDO2 synced through platform authenticators like Apple Keychain or Google Password Manager — offer origin binding at the software level, representing a pragmatic middle ground for organizations that cannot deploy physical hardware keys at scale. While passkeys on synced credentials carry slightly elevated risk compared to hardware-bound FIDO2 keys, they are still categorically more resistant to AitM than any OTP-based scheme.
Network and Proxy-Level Detection Strategies
Even with phishing-resistant MFA deployed, organizations typically face a transition period during which legacy MFA remains active for a subset of users or systems. Layered detection controls can identify AitM infrastructure and disrupt attacks before session tokens are stolen.
Monitoring for Impossible Travel and Anomalous Session Behavior
Once an attacker imports a stolen session cookie, their access originates from an IP address geographically and behaviorally inconsistent with the victim’s normal activity. Modern SIEM and UEBA platforms can be tuned to flag impossible travel events (a session authenticated from London, then accessed from a Bucharest exit node 90 seconds later), unusual user-agent strings, and session reuse from multiple concurrent IP addresses.
Microsoft Entra ID (formerly Azure AD) and Google Workspace both expose sign-in risk signals through their identity protection APIs. Feeding these signals into a SIEM such as Microsoft Sentinel, Splunk, or Elastic SIEM and building correlation rules that trigger step-up authentication or session revocation provides a meaningful compensating control. The Okta Identity Threat Protection product, released in 2024, explicitly addresses post-authentication session hijacking by continuously evaluating session risk rather than trusting a cookie statically.
DNS and Threat Intelligence-Based Domain Blocking
Evilginx2 requires attacker-controlled domains to function. Emerging threat intelligence feeds — including those from Infoblox, Cisco Umbrella, and specialized phishing intelligence providers like Bolster and SlashNext — now include real-time categorization of domains exhibiting AitM infrastructure signatures: specific Let’s Encrypt certificate issuance patterns, Nginx reverse proxy fingerprints, and phishlet-associated URL structures.
DNS filtering at the resolver level (deployed as a Secure Web Gateway or Protective DNS service, as recommended by CISA’s Protective DNS program) can block connections to known Evilginx2 infrastructure before the user’s browser ever makes a TLS connection. In a 2025 independent evaluation by SE Labs, Protective DNS solutions successfully blocked 91% of known AitM phishing domains. The residual 9% underscores why DNS blocking must be a layer, not a strategy.
Email Security Architecture to Prevent Initial Delivery
The most effective intervention against AitM phishing is preventing the initial email delivery that initiates the attack chain. Evilginx2 campaigns depend on convincing victims to click attacker-controlled URLs — eliminating that click opportunity removes the attack’s entry point.
Advanced Email Filtering and URL Rewriting
Modern Secure Email Gateways (SEGs) — including Microsoft Defender for Office 365 Plan 2, Proofpoint Targeted Attack Protection (TAP), and Abnormal Security — apply machine learning-based URL reputation analysis, time-of-click rewriting, and sandboxed URL detonation. These systems can detect when a link redirects through an unexpected chain of domains, exhibits newly registered domain characteristics, or matches known phishlet URL patterns.
Anti-phishing policies should enforce Safe Links (or equivalent) with the “Do not rewrite URLs” option disabled across all user groups. URL rewriting ensures that even if a malicious domain was not known at email delivery time, the link is evaluated at click time — when threat intelligence may have already flagged the domain after it began serving phishing pages. In Microsoft’s telemetry, time-of-click Safe Links scanning blocked approximately 4.3 million phishing URLs per month in the first half of 2025 that passed initial delivery inspection.
DMARC, DKIM, and BIMI Implementation
AitM phishing campaigns routinely spoof legitimate sender domains to increase click rates. Full deployment of DMARC at p=reject policy — combined with DKIM signing and SPF hardening — prevents direct domain spoofing of your organization’s email identity. The Global Cyber Alliance’s DMARC adoption report from early 2026 found that only 38% of Fortune 1000 companies had DMARC at enforcement policy, leaving the majority vulnerable to exact-domain impersonation attacks that frequently precede AitM campaigns.
Zero Trust Architecture as a Structural Defense
Session cookie theft is so damaging precisely because perimeter-based and trust-the-session security models implicitly grant significant access to any entity holding a valid authenticated session. Zero Trust Architecture (ZTA), as defined by NIST SP 800-207, structurally limits the blast radius of a compromised session token by eliminating implicit trust and continuously re-evaluating access decisions.
Continuous Access Evaluation and Conditional Access Policies
Microsoft’s Continuous Access Evaluation (CAE) protocol — now natively integrated into Entra ID — enables near-real-time revocation of session tokens when risk conditions change, rather than waiting for the token’s expiration time. If a session’s IP address changes unexpectedly or risk signals spike post-authentication, CAE-enabled applications (including Exchange Online, SharePoint, and Teams) receive a token revocation event and force re-authentication within seconds rather than hours.
Conditional Access policies should enforce device compliance as an authentication condition — requiring that the accessing device is enrolled in MDM/Intune and meets security baselines. An attacker importing a stolen session cookie on their unmanaged machine will fail device compliance checks, triggering a step-up authentication prompt that the attacker cannot satisfy without the victim’s physical device. When combined with FIDO2, this creates a two-layer barrier: the attacker must compromise both the session cookie and the enrolled device.
Network Segmentation and Least Privilege Access
Micro-segmentation limits what a compromised session can actually reach. An attacker who steals a CFO’s M365 session cookie will gain access to email and OneDrive — but in a mature ZTA deployment, they will not gain lateral access to ERP systems, financial databases, or administrative consoles without satisfying additional authentication and authorization policies specific to those resources. Deploying application-level MFA requirements through an identity-aware proxy (BeyondCorp Enterprise, Zscaler Private Access, Cloudflare Access) ensures that high-value internal applications enforce their own authentication policies independent of the identity provider’s session token.
Incident Response Planning for AitM Session Hijacking
Despite best prevention efforts, the threat intelligence consensus as of late 2026 is that AitM attacks will continue targeting organizations with incomplete phishing-resistant MFA rollouts. A documented, rehearsed incident response playbook specific to session cookie theft dramatically reduces dwell time and breach impact.
Detection, Containment, and Forensic Playbook
A session hijacking IR playbook should include: (1) automated triggers from UEBA rules that immediately revoke all active sessions for a flagged account and reset sign-in credentials; (2) isolation of the compromised account from Exchange transport rules to prevent lateral phishing from within the organization; (3) forensic review of the unified audit log for data exfiltration activities (mass email forwarding rules, SharePoint downloads, OAuth application grants) that typically occur within the first 15 minutes of unauthorized session access; and (4) threat hunting across the environment for other accounts that received the same phishing URL — a single Evilginx2 campaign typically targets dozens to hundreds of accounts simultaneously.
The 2024 CrowdStrike Global Threat Report documented that the average attacker dwell time in cloud identity environments (post-session-cookie theft) before detection was 8.7 days — compared to 1.3 days when organizations had automated session revocation policies in place. The operational gap between organizations with mature IR playbooks and those without is not incremental; it is the difference between a contained incident and a full breach notification event.
Key Takeaways
- TOTP and push-based MFA do not stop AitM attacks. Evilginx2 and similar frameworks proxy real authentication exchanges, capturing post-authentication session tokens regardless of OTP MFA being enabled. FIDO2/WebAuthn and certificate-based authentication are the only cryptographically verified phishing-resistant alternatives.
- Origin binding is the cryptographic mechanism that defeats reverse proxy phishing. FIDO2 keys sign challenges tied to the legitimate relying party’s origin — an attacker-controlled proxy domain will produce an invalid signature, breaking the authentication before any session token is issued.
- DNS filtering and email security are preventive layers, not standalone solutions. Protective DNS blocks known AitM infrastructure, and advanced SEGs with time-of-click URL scanning disrupt delivery — but both require continuous threat intelligence updates and should be combined with identity controls.
- Zero Trust Conditional Access policies dramatically limit session cookie blast radius. Enforcing device compliance, requiring CAE-capable applications, and applying application-level authentication policies mean a stolen cookie without an enrolled device provides significantly constrained access.
- Incident response playbooks for session hijacking must be scenario-specific and automated. Organizations with automated session revocation and dedicated AitM IR playbooks experience 6× shorter dwell times than those relying on manual detection — a difference that directly determines breach scope.
Conclusion: Closing the Authentication Trust Gap
The emergence and widespread adoption of Evilginx2 and its AitM framework peers marks a decisive inflection point in the phishing threat landscape. The foundational assumption that MFA-protected accounts are safe from credential-based compromise has been empirically invalidated. The path forward requires not a single control upgrade, but a layered architectural response: mandatory FIDO2 or passkey authentication for all users with particular urgency for privileged accounts, Conditional Access policies that treat device compliance as a non-negotiable condition, Protective DNS and advanced email filtering to reduce the attack surface at delivery, and UEBA-powered detection that monitors post-authentication session behavior continuously.
Actionable next step for security teams and CISOs: Conduct an immediate audit of your identity provider’s MFA method enrollment data. Identify every user — especially those with access to financial systems,
💡 Enjoyed this article?
Subscribe for more expert insights delivered to your inbox.
Follow us or subscribe below xe2x80x94 free, no spam.





