AZ_MG_SERVICEPRINCIPALENDPOINT_READWRITE_ALL
Summary
Forestall ACL Alias
AZ_MG_SERVICEPRINCIPALENDPOINT_READWRITE_ALL
Entra ID (Azure AD) Alias
ServicePrincipalEndpoint.ReadWrite.All
Affected Object Types
Service Principals
Exploitation Certainty
Certain
Graph Permission / Role
Application Permission: ServicePrincipalEndpoint.ReadWrite.All
Description
AZ_MG_SERVICEPRINCIPALENDPOINT_READWRITE_ALL represents a Microsoft Graph application permission that grants the ability to read and write service principal properties including endpoints and owners.
Capabilities (verified):
Add owners to service principals
Modify endpoint URLs including reply URLs and redirect URIs
Update service principal properties
Read service principal configurations
Security Implications:
This permission is dangerous because an attacker can:
Add themselves as owner of a service principal for persistence
Redirect authentication flows by modifying redirect URIs to capture OAuth tokens
Token theft by adding malicious reply URLs to steal access tokens
Persistence through backdoor endpoints that remain after credential rotation
Comparison with similar permissions:
ServicePrincipalEndpoint.ReadWrite.All
Yes
Yes
No
Application.ReadWrite.All
Yes
Yes
Yes
Directory.ReadWrite.All
Yes
Yes
Yes
Identification
PowerShell (Microsoft Graph)
Find Service Principals with ServicePrincipalEndpoint.ReadWrite.All:
Azure Portal
Open Microsoft Entra admin center -> Applications -> Enterprise applications
Select an application -> Permissions
Look for ServicePrincipalEndpoint.ReadWrite.All in granted permissions
Exploitation
An attacker with ServicePrincipalEndpoint.ReadWrite.All can add owners and modify service principal endpoints.
For adding owners to service principals, see AZ_ADD_OWNER.
Common Abuse Patterns
Add attacker as owner for persistent access
Modify redirect URIs to intercept OAuth tokens
Changes persist after credential rotation
Mitigation
Audit service principals with
ServicePrincipalEndpoint.ReadWrite.Alland remove unnecessary grantsGo to Microsoft Entra ID -> App registrations -> select application -> API permissions
Remove the permission if not required
Monitor owner additions on service principals:
Alert on new owners added to sensitive service principals
Review audit logs for owner changes
Implement strict reply URL policies:
Use exact match redirect URIs instead of wildcards
Limit reply URLs to known, trusted domains
Block localhost and HTTP (non-HTTPS) redirect URIs in production
Monitor redirect URI changes on service principals:
Review audit logs for modifications to service principal configurations
Alert on unexpected reply URL additions
Regular audits: Periodically review service principal owners and endpoints
Detection
Use the Microsoft Entra admin center:
Open Microsoft Entra ID -> Audit logs.
Filter Activity for Add owner to service principal and Update service principal.
Review Initiated by (actor), Target, Date, and Status for unexpected owner or endpoint changes.
Open the affected Enterprise application and review Owners plus redirect URI or endpoint-related settings for unexpected additions.
Use Manage view -> Edit columns if any of those fields are hidden.
References
https://learn.microsoft.com/en-us/graph/api/resources/serviceprincipal
https://learn.microsoft.com/en-us/graph/permissions-reference
https://learn.microsoft.com/en-us/entra/identity-platform/reply-url
https://learn.microsoft.com/en-us/graph/api/serviceprincipal-post-owners
Last updated
Was this helpful?