Deep-dive to Entra ID Token Theft Protection
Nestori Syynimaa (Principal Identity Security Researcher · Microsoft)
BruCON 0x11 · Day 2 · Gouden Carolus
Overview
In this insightful talk at BruCON, Nestori Syynimaa, a Principal Identity Security Researcher at Microsoft, delivered a deep dive into the evolving landscape of Entra ID (formerly Azure AD) token theft and the protective measures Microsoft has implemented. Syynimaa emphasized a critical shift in the attacker's playbook: "Hackers don't break in, they log in." This pithy statement underscores the growing prevalence of attacks that leverage stolen authentication tokens rather than brute-forcing traditional credentials, making token theft a paramount concern for modern cloud environments.

Key moments
- 0:00 Introduction to Entra ID token theft protection
- 2:30 Understanding cloud authentication and token importance
- 5:50 Overview of token-based authentication attack paths
- 10:00 Different token types vulnerable to theft from endpoints
- 19:40 Security best practice: Conditional Access Policies (CAPs)
- 24:50 Security best practice: Token Protection encryption
- 28:00 Continuous Access Evaluation (CAE) and its 28-hour token exploit
- 40:00 Q&A: CAE exploit – is it a bug or a feature?
Deep-dive to Entra ID Token Theft Protection
Speakers: Nestori Syynimaa, Principal Identity Security Researcher, Microsoft
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=YlPkCXQaJtI
Overview
In this insightful talk at BruCON, Nestori Syynimaa, a Principal Identity Security Researcher at Microsoft, delivered a deep dive into the evolving landscape of Entra ID (formerly Azure AD) token theft and the protective measures Microsoft has implemented. Syynimaa emphasized a critical shift in the attacker's playbook: "Hackers don't break in, they log in." This pithy statement underscores the growing prevalence of attacks that leverage stolen authentication tokens rather than brute-forcing traditional credentials, making token theft a paramount concern for modern cloud environments.
The presentation systematically explored various methodologies employed by threat actors to steal and misuse Entra ID tokens, ranging from network-based adversary-in-the-middle (AiTM) attacks to sophisticated endpoint compromises. Syynimaa meticulously broke down the different types of tokens at play – Primary Refresh Tokens (PRT), Family Refresh Tokens (FRT), and Access Tokens – detailing their purpose, lifespan, and the prerequisites for their theft. Crucially, the talk then transitioned into Microsoft's multi-layered defense strategies, including Conditional Access Policies (CAPs), Token Protection (Microsoft's term for token binding), and Continuous Access Evaluation (CAE), analyzing their efficacy and inherent limitations against these diverse attack vectors.
This talk is particularly significant for security professionals, identity architects, and cloud administrators who manage Microsoft 365 and Azure environments. It not only demystifies complex token-based authentication flows but also provides actionable intelligence on how to leverage Entra ID's security features to enhance an organization's defensive posture. By highlighting both the strengths and weaknesses of current protections, Syynimaa empowers defenders to make informed decisions, prioritize investments, and understand the remaining gaps that require additional endpoint security controls.
Background
▶ Watch: Introduction to Entra ID token theft protection (0:00)
The foundation of modern cloud authentication, especially within the Microsoft ecosystem, relies heavily on token-based authentication. In a typical scenario, a user (e.g., accessing Outlook) interacts with an identity provider like Entra ID to authenticate. Upon successful authentication, Entra ID issues an access token to the user. This token, a digitally signed assertion, contains crucial information about the user's identity, permissions, and session validity. The user then presents this token to a service provider (e.g., Exchange Online), which, trusting Entra ID's signature, grants access to the requested resource. The quote, "hackers don't break in, they log in," encapsulates the core problem: if an attacker obtains a legitimate token, they bypass traditional authentication mechanisms entirely.
While password attacks still constitute the vast majority (99%) of all attacks, as highlighted by Microsoft's Digital Defense Report, the remaining sub-1% includes more advanced techniques like adversary-in-the-middle (AiTM) attacks, token theft, and infrastructure compromise. These less frequent but highly impactful attacks are the focus of Syynimaa's deep dive. The speaker categorized token-based authentication attacks into three main areas: stealing secrets (e.g., token signing keys, often a nation-state capability), forging tokens offline (a rare and highly sophisticated attack, as demonstrated by the "Dian" breach), and the primary subject of the talk, token theft.
Token theft itself can occur through various means. Network-based attacks, predominantly AiTM, involve tricking a user into authenticating through an attacker-controlled proxy, allowing the interception of credentials and tokens during transit. Syynimaa attempted to demonstrate this with a phishing link pointing to a lookalike domain (login.micros0nline.com), which, had the demo worked, would have revealed the victim's username, password, and session cookies. The second major vector is endpoint compromise, where an attacker gains access to the user's device and directly extracts tokens or keys stored locally. The nature of the stolen artifacts and the level of access required (user vs. local administrator) vary significantly, leading to different attack capabilities. Understanding these underlying mechanisms is crucial for appreciating the nuanced protections offered by Entra ID.
Key Findings
▶ Watch: Overview of token-based authentication attack paths (5:50)
The core of the talk revolved around identifying what can be stolen and how Microsoft attempts to protect it. Syynimaa detailed several critical token types and associated artifacts:
- Primary Refresh Token (PRT) and Session Key: This powerful combination proves both the identity of the user and the device. Stealing these requires local administrator permissions on the endpoint and the absence of a Trusted Platform Module (TPM), which typically protects these keys. If obtained, an attacker can effectively impersonate the user from that device, even claiming it to be a compliant device.
- Family Refresh Tokens (FRT): These are more versatile refresh tokens compared to standard refresh tokens, which are usually tied to a specific resource and client. FRTs allow an attacker to obtain access tokens for multiple first-party Microsoft applications within a defined "family" of applications. Theft of FRTs typically requires only user-level permissions on a compromised endpoint.
- Access Tokens: These are the most common type of token, granting access to a specific resource (e.g., Exchange Online) via a specific client (e.g., Outlook) for a limited duration, typically one hour, but up to 28 hours with Continuous Access Evaluation (CAE). Like FRTs, these can often be stolen with user-level permissions from a compromised endpoint.
Based on these token types and the attack vectors, Syynimaa outlined the primary attack paths:
- No Endpoint Access: Attackers use Adversary-in-the-Middle (AiTM) techniques to intercept tokens during the authentication flow.
- Endpoint Access (User Permissions): Attackers directly steal tokens (FRTs, Access Tokens) from the user's browser or application cache.
- Endpoint Access (Admin Permissions, No TPM): Attackers steal the highly sensitive PRT and session key, enabling them to acquire new tokens and impersonate the user and device.
To counter these threats, Microsoft offers three primary security best practices within Entra ID:
- Conditional Access Policies (CAPs): These policies enforce access controls based on various conditions (user, device, location, application) before authentication is granted.
- Token Protection: This mechanism (Microsoft's implementation of token binding) aims to prevent token replay attacks by encrypting tokens to a specific device.
- Continuous Access Evaluation (CAE): This feature allows for the near real-time revocation of access tokens in response to critical events, significantly reducing the lifespan of a stolen token.
A critical finding, repeatedly emphasized, is that while these technologies offer robust protection against certain token theft scenarios (e.g., AiTM, preventing token replay), **none of them provide direct mitigation against tokens stolen from an already compromised endpoint *at rest***. If an attacker has compromised the user's machine and can access the decrypted tokens, these Entra ID features alone will not prevent their misuse. This highlights the enduring importance of strong endpoint security.
Technical Deep Dive
▶ Watch: Security best practice: Conditional Access Policies (CAPs) (19:40)
Nestori Syynimaa meticulously unpacked the technical intricacies of Microsoft's three core token theft protection mechanisms, detailing their operational flow and specific defensive capabilities.
Conditional Access Policies (CAPs)
Conditional Access Policies are the bedrock of modern Entra ID security. They function as a policy enforcement engine that evaluates authentication requests before an access token is issued. Syynimaa illustrated this with a diagram: a user (Nestori) attempting to access Exchange Online via Outlook sends a request to Entra ID, detailing their identity, device, and client. Entra ID then evaluates a set of predefined rules. These rules can be highly granular, requiring users to come from a trusted network segment, use a compliant device (e.g., managed by Intune), or be on a specific operating system. Only if all conditions are met will Entra ID issue the access token.
The key takeaway for CAPs is that they protect before authentication. Once a token is issued, CAPs typically don't re-evaluate the session's context unless integrated with CAE. Therefore, CAPs can effectively protect against Adversary-in-the-Middle (AiTM) attacks by preventing the issuance of tokens if the attacker's device or network doesn't meet the policy requirements. They can also defend against the misuse of stolen PRT/session keys if policies are configured to, for instance, demand access from a trusted location, effectively blocking an attacker trying to use the stolen keys from an unknown network segment. However, the effectiveness is entirely dependent on the rigor of policy configuration; "it depends how you configure your rules or policies."
Token Protection
Referred to internally at Microsoft as Token Protection (though widely known as token binding in the industry), this feature is designed to prevent token replay attacks by binding a token to the specific device it was issued for. It requires specific client and resource support, such as OneDrive and Teams, and typically relies on a supported device (e.g., Windows Hello for Business).
The technical mechanism involves a more sophisticated token request process. When a user requests an access token, the request itself is a JSON Web Signature (JWS) payload, signed with the PRT and session key. This signature proves the identity of both the device and the user. Crucially, Entra ID then encrypts the issued access and refresh tokens using JSON Web Encryption (JWE). This JWE payload is encrypted with keys that only the device that initiated the request can decrypt.
Syynimaa explained the implications: even if an attacker intercepts these encrypted tokens during transit (e.g., via an AiTM attack), they are useless because the attacker's device lacks the necessary keys to decrypt them. This means Token Protection effectively prevents AiTM attacks by rendering stolen tokens unusable outside the intended device. However, a significant limitation was highlighted: Token Protection protects tokens in transit but not at rest. If an attacker compromises the user's endpoint and can access the already decrypted tokens (e.g., from browser memory or storage), this protection mechanism offers no defense.
Continuous Access Evaluation (CAE)
Continuous Access Evaluation (CAE) is a premium feature (requiring Entra ID Premium P1) designed to provide near real-time token revocation, significantly reducing the window of opportunity for token replay. It's supported by specific clients and resources and is enabled by default but can be disabled via Conditional Access Policies.
The process for CAE-enabled clients involves the client indicating its support for CAE during the token request by including a specific claim, such as XMS CC=capability1. In response, Entra ID issues an access token and refresh token that can be valid for an extended period, typically between 22 and 28 hours. The critical difference is that Entra ID can now send event notifications to the resource provider (e.g., Exchange Online). If a significant event occurs – such as a user's password being reset, a user being disabled, or a device becoming non-compliant – Entra ID notifies the resource provider. The resource provider then immediately invalidates the active access token, forcing the user (or attacker) to re-authenticate.
CAE may prevent token replay attacks by drastically shortening the effective lifespan of a stolen token, especially if the underlying user or device state changes. However, Syynimaa revealed a crucial exploitability aspect: threat actors can request CAE tokens (with their extended 28-hour validity) even if the organization does not have an Entra ID Premium P1 license enabled for CAE. By simply adding the capability1 claim to their token request, attackers can obtain a longer-lived token if they compromise an endpoint, effectively extending their session from the standard one hour to up to 28 hours. This makes detection crucial, and Syynimaa provided a KQL query to identify logins using CAE tokens in environments where P1 is not expected or enabled, signaling potential abuse.
In summary, each protection offers distinct advantages against specific attack vectors, but none provide a silver bullet, particularly against tokens stolen from a fully compromised endpoint where they are at rest and already decrypted.
Demo / Proof of Concept
▶ Watch: Security best practice: Token Protection encryption (24:50)
Throughout the presentation, Nestori Syynimaa planned to demonstrate various aspects of token theft and protection, unfortunately hampered by persistent network connectivity issues. Despite the technical difficulties, the descriptions of the intended demonstrations provide a clear understanding of the concepts:
- Adversary-in-the-Middle (AiTM) Attack: The initial demo aimed to show a phishing scenario where a victim navigates to a malicious, lookalike URL (e.g.,
login.micros0nline.com). The attacker's proxy (EvilGinx or similar) would intercept the user's credentials and session cookies upon successful login. This would have visually reinforced how easily tokens and passwords can be stolen in transit without the user's immediate awareness.
- Stealing Tokens from Endpoint (User Permissions): Syynimaa described how a non-privileged attacker, with physical or remote access to an unlocked laptop, could open a browser's developer tools (F12) and directly extract authentication tokens and session cookies from the browser's local storage or network requests. This simple demonstration would have underscored that even without advanced hacking skills, tokens can be readily exfiltrated from a compromised or unattended endpoint.
- Stealing PRT and Session Key (Admin Permissions, No TPM): This was a more advanced demo involving a compromised endpoint without a TPM. Syynimaa intended to use a PowerShell module (likely a component of his renowned
AADInternalstoolkit) to extract the user's Primary Refresh Token (PRT) and the associated session key. The process would have involved providing the user's credentials or PIN to the script, which would then extract these powerful artifacts. With the PRT and session key, the attacker could then forge device and user identity, even claiming the compromised device was "compliant," showcasing the severe impact of local administrative compromise.
- Conditional Access Policy in Action: A demo was planned to illustrate how a Conditional Access Policy (CAP) requiring a "compliant device" would block an attacker. Syynimaa manually enabled a CAP for a user named Diego. The intent was to show that even with correct credentials, the attacker's non-compliant machine (the "evil sync" machine) would be denied access, showcasing CAPs' ability to enforce device posture.
- Token Protection against AiTM: Although also affected by network issues, this demo would have demonstrated the efficacy of Token Protection. The idea was to show that even if an AiTM attack intercepted encrypted tokens, they would be unusable to the attacker, as they would lack the device-specific decryption keys (JWE).
- CAE Exploitation: The final demo intended to highlight the potential for Continuous Access Evaluation (CAE) to be exploited. Syynimaa described how an attacker could manually include the
XMS CC=capability1claim in their token request to obtain a longer-lived (up to 28 hours) CAE token, even if the target organization did not possess an Entra ID Premium P1 license. This would have visually demonstrated how attackers could extend their access window once an endpoint is compromised.
While the live demonstrations faced technical hurdles, Syynimaa's clear explanations and the detailed attack paths provided sufficient context for the audience to grasp the technical concepts and the practical implications of both the attacks and the protective measures.
Defensive Implications
▶ Watch: Q&A: CAE exploit – is it a bug or a feature? (40:00)
Nestori Syynimaa's talk provides critical insights for defenders navigating the complexities of Entra ID security. The core message is that effective defense against token theft requires a multi-faceted approach, leveraging specific Entra ID features to counter different attack vectors, while also acknowledging inherent limitations.
- Mitigating Adversary-in-the-Middle (AiTM) and Phishing:
- Conditional Access Policies (CAPs): These are frontline defenses. By configuring CAPs to enforce requirements like trusted network locations, compliant devices, or Multi-Factor Authentication (MFA), organizations can prevent tokens from being issued to attackers operating from untrusted environments. As Syynimaa noted, "it's not the user's fault if they fall to these kind of attacks, it's us [defenders]."
- Token Protection: This feature, by binding tokens to specific devices via JSON Web Encryption (JWE), directly prevents the replay of tokens stolen in transit. For organizations using supported clients and devices (e.g., Windows Hello for Business), Token Protection is crucial for elevating the difficulty of AiTM attacks.
- Preventing Acquisition of Tokens from Stolen Secrets (PRT/Session Key):
- Conditional Access Policies (CAPs): Even if an attacker manages to steal a Primary Refresh Token (PRT) and session key, CAPs can still provide a layer of defense. For example, a CAP requiring access from a trusted network segment or a compliant device can block the attacker from using the stolen keys to acquire new tokens from an unmanaged or external machine.
- Combating Token Replay Attacks (Post-Theft):
- Continuous Access Evaluation (CAE): While not a perfect solution, CAE significantly reduces the window of opportunity for attackers. By enabling CAE, organizations ensure that if a critical event occurs (e.g., password reset, user disablement), the stolen access token is invalidated much faster than the standard one-hour validity period, limiting its utility to an attacker. Defenders should prioritize enabling CAE for supported clients and resources.
- Addressing Endpoint Compromise (Tokens at Rest):
- This is the acknowledged gap. Syynimaa explicitly stated that none of the discussed Entra ID technologies (CAPs, Token Protection, CAE) protect against tokens stolen from an already compromised endpoint where they are at rest and decrypted. If an attacker gains full control of a user's machine, they can access these tokens.
- External Controls: The talk briefly touched upon crucial external controls: no Bring Your Own Device (BYOD) policies and removing local administrator permissions from users. These foundational endpoint security practices are essential to prevent the initial compromise that leads to token theft at rest. Strong endpoint detection and response (EDR) solutions are also vital to detect and mitigate such compromises.
- Managing CAE Exploitation:
- Defenders must be aware that attackers can request longer-lived (28-hour) CAE tokens even if the organization doesn't have an Entra ID Premium P1 license enabled for CAE.
- Detection: Syynimaa provided a KQL query as a starting point for detection:
AADSignInLogs | where Properties.capabilities has "capability1". Organizations should monitor for CAE token usage, especially if P1 is not active, as this could indicate an attacker exploiting the longer token validity. - Configuration: While CAE is beneficial, organizations with specific risk profiles might consider disabling it via CAPs if the risk of longer-lived tokens (even if revocable) outweighs the benefits, though this is generally not recommended.
- Future Considerations and Licensing:
- Syynimaa confirmed that Microsoft plans to expand CAE support to more clients and resources.
- Regarding sender-constraining tokens (e.g., using MTLS), he acknowledged it as a potential future direction for token binding.
- The question of making premium security features (like Token Protection, recently moved from P2 to P1) available to all users was raised, highlighting the ongoing tension between security democratization and licensing models. While no direct answer was given, it emphasizes the need for organizations to understand the licensing requirements for these critical protections.
In essence, a robust Entra ID security posture requires not only implementing Microsoft's recommended features but also understanding their specific scope and complementing them with strong endpoint and identity governance practices.
Key Takeaways
- Hackers Don't Break In, They Log In: Token theft is a primary attack vector, allowing attackers to bypass traditional authentication by using legitimate, stolen credentials or session tokens.
- Multi-Layered Token Theft Vectors: Attackers utilize adversary-in-the-middle (AiTM) techniques for tokens in transit, or endpoint compromise to steal various token types (Access Tokens, FRTs, PRT+Session Key) at rest.
- Conditional Access Policies are Foundational: CAPs are crucial for enforcing authentication rules before tokens are issued, protecting against AiTM and restricting access based on device compliance or trusted locations.
- Token Protection Secures Tokens in Transit: Microsoft's Token Protection (using JWE) encrypts tokens to specific devices, effectively preventing replay attacks for tokens stolen during network interception, but it does not protect tokens at rest.
- Continuous Access Evaluation (CAE) Enhances Revocation: CAE allows for faster token invalidation upon critical events (e.g., password reset), reducing the window of opportunity for stolen tokens; however, attackers can exploit it to request longer-lived (28-hour) tokens even without a P1 license, requiring careful monitoring.
- Endpoint Security Remains Paramount: None of the discussed Entra ID features protect against tokens stolen from an already compromised endpoint at rest. Robust endpoint security, device management, and limiting user administrative privileges are essential to prevent the initial compromise that enables such theft.
About the Speaker(s)
Nestori Syynimaa is a distinguished expert in identity security, currently serving as a Principal Identity Security Researcher at Microsoft Threat Intelligence Center (Mystic). His role at Microsoft involves proactively identifying vulnerabilities in Microsoft cloud services before malicious actors can exploit them, a contribution he jokingly states, "You're welcome." Syynimaa is widely recognized for his deep knowledge of Azure AD (now Entra ID) and Microsoft 365, underscored by his creation of the popular toolkit AADInternals. With over a decade of experience in Microsoft cloud services, he has held credentials such as a Microsoft Certified Trainer since 2013 and a Microsoft Most Valuable Security Researcher since 2021. Nestori is also a frequent and engaging speaker at security conferences globally, sharing his research and insights with the broader cybersecurity community.
Reviews
Dr. Zero (Offensive Security Researcher) — STRONG ACCEPT
Nestori Syynimaa literally wrote AADInternals, so when he explains Entra ID token structures, you shut up and take notes. The live demos crashed and burned on the conference Wi-Fi, but his breakdown of where Microsoft's token protections actually stop is mandatory viewing. It strips away the vendor marketing and shows defenders exactly which attack paths are still wide open.
Heather Calloway (CISO) — SOLID
A remarkably candid breakdown from a Microsoft researcher on the architectural limits of Entra ID token protections. It clarifies exactly where cloud identity controls stop working and why endpoint compromise still renders conditional access investments moot. Required viewing for your IAM architecture and detection engineering leads.