Skip to content
Leaked secrets Write-up Intermediate

Beyond the Fear: How the Dark Web Became My Secret Weapon for a Azure AD Takeover ️‍♂️✨

A service principal secret was exposed in a public Azure DevOps repository, allowing an attacker to authenticate with high privileges and read the entire user directory. The attacker could also create admin accounts and modify permissions.

infosecwriteups.com

Published on infosecwriteups.com

Free Link🎈

Iski, on infosecwriteups.com

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 a hardcoded secret in a PowerShell script was committed to a public Azure DevOps repository, and the service principal had excessive permissions.

Impact

The service principal had Application.ReadWrite.All and Directory.ReadWrite.All permissions, allowing the attacker to read all user emails, access SharePoint files, read Azure Key Vault secrets, create new admin accounts, and modify existing permissions.

What the attacker needed

Access to the dark web forum; Ability to download the data dump; Public Azure DevOps repository

How it was found

  1. Found a PowerShell script with a comment about a hardcoded secret.
  2. Scanned GitHub with truffleHog but found nothing.
  3. Enumerated Azure DevOps and found a public repository named azure-automation.
  4. Retrieved the script containing the service principal secret.
  5. Authenticated to Azure AD using ROADtools with the tenant ID, client ID, and secret.
  6. Used Microsoft Graph to read the user directory.

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.

A service principal is like a robot account used by applications to access Azure AD. Its secret is like a password. If that password is left in a public code repository, anyone can use it to log in as the robot and do whatever it is allowed to do, which in this case was almost everything.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.