Detection rules › Kusto

GCP IAM - Publicly exposed storage bucket

Status
available
Severity
medium
Time window
1h
Source
github.com/Azure/Azure-Sentinel

Detects possible misconfiguration for bucket policy making it publicly available.

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1069 Permission Groups Discovery

Event coverage

ProviderEventTitle
GCP-iam.googleapis.comgoogle-iam-IAMPolicy-SetIamPolicySet IAM policy (IAMPolicy service)

Rule body kusto

id: 4a433846-4b05-4a27-99d7-92093feded79
name: GCP IAM - Publicly exposed storage bucket
description: |
  'Detects possible misconfiguration for bucket policy making it publicly available.'
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: GCPIAMDataConnector
    dataTypes:
      - GCP_IAM
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
  - Discovery
relevantTechniques:
  - T1069
query: |
  GCP_IAM
  | where PayloadMethodname =~ 'google.iam.v1.IAMPolicy.SetIamPolicy'
  | where ResourceType has 'bucket'
  | extend members = parse_json(todynamic(PayloadRequestPolicyBindings))[0]['members']
  | extend action = parse_json(todynamic(PayloadRequestPolicyBindings))[0]['action']
  | where members in~ ('allUsers', 'allAuthenticatedUsers')
  | where action =~ 'ADD'
  | extend AccountName = tostring(split(PayloadAuthenticationinfoPrincipalemail, "@")[0]), AccountUPNSuffix = tostring(split(PayloadAuthenticationinfoPrincipalemail, "@")[1])
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: PayloadAuthenticationinfoPrincipalemail
      - identifier: Name
        columnName: AccountName
      - identifier: UPNSuffix
        columnName: AccountUPNSuffix
  - entityType: IP
    fieldMappings:
      - identifier: Address
        columnName: SrcIpAddr
version: 1.0.1
kind: Scheduled

Stages and Predicates

Stage 1: source

GCP_IAM

Stage 2: where

| where PayloadMethodname =~ 'google.iam.v1.IAMPolicy.SetIamPolicy'

Stage 3: where

| where ResourceType has 'bucket'

Stage 4: extend

| extend members = parse_json(todynamic(PayloadRequestPolicyBindings))[0]['members']

Stage 5: extend

| extend action = parse_json(todynamic(PayloadRequestPolicyBindings))[0]['action']

Stage 6: where

| where members in~ ('allUsers', 'allAuthenticatedUsers')

Stage 7: where

| where action =~ 'ADD'

Stage 8: extend

| extend AccountName = tostring(split(PayloadAuthenticationinfoPrincipalemail, "@")[0]), AccountUPNSuffix = tostring(split(PayloadAuthenticationinfoPrincipalemail, "@")[1])

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
PayloadMethodnameeq
  • google.iam.v1.IAMPolicy.SetIamPolicy
ResourceTypematch
  • bucket transforms: term
actioneq
  • ADD
membersin
  • allAuthenticatedUsers
  • allUsers

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
membersextend
actionextend
AccountNameextend
AccountUPNSuffixextend