Escalating Azure Privileges with the Log Analytics Contributor Role
The Log Analytics Contributor role had excessive permissions on Automation Accounts, allowing a user with that role to create a runbook that exported the Run As account certificate. This let the attacker authenticate as the Run As account, which had Contributor rights on the subscription, and thus escalate privileges.
Published on netspi.com
Technical / Cloud Pentesting
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
The Log Analytics Contributor role included the Microsoft.Automation/automationAccounts/* permission, which allowed creating and running runbooks in Automation Accounts that had Run As accounts with Contributor rights on the subscription.
Impact
An attacker with the Log Analytics Contributor role could escalate to Subscription Contributor, allowing them to create or modify resources, access Key Vault secrets, and establish persistent access.
What the attacker needed
Azure AD user with Log Analytics Contributor role; Existing Automation Account with Run As account
The fix
Microsoft removed the Automation Accounts permissions from the Log Analytics Contributor role and updated documentation.
How it was found
- Create an Automation Account with a Run As account (requires Owner).
- Assign the Log Analytics Contributor role to an Azure AD user.
- Log in as that user and use a tool to create a runbook that exports the Run As certificate.
- Use the exported certificate to authenticate as the Run As account, which has Contributor rights.
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.
In Azure, roles give users certain permissions. The Log Analytics Contributor role is meant for monitoring but also allowed creating runbooks in Automation Accounts. A runbook is a script that runs in Azure. The attacker used this to extract a certificate for the Automation Account's Run As account, which had higher privileges, and then logged in as that account to gain full control of the subscription.
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.