azure-appsvc-sourcecontrol-write

derived azure emits CanModifyCode

match (effective permission)

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

emit

source typeIdentity
source<principal>
target<Microsoft.Web/sites>
permissionsMicrosoft.Web/sites/sourcecontrols/write
conditionsservice_state

Narrative

{principal.name} can repoint the source control of {target.name} to an attacker repo (sourcecontrols/write).

Raw rule rules/derived/azure/appservice.yaml

id: azure-appsvc-sourcecontrol-write
emits: CanModifyCode
match_effective_permission:
  action: Microsoft.Web/sites/sourcecontrols/write
  scope_type: resource|resourceGroup|subscription
emit:
  source_type: Identity
  source: <principal>
  target: <Microsoft.Web/sites>
  permissions:
  - Microsoft.Web/sites/sourcecontrols/write
  conditions:
  - service_state
  escalation: Point the app's deployment source at an attacker-controlled Git repo; the build/deploy pipeline
    runs attacker code.
  false_positive_note: Realizes execution on the next sync/build; requires continuous deployment to actually
    pull. On a stopped app CONDITIONAL(service_state).
  narrative: '{principal.name} can repoint the source control of {target.name} to an attacker repo (sourcecontrols/write).'
move · open · esc close