TokenSmith – Bypassing Intune Compliant Device Conditional Access
A first-party Microsoft client ID used by the Intune Company Portal app could be abused to obtain OAuth tokens without a compliant device, bypassing Conditional Access policies that require Intune compliance. An attacker with valid credentials or stolen cookies could authenticate from any browser and redeem tokens for Microsoft Graph and Azure AD Graph.
Published on labs.jumpsec.com
Conditional Access Policies (CAPs) are the core of Entra ID’s perimeter defense for the vast majority of Enterprise Microsoft 365 (M365) and Azure environments. The core ideas of conditional access are:
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Intune Device Enrollment Service client ID has a redirect URI that can be used from any browser, and because it is part of the Family of Client IDs (FOCI), tokens obtained for it can be exchanged for tokens to other Microsoft services, bypassing Conditional Access device compliance checks.
What the attacker needed
Valid credentials or stolen cookies; ability to complete MFA if required; meet other CAP conditions (e.g., geolocation)
The fix
Microsoft should restrict the redirect URI or require additional controls for this client ID; organisations should enforce MFA for the Intune Company Portal app via Conditional Access and monitor sign-in logs for this client ID.
How it was found
- Set up a Conditional Access policy requiring a compliant device for all cloud apps.
- Use the Intune Company Portal client ID with the correct redirect URI in an OAuth authorization request.
- Complete authentication (password/MFA or stolen cookies) in a browser.
- Extract the authorization code from the redirect to the ms-appx-web URI.
- Redeem the code at the token endpoint to get access and refresh tokens.
- Use the tokens to access Microsoft Graph and Azure AD Graph.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Conditional Access is a security rule in Microsoft 365 that says, for example, 'you can only log in from a device that the company manages'. This report shows that a special app used to set up company devices can be tricked into giving out login tokens even when you are not on a managed device. So someone with a stolen password or session cookie could get into cloud services without meeting the device requirement.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.