azure-vm-extension-write

derived azure emits CanModifyCode

match (effective permission)

{ "action": "Microsoft.Compute/virtualMachines/extensions/write", "scope_type": "resource|resourceGroup|subscription" }

emit

source typeIdentity
source<principal>
target<virtualMachine>
permissionsMicrosoft.Compute/virtualMachines/extensions/write
conditionsservice_state

Narrative

{principal.name} can install a script extension on {target.name} (extensions/write), running attacker code on the host.

Raw rule rules/derived/azure/vm.yaml

id: azure-vm-extension-write
emits: CanModifyCode
match_effective_permission:
  action: Microsoft.Compute/virtualMachines/extensions/write
  scope_type: resource|resourceGroup|subscription
emit:
  source_type: Identity
  source: <principal>
  target: <virtualMachine>
  permissions:
  - Microsoft.Compute/virtualMachines/extensions/write
  conditions:
  - service_state
  escalation: Install/replace a CustomScript or RunCommand extension that executes attacker script as
    SYSTEM/root.
  false_positive_note: Extension handler runs on a running VM; if deallocated, CONDITIONAL(service_state)
    + CanStart.
  narrative: '{principal.name} can install a script extension on {target.name} (extensions/write), running
    attacker code on the host.'
move · open · esc close