Home  /  Blog  /  A Leaked Secret to Global Admin: An Entra ID Attack Chain

● Red Team

A Leaked Secret to Global Admin: An Entra ID Attack Chain

It started with a single client secret committed to a repository, the kind of credential developers paste in to make a pipeline work and forget to remove. One leaked secret, an app registration with more directory power than anyone realised, and a short role-abuse path later, we held Global Administrator over the entire Microsoft 365 and Azure tenant. This is how a forgotten secret becomes total cloud control.

Published 15 November 2026 13 min read Codesecure Offensive Security Red Team

Key Takeaways

  • Secrets in code and pipelines are the number one way into a cloud tenant. An app registration secret is a working login for a service principal.
  • The chain was: a leaked client secret, to a service principal sign-in, to an over-privileged directory role, to role abuse, to Global Admin.
  • Service principals are accounts too. An app with a role like Application Administrator can add credentials to other apps and walk its way up.
  • Managed identities remove the secret entirely, which breaks the first and most common link in Azure attack chains.
  • Every step is in the Entra ID sign-in and audit logs: a service principal signing in from a new location, and new app credentials or role assignments appearing.

One Secret in a Repository

During reconnaissance we reviewed what the organisation had exposed in code: an internal-but-accessible repository and a CI pipeline configuration. In it sat an Entra ID (Azure AD) app registration client secret, together with the tenant and client IDs. Someone had hardcoded it to get a deployment working. It was still valid.

A client secret is not a hint or a fragment. It is a complete credential: with the tenant ID, client ID and secret, anyone can authenticate as that application's service principal. We did, with a single az login --service-principal, and we were now inside the tenant as a non-human identity that, it turned out, had been trusted with far too much.

Link 1: The Service Principal Can Touch the Directory

Signed in as the service principal, we enumerated what it could do. Azure attack-path tooling (AzureHound and similar) maps identities, roles and ownership the way BloodHound maps Active Directory, and it turned a wall of permissions into a clear picture. The app had been granted a directory role well beyond its job: the ability to manage other application registrations and their credentials.

People think of app registrations as plumbing, not as privileged accounts, so they over-grant them. But a service principal with power over other apps is a stepping stone: if it can add a credential to a more privileged app, it can become that app. That is the pivot the next link uses.

  • Enumerate directory roles and Microsoft Graph application permissions held by the service principal and by apps it can control.
  • Watch for roles and permissions that grant power over other identities: Application Administrator, Cloud Application Administrator, Privileged Role Administrator, or Graph permissions like RoleManagement.ReadWrite.Directory.
  • AzureHound and roadrecon turn Entra ID permissions into a shortest-path graph, which defenders should run too.

Want to Know Your Real Attack Chain?

Codesecure runs red team and internal penetration tests that start where a real attacker starts: an unauthenticated foothold, and chain the misconfigurations until something breaks. You get the full attack path, mapped to MITRE ATT&CK, with the exact fixes that break each link. ISO/IEC 27001:2022 certified delivery, named OSCP, CEH and CISSP consultants, across India, Singapore, UAE and Malaysia.

See Red Team and VAPT Services →

Link 2: Role Abuse to Global Admin

The escalation followed a known Entra ID path. Because our service principal could manage other applications' credentials, we added a new secret to a second, more privileged application, then authenticated as that application. That second identity held a role with a path to the top of the directory, and from there we reached Global Administrator, the role that controls the entire Microsoft 365 and Azure Active Directory tenant.

At Global Admin it is total: every user's mailbox and files, every Azure subscription under the tenant, the ability to reset any password, disable security controls, and create persistence that survives a secret rotation. One secret that should never have been in a repository, one app that should never have had directory power, and the whole tenant was ours.

The Whole Chain

Three links, and the first was the kind of mistake that happens every week:

  • 1. A leaked client secret gave us a service principal login.
  • 2. An over-privileged app gave that identity power over other apps.
  • 3. Role abuse walked that power up to Global Admin.

The Signals in Entra ID Logs

Microsoft Entra ID logs this chain clearly for anyone watching. The sign-in logs show a service principal authenticating, and a service principal signing in from an unusual IP or location is a strong anomaly, since apps usually call from known infrastructure. The audit logs record the escalation directly: a new credential added to an application, and a new role assignment. Those are among the highest-signal events in a cloud tenant.

Feeding Entra ID sign-in and audit logs into a SIEM, and alerting on service-principal sign-ins from new locations and on application-credential and role-assignment changes, catches this attack in motion. Microsoft Entra ID Protection can also flag risky service-principal behaviour. Detection does not rely on nobody ever leaking a secret; it relies on noticing what the secret is used to do.

SHARE

Frequently Asked Questions

Why is a leaked Azure client secret so dangerous?

Because it is a complete credential, not a fragment. With the tenant ID, client ID and client secret, anyone can authenticate as that application's service principal and do whatever that identity is permitted to do. If the app is over-privileged, as many are, a single leaked secret becomes a path into the directory. This is why secrets in code, pipelines and config are treated as already compromised, and why managed identities, which have no secret to leak, are preferred.

What is a service principal and why does it matter for security?

A service principal is the identity an application uses to authenticate and act in Entra ID, the non-human equivalent of a user account. It matters because service principals are often granted broad directory roles and Microsoft Graph permissions under the assumption that they are just plumbing. An over-privileged service principal, especially one that can manage other applications or directory roles, is a privilege-escalation stepping stone, which is exactly what this attack chain abused.

How does an attacker get from an app registration to Global Admin?

Through role abuse. If a compromised service principal can manage other applications' credentials (for example via the Application Administrator role), it can add a secret to a more privileged application and authenticate as that app. Chaining these steps walks access up to a role with directory-wide control, Global Administrator. Scoping application roles to least privilege and putting privileged roles behind Privileged Identity Management breaks this path.

How do we stop leaked-secret attacks in Azure?

Remove the secret and scope the identity. Use managed identities so there is no secret in code, store any unavoidable secrets in Key Vault with tight access, scan code and pipelines for credentials, grant service principals least-privilege roles and Graph permissions, use Privileged Identity Management for just-in-time privileged access, and monitor Entra ID logs for service-principal sign-ins from new locations and for new app credentials and role assignments.

Will a scanner or CSPM tool catch this chain?

Partly. A CSPM tool may flag an over-privileged app or a secret in code as separate findings, but it will not authenticate as the service principal, enumerate the directory, perform the role abuse, and reach Global Admin. Connecting those steps into tenant takeover is what an Azure penetration test or red team engagement does, and it is what tells you which single fix removes the most risk.

Can Codesecure assess our Microsoft Entra ID and Azure tenant?

Yes. Codesecure runs Azure and Entra ID penetration tests and red team engagements that chain real misconfigurations, from leaked secrets and over-privileged service principals through role abuse to tenant-level impact, mapped to MITRE ATT&CK. You get the attack path and the cheapest fix at each link. ISO/IEC 27001:2022 certified delivery with named OSCP, CEH and CISSP consultants across India, Singapore, UAE and Malaysia.

CS

Codesecure Offensive Security

OSCP / CEH / CISSP Certified Penetration Testers

Codesecure Solutions is ISO/IEC 27001:2022 certified and runs manual red team engagements and penetration tests across Active Directory, cloud (AWS and Azure), network, web and mobile, for businesses across India, Singapore, UAE and Malaysia. Named OSCP, CEH and CISSP consultants. We chain real misconfigurations the way an attacker does, then hand you the attack path and the fixes that break it.

✓ ISO/IEC 27001:2022 Certified

Who Really Controls Your Azure Tenant?

Codesecure tests Entra ID and Azure the way an attacker does, chaining leaked secrets and over-privileged identities to tenant-level impact, then hands you the cheapest fix at every link. Azure red team and pentest by named OSCP, CEH and CISSP consultants, ISO/IEC 27001:2022 certified, across India, Singapore, UAE and Malaysia.