Passwordless Persistence and Privilege Escalation in Azure
An attacker who can enable certificate-based authentication and upload a trusted root CA to an Azure AD tenant can then mint certificates for any user, including Global Admins, and log in without their password. This gives stealthy persistence that survives password changes and a privilege escalation path from lesser roles to full tenant control.
Published on posts.specterops.io
Adversaries are always looking for stealthy means of maintaining long-term and stealthy persistence and privilege in a target environment. Certificate-Based Authentication (CBA) is an extremely attractive persistence option in Azure for three big reasons:
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the design allows two separately granted privileges (enabling certificate-based authentication and adding a trusted root CA) to combine into the ability to authenticate as any user, and logins made with a certificate cannot be told apart from password logins.
Impact
An attacker holding the required role combinations could authenticate as any user, including Global Admins, and keep access through password changes; the author notes MFA and Conditional Access were assumed absent, and MSRC rated it Low severity.
What the attacker needed
Control of a principal with CBA-enabling rights; control of a principal with CA-upload rights; no MFA or Conditional Access assumed
The fix
It should be fixed by tightly auditing and removing the Authentication Policy Administrator role and the Policy.ReadWrite.AuthenticationMethod and Organization.ReadWrite.All app roles from principals that do not need them, and by relying on MFA and Conditional Access.
How it was found
- Enable certificate-based authentication in the tenant and include the target users.
- Create a certificate authority and upload its public certificate as a trusted root CA.
- Create a certificate signing request that names the target user in the subject alternative name.
- Sign the request with the CA and export the result as a PFX file.
- Install the PFX in the browser and sign in to the portal as the target user without a password.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Azure AD can be told to trust certificates instead of passwords for logging in. If someone can switch that feature on and add their own certificate authority, they can create a certificate that says 'I am this user' and the service will believe it. That means they can sign in as anyone, even the most powerful administrator, without ever knowing a password.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.