Azure VM Chef Extensions Can Be Abused for Command Execution and Managed Identity Token Theft

Summary
A cloud-pentesting walkthrough shows how an attacker with permission to write Azure VM extensions could use a rogue Chef server and cookbook to execute commands and capture a VM’s managed identity token, with logging guidance for detection.
Key points
- An attacker with Microsoft.Compute/virtualMachines/extensions/write permission can deploy a legitimate Chef extension and configure it to run a cookbook on an Azure VM.
- The demonstration uses a rogue Chef server and a cookbook to retrieve the VM’s managed identity access token and send it to an external endpoint.
- The technique requires the Chef server to be publicly reachable by the target VM.
- Roles with extension-write permission include Owner, Contributor, Log Analytics Contributor, and Virtual Machine Contributor, among others.
- Azure Activity Logs can be monitored for VM extension write operations, including Chef client extensions.
- Host investigation can use the Chef extension status and client logs on Linux or Windows, and compare the configured Chef server URL against approved servers.
- The article recommends restricting role assignments and monitoring sensitive extension changes rather than eliminating VM extensions.
Article Details
- Topic
- Abusing Azure VM Chef extensions to execute commands and maintain remote access through a rogue Chef server
Indicators of compromise
| Type | Indicator | Context |
|---|---|---|
| IPV4 | 13[.]60[.]214[.]35 | Example Chef server address shown in VM settings; the article says an unrecognized Chef server may be malicious. |
| URL | hxxps[:]//ptmhkh6nu50o5rtsgqkhbu908rei28qx[.]oastify[.]com | Out-of-band endpoint used in the demonstration to receive the captured Azure managed identity access token. |
Products
Tools
Burp Collaboratortake a few minutes to complete, but once done you can check it was successful by going back to Burp collaborator (or your specific tool for detecting out-of-band interactions) to see the request recieved and thechef-zeroUse chef-zero – This is a stripped back, simple, in-memory Chef server that is designed to be used for quick testing or during development.KnifeKnife
