azure-func-functions-write

derived azure emits CanModifyCode

match (effective permission)

{ "action": "Microsoft.Web/sites/functions/write", "scope_type": "resource|resourceGroup|subscription" }

emit

source typeIdentity
source<principal>
target<function app>
permissionsMicrosoft.Web/sites/functions/write
conditionsservice_state

Narrative

{principal.name} can overwrite function code on {target.name} (functions/write), running attacker code as its identity.

Raw rule rules/derived/azure/functions.yaml

id: azure-func-functions-write
emits: CanModifyCode
match_effective_permission:
  action: Microsoft.Web/sites/functions/write
  scope_type: resource|resourceGroup|subscription
emit:
  source_type: Identity
  source: <principal>
  target: <function app>
  permissions:
  - Microsoft.Web/sites/functions/write
  conditions:
  - service_state
  escalation: Create/replace a function's code and function.json (incl. downgrading authLevel to anonymous),
    executed as the app's MI on next trigger.
  false_positive_note: Realized on next invoke/restart; without a trigger or CanInvoke -> CONDITIONAL(trigger_exists).
    On a stopped app CONDITIONAL(service_state) + CanStart.
  narrative: '{principal.name} can overwrite function code on {target.name} (functions/write), running
    attacker code as its identity.'
move · open · esc close