Skip to main content
Back
DemonstrationMicrosoft Entra
6 min read

UnOAuthorized: Semperis reaches Entra Global Administrator through a credential added to a Microsoft first-party service principal

Environment
A Microsoft Entra tenant the Semperis research team used for the demonstration; the source names no tenant and no company
When
Not stated; reported to Microsoft January 11, 2024Disclosed Aug 7, 2024
Entry
A user holding the Application Administrator or Cloud Application Administrator role added a credential to the tenant's Device Registration Service service principal and signed in as it.

In research Semperis reported to Microsoft on January 11, 2024, and disclosed on August 7, 2024, a user with the Application Administrator or Cloud Application Administrator role adds a secret or certificate to the tenant's Device Registration Service service principal, signs in as it with the OAuth 2.0 client credentials grant, and uses the Microsoft Graph token to add a user to the Global Administrator role, although the app shows no scopes. The same method allows deleting users as Viva Engage and creating users as Microsoft Rights Management Service. Microsoft closed the Device Registration Service case on March 4, 2024, and further reduced the Microsoft service principals that accept a credential in July 2024; whether any organization was compromised this way is unknown.

What the demonstration did

Research and disclosure
Semperis
Microsoft Security Response Center
Internet
Microsoft Entra IDtoken endpoint, client credentials grant
Microsoft Entra ID
Tenant directory and roles
First-party service principals
Application administrator
Global Administrator role
Tenant user accounts
Device Registration Service
Viva Engage
Rights Management Service

Replaying Semperis's UnOAuthorized demonstration

  1. 1

    Credential on a Microsoft app

    Date not stated; reported to Microsoft January 11, 2024

    A user with the Application Administrator or Cloud Application Administrator role adds a secret or certificate to the Device Registration Service service principal, and the client credentials grant returns a Microsoft Graph token as that app.

  2. 2

    Global Administrator

    Date not stated

    With the Device Registration Service token, a Microsoft Graph request adds a user to the Global Administrator role, although the scopes shown for the app are empty.

  3. 3

    Other Microsoft apps

    Date not stated

    Semperis reports that the same method allows deleting and permanently deleting users as Viva Engage, Global Administrators included, and creating users as Microsoft Rights Management Service; the post gives no detail of the requests.

  4. 4

    Persistence options

    Date not stated

    Semperis describes ways to keep access after reaching Global Administrator, such as a new app registration with privileged application permissions or credentials added to an existing privileged application; the post does not show them performed.

  5. 5

    Disclosure and fix

    January 11, 2024, to July 2024

    Microsoft closes the Device Registration Service case on March 4, 2024, adds controls on credentials on its service principals, and in July 2024 further reduces the ones that still accept a credential.

Impact

In a demonstration, a user with the Application Administrator or Cloud Application Administrator role added a credential to Microsoft's Device Registration Service service principal, signed in as it and added a user to Global Administrator; the same method let Viva Engage delete users and Microsoft Rights Management Service create users. Semperis does not know whether any organization was compromised this way.

Outcome

Where Microsoft Entra controls fit

In this demonstration the chain ran from an application administrator role to Global Administrator, through an authorization Microsoft holds for its own applications that no tenant setting reached. The point you control is the credential. An app management policy with Block password addition refuses a new client secret on service principals, but Microsoft's documentation does not name its first-party service principals, and a certificate stays possible with a capped lifetime. Holding Application Administrator and Cloud Application Administrator as eligible assignments in Privileged Identity Management bounds who can add the credential at all. Microsoft has since restricted credentials on its service principals; check yours for keyCredentials and passwordCredentials, and search your audit log for Add service principal credentials.

Would the controls have stopped it?

In hindsight, no control would have stopped it. 4 controls would have limited how far it went. 4 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

0
Prevented
4
Contained
4
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

Research and disclosure
Semperis
Microsoft Security Response Center
Internet
Microsoft Entra IDtoken endpoint, client credentials grant
Microsoft Entra ID
Tenant directory and roles
First-party service principals
Application administrator
Global Administrator role
Tenant user accounts
Device Registration Service
Viva Engage
Rights Management Service

Replaying Semperis's UnOAuthorized demonstration

1 · Credential on a Microsoft app

2 Contained1 Not covered

2 · Global Administrator

1 Not covered

3 · Other Microsoft apps

1 Contained1 Not covered

4 · Persistence options

1 Contained3 on other clouds

5 · Disclosure and fix

1 Not covered

Key facts

  • Semperis opened cases with the Microsoft Security Response Center (MSRC) on January 11, 2024, for three Microsoft first-party applications: Device Registration Service, Viva Engage and Microsoft Rights Management Service
  • The scopes shown for Device Registration Service were empty, yet its Microsoft Graph token added a user to the Global Administrator role; Semperis says the app could add and remove Global Administrators
  • MSRC first rated the issues low severity on January 30, 2024, then reclassified the Device Registration Service case as important on March 4, 2024, and closed it together with the Rights Management Service case
  • The Viva Engage case was rated low on March 4, 2024, reclassified as medium on April 1, 2024, and closed on April 19, 2024
  • Microsoft further reduced the set of its service principals that still accept a credential in July 2024; signing in as Device Registration Service now returns an error from Microsoft Graph, per Semperis
  • Semperis disclosed the research on August 7, 2024, the day of its Black Hat USA 2024 talk; it says it is unknown whether any organization was compromised this way, and news coverage on August 8, 2024, confirmed no exploitation

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    UnOAuthorized: Privilege Elevation Through Microsoft ApplicationsSemperis · Aug 7, 2024 · ResearchThe required role, the credential added to the first-party service principal, the client credentials sign-in, the Global Administrator assignment, the other affected apps, the persistence options, the MSRC timeline, the fix and the detection guidance
  2. 2.
    Semperis researcher to reveal technique to exploit Entra ID at Black Hat USA 2024Semperis · Jul 25, 2024 · NewsThe disclosure venue and the talk date
  3. 3.
    Azure AD privilege escalation - Taking over default application permissions as Application AdminDirk-jan Mollema (dirkjanm.io) · Sep 16, 2019 · ResearchBackground on the technique, the 2019 MSRC position, the July 2024 block on first-party service principals
  4. 4.
    Microsoft Entra ID VulnerabilityCyber Security News · Aug 8, 2024 · NewsCoverage of the disclosure, no confirmed exploitation

The estate in the replay follows the researchers' description of their own test environment. Verdicts describe what a control does when it is in place before the run. They are not an assessment of any company's security program.

More cloud attack breakdowns

All breakdowns