I Stole Your Azure Tenant with a Login Link
Eric Boyd
Overview
In his CypherCon talk, "I Stole Your Azure Tenant with a Login Link," security expert Eric Boyd unveils a potent attack vector against Microsoft Entra ID (formerly Azure Active Directory) environments. The presentation meticulously demonstrates how a seemingly innocuous user action – clicking "accept" on an OAuth consent dialog – can provide an attacker with persistent, delegated access to an Azure tenant, ultimately leading to Global Administrator privileges. Boyd emphasizes that this exploit requires no zero-days, no sophisticated malware, no credential theft, and no MFA bypass, relying instead on common misconfigurations and a lack of awareness regarding the implications of OAuth grants.

Key moments
- 2:00 One Click, That's All: The Attack Premise
- 7:00 Understanding the Full Attack Chain
- 20:50 Demo: Injecting Attacker Secret for Persistence
- 22:50 Demo: Escalating to Global Administrator
- 27:50 How to Remediate an Active Compromise
- 29:00 Auditing for Entra ID Vulnerabilities
- 34:50 Five Key Defense Strategies
- 40:30 Q&A: Obtaining the Initial Refresh Token
I Stole Your Azure Tenant with a Login Link
Speakers: Eric Boyd, 15x Microsoft Azure MVP, 2x Microsoft Foundry/AI MVP, Regional Director, Founder of responsiveX
Conference: CypherCon
YouTube: https://www.youtube.com/watch?v=Kyer_emR_Nk
Overview
In his CypherCon talk, "I Stole Your Azure Tenant with a Login Link," security expert Eric Boyd unveils a potent attack vector against Microsoft Entra ID (formerly Azure Active Directory) environments. The presentation meticulously demonstrates how a seemingly innocuous user action – clicking "accept" on an OAuth consent dialog – can provide an attacker with persistent, delegated access to an Azure tenant, ultimately leading to Global Administrator privileges. Boyd emphasizes that this exploit requires no zero-days, no sophisticated malware, no credential theft, and no MFA bypass, relying instead on common misconfigurations and a lack of awareness regarding the implications of OAuth grants.
Boyd, a long-time Azure veteran and independent consultant, leveraged his deep understanding of Azure's identity platform to showcase a practical, step-by-step attack chain. The core vulnerability lies in the combination of delegated OAuth permissions, app registration ownership, and specific API permissions that, when chained together, allow an attacker to establish a backdoor and escalate privileges. This talk serves as a critical wake-up call for organizations relying on Microsoft's cloud identity services, highlighting the need for rigorous security practices beyond traditional user-centric defenses.
Background
▶ Watch: One Click, That's All: The Attack Premise (2:00)
The foundation of this attack lies in understanding three core concepts within Microsoft Entra ID: App Registrations, Service Principals, and OAuth Consent. An App Registration is an identity object in an Entra ID tenant that defines an application, its permissions, who can sign in, and its credentials. Every App Registration then gets a corresponding Service Principal, which is the runtime identity that authenticates and calls APIs. Unlike human users, Service Principals can operate without multifactor authentication (MFA) and may bypass certain conditional access policies by default, making them attractive targets for attackers seeking persistent, hidden access.
OAuth Consent dialogues are a ubiquitous part of modern web applications, prompting users to grant an application permission to access certain resources on their behalf. While essential for functionality, these consents often grant more permissions than necessary, including a persistent delegated refresh token. This token allows the application to obtain new access tokens without further user interaction, even surviving password resets or MFA re-enrollment. The problem arises when users, accustomed to clicking "accept" on these prompts, unknowingly grant permissions to a malicious or compromised application that can then leverage these initial grants to enumerate existing applications, inject attacker-controlled secrets, and ultimately escalate privileges. This scenario is exacerbated by a lack of observability and monitoring for non-human identities (Service Principals), a growing blind spot in many organizational security postures.
Key Findings
▶ Watch: Demo: Injecting Attacker Secret for Persistence (20:50)
The central discovery of Eric Boyd's talk is the demonstration of a complete attack chain that transforms a single user's OAuth consent into full Global Administrator control over an Azure tenant. The key findings can be summarized as follows:
- Persistent Delegated Access via OAuth Consent: A single click on a legitimate-looking OAuth consent dialog grants an attacker's application a persistent delegated refresh token. This token provides ongoing access to the user's delegated permissions, even if the user changes their password or MFA settings.
- App Enumeration and Credential Injection: With the refresh token, an attacker can impersonate the user to enumerate all App Registrations owned by that user. Crucially, the attacker can then inject their own client secret (a form of credential) into one of these owned app registrations.
- Headless Service Principal Authentication: Once an attacker-controlled client secret is injected, the attacker can authenticate directly as the Service Principal associated with that app registration. This provides a persistent, headless backdoor that is divorced from the original compromised user account, making it resilient to user account remediation efforts.
- Privilege Escalation to Global Administrator: If the compromised app registration's Service Principal possesses specific high-privilege permissions, such as
RoleManagement.ReadWrite.Directory,AppRoleAssignment.ReadWrite.All, orDirectory.ReadWrite.All, the attacker can use these permissions to programmatically assign the Global Administrator role to any attacker-controlled user within the tenant. - No Zero-Days or Exotic Tooling: The entire attack relies on legitimate HTTP requests to the Microsoft Graph API, orchestrated with simple PowerShell scripts and a Python web server for token capture. This underscores that the vulnerability stems from common misconfigurations and lack of monitoring rather than complex exploits.
- Multiple Entry Points: While OAuth consent is a primary focus, Boyd also highlights other initial access vectors, including leaked Service Principal credentials (e.g., found in GitHub repos), enumeration by B2B guest accounts, and phishing techniques using tools like Evilginx to capture refresh tokens. Regardless of the entry point, the subsequent escalation path remains largely the same.
Technical Deep Dive
▶ Watch: How to Remediate an Active Compromise (27:50)
The attack chain demonstrated by Eric Boyd is a sophisticated yet straightforward progression of actions, primarily leveraging the Microsoft Graph API. The process begins with obtaining an initial foothold and systematically escalates privileges to achieve Global Administrator access.
The initial access phase starts with the adversary enticing a user to click an OAuth consent dialog. Boyd's demo used a Python-based web server to act as the callback endpoint for the OAuth flow. When the user (e.g., "Demo Owner") successfully authenticates with Entra ID and grants consent to the attacker's malicious app, Entra ID redirects back to the Python server, delivering a persistent delegated refresh token. This token is the golden key, allowing the attacker to continuously acquire new access tokens and impersonate the "Demo Owner" without further interaction.
Once the refresh token is acquired, the attacker's PowerShell script initiates the core attack sequence:
- Validate Access and Enumerate Apps: The PowerShell script first exchanges the refresh token for an access token. Using this access token, it queries the Microsoft Graph API (
/meendpoint) to confirm it is operating as the "Demo Owner." It then enumerates all App Registrations within the tenant that the "Demo Owner" has ownership over. In the demo,App Awas identified as an app owned by the "Demo Owner" and had several permissions, includingMail.Read,Files.ReadWrite.All, and crucially, permissions likeCloud Application Administratorand potentially others that facilitate escalation.
- Injecting Attacker Credentials: The attacker then makes another Graph API call to
PATCHthe configuration of the identifiedApp A. Specifically, they inject a new client secret (a shared password for the Service Principal) intoApp A's credentials. This secret is entirely controlled by the attacker and acts as a persistent backdoor. Boyd noted that this action is often not monitored, making it a stealthy persistence mechanism.
- Authenticating as a Headless Service Principal: With the new client secret injected, the attacker no longer needs the original user's refresh token. They switch to a client credentials flow, authenticating directly as
App A's Service Principal using the injected client secret. This authentication method is headless, meaning no user interaction is required, and it's immune to password resets or MFA changes on the original "Demo Owner" account. The Service Principal now holds the delegated permissions ofApp A.
- Privilege Escalation: The final step involves leveraging
App A's permissions to achieve Global Administrator status. IfApp A's Service Principal has permissions such asRoleManagement.ReadWrite.Directory,AppRoleAssignment.ReadWrite.All, orDirectory.ReadWrite.All, it can modify directory roles. Boyd demonstrated this by assigning the Global Administrator role to a pre-existing attacker-controlled user (e.g., "Demo Attacker") via the Graph API. He showed how this change was reflected in the Azure portal, confirming the successful privilege escalation.
Boyd explicitly stated that the entire process involved "just HTTP calls out to the graph," instrumented with PowerShell for scripting and Python for the initial web callback. This minimalist approach highlights the inherent misconfiguration risk rather than reliance on complex vulnerabilities. He also mentioned a second attack chain, where the initial access was through a pre-existing leaked Service Principal credential (for App B), demonstrating that the core escalation path remains consistent regardless of how the initial access to a privileged app registration is gained.
Demo / Proof of Concept
▶ Watch: Auditing for Entra ID Vulnerabilities (29:00)
Eric Boyd provided a compelling live demonstration of the attack, moving between PowerShell scripts, a Python web server, and the Azure portal to illustrate each stage. He began by showcasing a clean Azure/Entra ID environment with two tenants: entra-security-demo-primary.microsoft.com and an attacker tenant. Within the primary tenant, he confirmed that the Demo Owner user, who would be the initial target, held only standard user permissions and owned one specific App Registration (App A). Similarly, the Demo Attacker user had no elevated permissions.
The demonstration unfolded as follows:
- Python Web Server Setup: Boyd first launched a simple Python script locally. This script served as a minimal web API, configured to receive the OAuth refresh token upon successful user consent.
- Initial Consent Grant: He then navigated to a crafted login link, simulating a user interacting with a legitimate application. The
Demo Owneruser logged in to Entra ID, and after successful authentication, the refresh token was redirected to the Python server and saved to an environment file on the attacker's system. - Validate Refresh Token: Back in PowerShell, Boyd executed a script to test the newly acquired refresh token. The script successfully exchanged it for an access token, confirming the attacker could now operate as the
Demo Owner. - Enumerate Owned Applications: The script then used the
Demo Owner's delegated permissions to query the Microsoft Graph API and list all App Registrations owned by this user.App Awas identified as a target. - Inject Client Secret: The next step involved injecting an attacker-controlled client secret into
App A's configuration. Boyd showed how this was reflected in the Azure portal underApp A's "Certificates & secrets" section, confirming the new secret was added. - Authenticate as Service Principal: After a brief wait for propagation, the script used the newly injected client secret to authenticate directly as
App A's Service Principal via a client credentials flow. This established a persistent, headless connection. - Privilege Escalation: Finally, the script leveraged the Service Principal's permissions (which included
Cloud Application Administratorand the underlyingRoleManagement.ReadWrite.Directoryequivalent) to assign the Global Administrator role to theDemo Attackeruser. Boyd navigated to the "Global Administrator" role in the Azure portal, demonstrating that theDemo Attackerwas now listed among the Global Admins.
Boyd then briefly mentioned a second attack chain where the initial access began with a pre-existing leaked Service Principal credential for App B, illustrating that the subsequent privilege escalation steps were identical. He also touched upon B2B guest enumeration and Evilginx (a man-in-the-middle phishing tool) as alternative initial access vectors, though these were not live-demoed. The entire demonstration powerfully conveyed how seemingly minor misconfigurations, combined with a user's single click, could lead to a complete tenant compromise.
Defensive Implications
▶ Watch: Q&A: Obtaining the Initial Refresh Token (40:30)
Understanding this attack chain is critical for defenders to secure their Azure/Entra ID tenants. Eric Boyd outlined both immediate remediation steps and long-term preventative measures.
Remediation (Post-Compromise):
If a tenant is suspected of being compromised by this method, immediate actions are required:
- Remove Injected Client Secrets: Identify and delete any unauthorized client secrets added to App Registrations. Attackers often name these secrets distinctly (e.g., "attacker demo secret"), which can aid identification.
- Remove Attacker Service Principal as App Owner: Revoke any ownership roles granted to attacker-controlled Service Principals or users on critical App Registrations.
- Revoke Global Administrator Role: Remove the Global Administrator role from any compromised or attacker-controlled user accounts.
- Revoke OAuth Refresh Tokens: Invalidate all refresh tokens for the initially compromised user account. This was demonstrated at the beginning of the talk, showing how a revoked token prevents further access.
- Restrict Tenant Consent Policy: Temporarily, or permanently, tighten the tenant's OAuth consent policy to prevent further unauthorized app installations.
Preventative Measures:
Boyd provided five key categories for defense, emphasizing that these are "table stakes" for securing Entra ID:
- Restrict User Consent: This is arguably the most critical preventative step. By default, many Entra ID tenants allow users to consent to applications. Organizations must configure tenant-wide settings to restrict user consent, requiring administrator approval for all OAuth applications. While this can increase administrative overhead, it ensures that a security team reviews permissions before an app is granted access. Boyd noted that even administrators can approve harmful apps, but it adds a crucial layer of scrutiny.
- Audit App Registrations and Owners Regularly: Proactive auditing is essential. Boyd highlighted a PowerShell script called Privileged App Path Auditor (developed by a colleague) that scans an Entra ID tenant for risky configurations. This tool identifies:
- Dangerous Permissions: Specifically, it flags permissions like
RoleManagement.ReadWrite.Directory,AppRoleAssignment.ReadWrite.All, andDirectory.ReadWrite.All, which can be used for privilege escalation to Global Administrator. - Attack Path Score: The script assigns a risk score; anything above 2 indicates a higher risk.
- Client Secret Presence: It identifies App Registrations with client secrets, which are potential persistence points.
- Owner Count: Highlights apps with multiple owners, increasing the attack surface.
The tool outputs findings in CSV files, including direct links to objects in the Entra ID portal for easy remediation.
- Rotate and Monitor Secrets: Client secrets are long-lived credentials and a prime target for persistence. Organizations should:
- Automate Secret Rotation: Implement a process for regular, automated rotation of client secrets for all App Registrations.
- Avoid Long Expiration Dates: Do not set secrets to expire in one, two, or three years. Shorter rotation cycles (e.g., 30-90 days) are recommended.
- Leverage Multiple Secrets: Entra ID allows multiple active client secrets for an App Registration, facilitating graceful transitions during rotation.
- Monitor Sign-in and Audit Logs: Actively monitor logs for suspicious usage of Service Principal credentials, especially outside expected patterns.
- Restrict B2B Guest Access: By default, B2B guests can enumerate all applications within a tenant, providing valuable intelligence for attackers. Organizations should configure external collaboration settings within their tenant to limit what guests can see and do.
- Add Conditional Access to Workload Identities: This is a more advanced, long-term investment that requires premium licensing. Implementing Conditional Access policies for workload identities (i.e., Service Principals) helps enforce stricter controls (e.g., IP restrictions, trusted locations) on non-human identities, mitigating the risk of their compromise. This addresses a significant gap, as non-human identities are often overlooked in traditional Conditional Access strategies.
Boyd concluded by reiterating that the attack is not a "zero-day" but rather an abuse of OAuth and existing misconfigurations, emphasizing that security teams must take ownership of monitoring and securing these non-human identities.
Key Takeaways
- OAuth Consent is a Critical Attack Vector: A single user click on an OAuth consent dialog can grant attackers persistent, delegated access to an Azure/Entra ID tenant without requiring malware, credential theft, or MFA bypass.
- Misconfigured App Registrations are High-Value Targets: App registrations with broad permissions, especially those allowing directory role management, are susceptible to credential injection and subsequent privilege escalation.
- Service Principals Enable Stealthy Persistence: Attackers can inject their own client secrets into compromised App Registrations, creating a headless Service Principal that provides a persistent backdoor, resilient to user password resets and MFA changes.
- Proactive Auditing is Non-Negotiable: Tools like the "Privileged App Path Auditor" are essential for regularly scanning Entra ID tenants to identify risky permissions, unmonitored client secrets, and potential attack paths.
- Strict Consent Policies and Secret Management are Foundational: Restricting user consent for applications and implementing automated, frequent rotation of client secrets are fundamental defensive measures to prevent initial access and maintain control.
- Monitor Non-Human Identities: Organizations must shift focus to include comprehensive monitoring and Conditional Access for workload identities (Service Principals), as these are increasingly becoming targets for sophisticated attackers.
About the Speaker(s)
Eric Boyd is a highly respected and experienced professional in the Microsoft Azure ecosystem. He has been working with Azure since its inception in 2008 and holds impressive credentials, including being a 15-time Microsoft Azure MVP and a two-time Microsoft Foundry or AI MVP. For eight years, he also served as a Regional Director for Microsoft.
Boyd is the founder of responsiveX, a consultancy he started in 2012. Through his company, he helps customers design and build massively scalable distributed systems, advanced AI solutions, complex data and analytics workloads, and facilitate data center migrations to Azure. His extensive experience ensures that his insights into Azure security are both deep and practical. He explicitly stated that his independence from Microsoft allows him to be "totally honest" about security challenges, providing an unbiased perspective on vulnerabilities and defensive strategies.
Reviews
Dr. Zero (Offensive Security Researcher) — SOLID
Boyd chains illicit consent grants and Service Principal credential injection to expose exactly how fragile Entra ID defaults are. It isn't groundbreaking research, but it's a flawlessly executed reality check using nothing but Graph API calls. A mandatory watch for any cloud team still pretending user MFA solves identity.
Heather Calloway (CISO) — MUST SEE
This talk exposes a massive blind spot in enterprise cloud identity: workload identities and OAuth consent. Boyd demonstrates how a standard user clicking 'accept' on an app creates a headless, MFA-immune backdoor that escalates to Global Admin, making this a mandatory watch for your IAM and cloud architecture teams.