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

· Original article ↗

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

TypeIndicatorContext
IPV413[.]60[.]214[.]35Example Chef server address shown in VM settings; the article says an unrecognized Chef server may be malicious.
URLhxxps[:]//ptmhkh6nu50o5rtsgqkhbu908rei28qx[.]oastify[.]comOut-of-band endpoint used in the demonstration to receive the captured Azure managed identity access token.

Products

Tools

Related Articles