How the attack works
Applications and service principals in Microsoft Entra ID authenticate with client secrets or certificates. Anyone who can update an application's credentials (Application Administrator, Cloud Application Administrator, the application's owners, or an identity holding Application.ReadWrite.All) can add a new secret and then authenticate as that application.
Attackers favour applications that already hold privileged directory roles or Microsoft Graph application permissions. The new credential gives them persistent, app-only access that is not subject to user MFA or most Conditional Access policies, and survives password resets of the account they started from. A second rule on this page reads the same activity for one of Microsoft's own applications, the first-party service principal Office 365 Exchange Online, to which the earlier Exchange hybrid design uploaded a certificate and which Microsoft now tells customers to clean up.
What an attacker needs
- Control of an identity that can manage credentials on the target application or service principal (an admin role, application ownership, or a Graph permission).
- A target application with valuable permissions.
Impact
App-only access with the target's privileges: reading all mail or files, creating users, assigning roles, or full tenant takeover when the application holds a privileged directory role. Because it uses a valid credential, the activity blends in with normal application traffic.
Detection rules
Secret or Certificate Added to an Application or Service Principal
Detects a new client secret or certificate on an application registration or a service principal. Review every change on applications that hold directory roles or Microsoft Graph application permissions.
title: Secret or Certificate Added to an Application or Service Principal
id: e28bc75a-7691-4a15-a6a6-4c23df1e5bbf
status: experimental
description: >-
Detects a new client secret or certificate on an application registration or
a service principal. Review every change on applications that hold directory
roles or Microsoft Graph application permissions.
references:
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.t1098.001
logsource:
product: azure
service: auditlogs
detection:
selection_service_principal:
OperationName: Add service principal credentials
selection_application:
OperationName|contains: Certificates and secrets management
filter_failed:
Result: failure
condition: 1 of selection_* and not filter_failed
falsepositives:
- Scheduled credential rotation by deployment pipelines; allow-list the automation identities that perform it.
level: medium
False positives
- Scheduled credential rotation by deployment pipelines; allow-list the automation identities that perform it.
Credential Added to the Office 365 Exchange Online First-Party Service Principal
Detects a credential being added to the service principal of Microsoft's own application Office 365 Exchange Online. In the earlier Exchange hybrid design the Hybrid Configuration wizard uploaded the Auth Certificate of the on-premises organization to the keyCredentials of this first-party service principal, so whoever held that certificate could authenticate as it. Microsoft now states that this practice is no longer recommended and shouldn't be performed, moved hybrid to a dedicated application, tells customers to purge the keyCredentials of the first-party service principal to mitigate CVE-2025-53786, and has blocked Exchange Web Services access through the shared service principal since 31 October 2025. A new credential on it is therefore either a rerun of the wizard or somebody preparing to sign in as a Microsoft service. The rule matches the activity "Add service principal credentials" and the display name of the target in TargetResources. The object ID of the service principal is different in every tenant, and Microsoft does not document where the audit record carries the application ID, so the display name is what the rule reads.
title: Credential Added to the Office 365 Exchange Online First-Party Service Principal
id: 65a354e3-37c6-4dd3-b302-b4361763474a
status: experimental
description: >-
Detects a credential being added to the service principal of Microsoft's own
application Office 365 Exchange Online. In the earlier Exchange hybrid
design the Hybrid Configuration wizard uploaded the Auth Certificate of the
on-premises organization to the keyCredentials of this first-party service
principal, so whoever held that certificate could authenticate as it.
Microsoft now states that this practice is no longer recommended and
shouldn't be performed, moved hybrid to a dedicated application, tells
customers to purge the keyCredentials of the first-party service principal
to mitigate CVE-2025-53786, and has blocked Exchange Web Services access
through the shared service principal since 31 October 2025. A new
credential on it is therefore either a rerun of the wizard or somebody
preparing to sign in as a Microsoft service. The rule matches the activity
"Add service principal credentials" and the display name of the target in
TargetResources. The object ID of the service principal is different in
every tenant, and Microsoft does not document where the audit record
carries the application ID, so the display name is what the rule reads.
references:
- https://learn.microsoft.com/en-us/exchange/hybrid-deployment/deploy-dedicated-hybrid-app
- https://learn.microsoft.com/en-us/entra/identity/monitoring-health/reference-audit-activities
- https://learn.microsoft.com/en-us/purview/audit-log-activities#application-administration-activities
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.001
logsource:
product: azure
service: auditlogs
detection:
selection:
OperationName: Add service principal credentials
TargetResources|contains: Office 365 Exchange Online
filter_failed:
Result: failure
condition: selection and not filter_failed
falsepositives:
- The Hybrid Configuration wizard run with the option "Oauth, Intra Organization Connector and Organization Relationship". Microsoft documents that it uploads the Auth Certificate to the first-party service principal again. Confirm the run with the Exchange team and purge the certificate afterwards, as Microsoft advises.
- An application of your own whose display name contains the same text. Check the application ID of the target before you escalate.
level: high
False positives
- The Hybrid Configuration wizard run with the option "Oauth, Intra Organization Connector and Organization Relationship". Microsoft documents that it uploads the Auth Certificate to the first-party service principal again. Confirm the run with the Exchange team and purge the certificate afterwards, as Microsoft advises.
- An application of your own whose display name contains the same text. Check the application ID of the target before you escalate.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
New credential first used from an address the application has not used
A rotation by the team that runs an application is followed by sign-ins from the application's usual hosts. An attacker who adds a credential uses it from their own infrastructure. The service principal sign-in log records the key identifier of the credential behind each sign-in, so the first use of a new key can be compared with the addresses the application has always used.
- Audit log:
Add service principal credentialsorUpdate application - Certificates and secrets management. Take the application or service principal inTargetResourcesand the time. - Service principal sign-in log (
AADServicePrincipalSignInLogsin Microsoft Sentinel), 30 days before the change: theIPAddressandServicePrincipalCredentialKeyIdvalues of thatServicePrincipalId. - Same log, 7 days after the change: sign-ins with a
ServicePrincipalCredentialKeyIdnot seen before, whoseIPAddressis not in the set. - Alert, and raise the priority when the application holds directory roles or Microsoft Graph application permissions.
EventsAdd service principal credentialsUpdate application - Certificates and secrets management
LimitsApplications that run on cloud platforms with changing egress addresses have no stable set of addresses. Microsoft documents the key identifier column but not whether every credential type fills it, so check it in your own events. The service principal sign-in log is a separate diagnostic category that has to be collected. The 30 and 7 days are starting points.
Triage
- Identify the application (TargetResources) and the actor (InitiatedBy); new credentials added by a user instead of a deployment pipeline need an explanation.
- Check the application's roles and permissions to understand the blast radius.
- Review service principal sign-in logs after the change for new IP addresses or unusual API activity; remove unexplained credentials immediately.
Response
Once the attack is confirmed:
- Remove the secret or certificate that was added. Look on the application registration and on the service principal, because a credential can be added to either.
- If the application can be stopped for a while, disable sign-in for its service principal while you investigate.
- Review the sign-ins of the service principal since the credential was added and the audit log for what was done as the application. Undo the role assignments, permission grants and credentials it created.
- Revoke the sessions and reset the credentials of the identity that added the credential, and remove its ownership of the application or its administrator role.
- Check the remaining credentials and the owners of the application with the team that runs it, and confirm that only known ones are left.
Mitigation
- Keep privileged directory roles and high-impact Graph permissions off service principals wherever possible.
- Limit who can own or administer applications; review application owners regularly.
- Prefer managed identities and certificate credentials with short lifetimes; alert on any new credential on a privileged application.
- Use workload identity Conditional Access and sign-in log monitoring for service principals.
Frequently asked questions
Is the incident over once the compromised administrator account is secured?
No. The new credential belongs to the application, and it keeps working after the password of the account the attacker started from is reset. The access ends when the credential is removed from the application or the service principal.
How do we tell a scheduled rotation from an attack?
Look at the actor in InitiatedBy. Rotation is normally done by a deployment pipeline or another automation identity that you can put on an allow list. A new credential added by a user, especially on an application that holds directory roles or Microsoft Graph application permissions, needs an explanation.
Why does MFA not protect the application?
A service principal signs in with its secret or certificate and no user is involved, so user MFA and most Conditional Access policies do not apply. Conditional Access for workload identities and monitoring of the service principal sign-in logs are the controls for this kind of sign-in.