March 18, 2025

Demystifying Okta AiTM

Fenix Qiao and Shuyang Wang

As SaaS applications gain popularity and traditional network perimeter fade away, attackers are shifting their focus towards compromising identities. Recently, CrowdStrike published a blog post outlining initial access attack vectors targeting Okta, in which Evilginx was highlighted as an AiTM technique used to bypass MFA and gain unauthorized access. Their analysis, detailed in this article, indicated that effectively phishing Okta users with Evilginx requires a wildcard cross-origin resource sharing (CORS) policy and disabling device matching. However, this claim is misleading. This blog post walks through the concept of CORS and illustrates how Evilginx, when properly configured, is capable of launching AiTM attacks regardless of Okta CORS settings, nor is it affected by the "Enforce device matching for creating sessions" setting.

Evilginx Phishing Mechanism

Evilginx functions as a reverse proxy, acting as a middleman between the victim and the target service. It allows attackers to intercept and manipulate traffic, primarily to steal session cookies, which enables them to bypass MFA and take over accounts.

The attack follows these key steps:

  • Setup & Configuration: The attacker sets up Evilginx and configures a phishlet, a YAML file that defines how the phishing site proxies traffic to target service like Okta.
  • Lure Distribution: Based on the phishlet, a lure (phishing link) is generated and sent to the victim through phishing emails, SMS, or other social engineering tactics.
  • Cookie Stealing: The victim visits the phishing site, enters their credentials, and completes MFA (such as approving a push notification or entering a one-time code). Evilginx forwards the victim's authentication traffic to the target server while capturing sensitive information such as the username, password, and importantly session cookies.
  • Account Takeover: The attacker extracts the stolen session cookie from Evilginx, imports it into their browser, and gains access to the victim’s account. Using SSO, they can further access other connected services.

Testing Evilginx Against Okta

Evilginx is open-source but does not include ready-to-use phishlets by default. While some community-contributed phishlets are available on GitHub, they often come with issues.

We tried to test an out-of-box phishlet from Github, hosted on our phishing testing domain https://dev-49281249.0kta-auth.com, targeting the legit Okta login page https://dev-49281249.okta.com. Proxyed login can not be fulfilled with CORS errors shown in the browser developer console.

So, what is CORS?

Cross-Origin Resource Sharing (CORS)

To understand CORS, we first need to look at the Same-Origin Policy (SOP). Two URLs are considered to have the same origin if they share the same protocol, host, and port (if specified). If any of these differ, the URLs are treated as cross-origin.

By default, browsers enforce the Same-Origin Policy (SOP) as a security measure that restricts cross-origin reads while generally allowing cross-origin writes and cross-origin embedding. This means:

  1. A webpage can freely send data (write) to a different origin, the server decides whether to process it, such as through CSRF token validation.
    • Examples: Links (<a>), redirects, and form submissions (<form>).
  2. A webpage can embed resources from a different origin.
    • Examples: Images (<img>), scripts (<script>), stylesheets (<link>), and iframes (<iframe>).
  3. A webpage cannot read data from a different origin unless explicitly allowed by the server.
    • This prevents a malicious site from stealing user data from another site.

A threat actor-controlled page on https://attacker.com therefore can not read data from https://yourbank.com .  While enforcing SOP is critical to stop cross-origin web attacks, there are legitimate use cases that require relaxing the policy, for example:

  • Web apps fetch APIs from a different backend (https://frontend.comhttps://api.backend.com)
  • Cloud services interact across different domains

To allow controlled cross-origin access, browsers enforce CORS, which requires server-side approval for cross-origin reads.

When a web page tries to fetch data from a different origin via fetch() or XMLHttpRequest (XHR), the browser first checks if the server allows it.

To explicitly allow cross-origin access, the server must send appropriate CORS headers in its HTTP response.

CORS in Okta

According to Okta's documentation, all cross-origin web requests and redirects from Okta to your organization's websites must be explicitly allowed. Therefore, by default, all cross-origin requests are denied.

In the out-of-box Evilginx phishlet setup, we found that only a subset of requests are configured to be proxied through Evilginx itself, with the rest going to the legit Okta login page directly from the browser. Since the phishing origin https://dev-49281249.0kta-auth.com isn’t added to the CORS allow list in the Okta setting, CORS is blocked by the browser.

To troubleshoot, we can proxy traffic to Burp Suite and identify pages that are still referencing the original domain.

In the login request flow, a POST request is sent to /idp/idx/introspect, which returns a JSON response with a MIME type of application/ion+json. This response contains a URL for subsequent requests.

However, this URL still uses the original legitimate domain, leading to a bypass of the phishing proxy.

Fixing Evilginx URL Replacement

So, how does Evilginx automatically replace content in the response?

In Evilginx, auto_filter is enabled by default in the proxy_hosts configuration of the phishlet, causing Evilginx to automatically generate sub_filters rules. These rules dynamically modify the proxied website's content by replacing legitimate URLs with phishing proxy URLs, ensuring that the victim remains within the phishing session and is not redirected to the legitimate website before completing authentication.

So, the core issue is that Evilginx does not handle this specific MIME type.

To address this, we can create a custom sub_filters rule to replace the legitimate URL with the phishing proxy URL:

However, a new problem arises:

Some JSON responses also contain parameters for subsequent requests, such as redirect_uri. Evilginx does not automatically extract and replace parameters for GET or POST requests. As a result, the substitution may be overly aggressive, potentially corrupting the request flow.

To resolve this issue, we need to explicitly extract and handle these parameters. This can be done using:

  • force_get: Forces Evilginx to extract parameters from a URL and rewrite them correctly. (Not supported by default and requires patching Evilginx.)
  • force_post: Ensures Evilginx correctly processes modified POST request parameters.

Once these minor issues are fixed, Evilginx can execute an AiTM attack and capture session cookies. Here, we assume the user is using MFA with a code or push notification.

In short, Okta’s default deny-all CORS policy is a standard security practice to block unauthorized cross-origin access. However, this does not effectively stop Evilginx-based attacks. It only requires attackers to make minor adjustments to the phishlet configuration, adding some complexity but not preventing the attack.

Okta Session Device Binding

CrowdStrike's blog also mentions that Okta also mitigates Evilginx attacks by enforcing "Device Binding for Creating Sessions.” According to Okta's documentation, this feature ensures that authentication redirects remain within the same browser where they were initiated by comparing the device identifier in requests. If the values do not match, access to any application is denied, and no new IDP session is permitted.

This option is enabled by default and has no impact on our testing, as Evilginx hijacks the entire authentication process.

To test if Okta sessions are device-bound and whether a stolen session cookie can be used in another browser, we set up a controlled environment with a different device (operation system), user agent, and IP.

  • Attacker Simulation Environment (Windows VM)
    • Set up a Windows virtual machine.
    • Install Chrome as the browser.
    • Install the following extensions:
      • StorageAce (for importing cookies)
      • User-Agent Switcher (to alter the user agent)
      • Proxy SwitchyOmega (configured to use the Tor network, ensuring a different IP address)

This setup allows us to simulate an attacker attempting to reuse stolen session tokens in a completely different environment.

When testing the stolen session cookie in this environment setup, it works for regular users but fails for admins. Even if an attacker steals the session cookie, it remains unusable for admins under Okta’s default settings, resulting in a 403 error.

Moreover, stolen session cookies become immediately invalid.

We also switched from Tor to a mobile hotspot to keep the location shift minimal, but the outcome was still the same.

After configuring the VM to use the Evilginx server's proxy, the VM and Evilginx remain in the same network environment while still being separate devices with distinct user agents. Under these conditions, the stolen admin session cookie successfully worked, contradicting Okta’s claim as device-bound.

These together suggest that Okta primarily relies on IP address verification to protect admin sessions. According to this article (Protecting Administrative Sessions in Okta), Okta has several measures to protect admin sessions, such as ASN Session Binding and IP Session Binding. This aligns with our test results.

In AiTM-based attacks like Evilginx, IP/ASN bound session defense doesn’t raise the bar much because the entire Okta session is entirely controlled by attackers, including the IP and ASN. In contrast, in post-authentication attacks, like token theft from victims’ devices, threat actors would have to mimic victims’ network environment more closely. That said, it is still possible through residential proxy. Our previous blog has covered this topic.

Effective Mitigation Strategies

These Okta settings mentioned in CrowdStrike's article can't effectively mitigate Evilginx attacks. Organizations should adopt stronger security measures to protect against phishing threats.

  • Prevent domain impersonation attacks: Train users to recognize phishing domains (e.g., 0kta-auth.com) and enforce browser and email security controls to automatically block suspicious links.
  • Enforce phishing-resistant MFA: As demonstrated at the end of our demo video, methods like Okta FastPass bind authentication to physical devices, enabling identification of whether the request originates from a phishing site, effectively mitigating AiTM attacks.
  • Monitor for anomalous login activity: Implement Identity Threat Detection & Response (ITDR) to detect suspicious login patterns, such as unusual IP addresses, and geographical location changes.

Get Started

Start in minutes and secure your critical SaaS applications with continuous monitoring and data-driven insights.

Get a Demo