Language:
Microsoft exposes APIs through applications in Entra ID to allow 3rd-party applications to perform actions on Microsoft Entra ID itself, Microsoft 365 (O365), Azure cloud, etc. "API permissions" protect the access to these APIs which only the service principals that need them can have. The permissions approval is called an "application role assignment" or a "consent grant".
Certain permissions on some Microsoft APIs (see below) can pose a serious threat to the entire Microsoft Entra tenant, because a service principal with these permissions becomes very powerful while being more discreet than a user with a powerful administrator role such as Global Administrator. Abusing this can allow an attacker to bypass the Multi-Factor Authentication (MFA) and resist user password resets.
When legitimate, the permissions increase the attack surface for the tenant. When they are not legitimate, it can be an malicious attempt to escalate privileges or persistence method.
There are two types of API permissions in Microsoft Entra ID as described in the Microsoft documentation Introduction to permissions and consent:
This Indicator of Exposure examines both types of permissions. It only reports on service principals because API permissions can only apply to service principals and not users.
This Indicator of Exposure is also focused on permissions that allow access to the Microsoft Graph API and the legacy Azure AD Graph API. In particular, the following dangerous permissions can pose a security risk:
RoleManagement.ReadWrite.Directory
: Allows attackers to elevate themselves to the Global Administrator role.AppRoleAssignment.ReadWrite.All
: Allows attackers to grant themselves the RoleManagement.ReadWrite.Directory
permission (see above).Legitimate applications with these dangerous permissions ask for permissions that may be too broad. This can also signal a phishing attack called an "illicit consent grant", where an attacker succeeds in obtaining the consent of an administrator.
Disabled service principals are ignored by default because they cannot be immediately used by attackers.
Begin by determining if the reported service principal with the permission is legitimate. Be aware that it is technically possible to spoof the display name in a phishing attack. If the service principal appears to belong to a known software vendor, ask them to confirm that the reported application ID belongs to them. If the service principal is illegitimate and it spoofs a known application name, you should do a forensic analysis.
Microsoft also published two guides on how to perform an Application consent grant investigation and how to Detect and Remediate Illicit Consent Grants.