AZ_MG_SERVICEPRINCIPALENDPOINT_READWRITE_ALL
Summary
FSProtect 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 GUI
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
Detect owner additions and endpoint modifications in Audit logs.
PowerShell (Microsoft Graph)
Azure GUI
Go to Microsoft Entra ID -> Audit logs
Filter by activities:
Add owner to service principal
Update service principal
Alert Criteria
New owners added to service principals
Reply URL additions to service principals
Endpoint changes outside change management windows
Addition of external or suspicious domains to redirect URIs
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?