Skip to content
Access control Write-up Intermediate

Abusing Azure Hybrid Workers for Privilege Escalation – Part 1

Azure Automation Hybrid Workers can be configured with 'Run as' certificates that are installed on the worker VMs, and anyone with local administrator access to those VMs can export the certificate and authenticate as the 'Run as' service principal. Since 'Run as' accounts are typically subscription contributors, this allows privilege escalation from several Azure RBAC roles to subscription contributor.

Josh Magri Follow

Published on netspi.com

Technical / Cloud Pentesting

Karl Fosaaen, on netspi.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 the 'Run as' certificate is installed on the Hybrid Worker VM in an exportable form, so any local administrator can export the private key and authenticate as the service principal.

Impact

A user with one of several Azure RBAC roles that grant command execution or login on the Hybrid Worker VM could escalate to subscription Contributor, because the 'Run as' account is typically a subscription contributor.

What the attacker needed

An Azure RBAC role granting VM command or login; a Hybrid Worker VM with the 'Run as' certificate; the certificate is exportable

The fix

Microsoft updated documentation to warn about the impact and recommends marking the certificates as non-exportable, and the author recommends switching from 'Run as' accounts to managed identities on the Hybrid Worker VMs.

How it was found

  1. Identify Hybrid Worker VMs, for example by finding VMs with the HybridWorkerExtension installed.
  2. Obtain local administrator access to the Hybrid Worker VM through one of the listed Azure RBAC roles.
  3. Export the 'Run as' certificate from the certificate manager on the VM.
  4. Use the exported certificate to authenticate as the 'Run as' service principal.

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 Automation Accounts run scripts in the cloud, and Hybrid Workers are extra machines that run those scripts. To let the scripts sign in to Azure, administrators sometimes copy a certificate onto the worker machine. If an attacker can log in to that machine as an administrator, they can copy the certificate and use it to sign in as the powerful account it belongs to.

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.

More by Josh Magri

View all

2 more disclosed reports, best first.

More from Microsoft (Azure)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.