azure-batch-pool-write-starttask

derived azure emits CanModifyCode

match (effective permission)

{ "action": "Microsoft.Batch/batchAccounts/pools/write", "scope_type": "resource|resourceGroup|subscription" }

where

also matches Microsoft.Batch/batchAccounts/computePools/write for the newer pool API

emit

source typeIdentity
source<principal>
target<batch pool>
permissionsMicrosoft.Batch/batchAccounts/pools/write
conditionsservice_state

Narrative

{principal.name} can set the startTask command of pool {target.name} (pools/write), running attacker code on every node.

Raw rule rules/derived/azure/batch.yaml

id: azure-batch-pool-write-starttask
emits: CanModifyCode
match_effective_permission:
  action: Microsoft.Batch/batchAccounts/pools/write
  scope_type: resource|resourceGroup|subscription
where:
- also matches Microsoft.Batch/batchAccounts/computePools/write for the newer pool API
emit:
  source_type: Identity
  source: <principal>
  target: <batch pool>
  permissions:
  - Microsoft.Batch/batchAccounts/pools/write
  conditions:
  - service_state
  escalation: Set/replace the pool startTask.commandLine (or container config) so every node runs attacker
    code at node start/scale-up.
  false_positive_note: startTask executes when nodes start / scale up; on a pool with zero nodes emit
    CONDITIONAL(service_state) and pair with a scale/create action.
  narrative: '{principal.name} can set the startTask command of pool {target.name} (pools/write), running
    attacker code on every node.'
move · open · esc close