Detection rules › Panther

GCP Privilege Escalation via TagBinding

Severity
informational
Time window
15m
Match by
p_alert_context.principal
Tags
attack.privilege_escalation, attack.t1548, gcp, iam, tagbinding, Beta
Reference
https://cloud.google.com/resource-manager/docs/tags/tags-overview
Source
github.com/panther-labs/panther-analysis

Detects a sequence of events that could indicate a privilege escalation attempt via GCP's tag-based access control. The sequence includes: 1. Enumeration of IAM policies and tags 2. Creation of a tag binding 3. Performance of a privileged operation

MITRE ATT&CK coverage

TacticTechniques
Privilege EscalationT1548 Abuse Elevation Control Mechanism

Rule body yaml

AnalysisType: correlation_rule
RuleID: "GCP.Privilege.Escalation.Via.TagBinding"
DisplayName: "GCP Privilege Escalation via TagBinding"
Enabled: true
Severity: Info
Description: >
  Detects a sequence of events that could indicate a privilege escalation attempt
  via GCP's tag-based access control. The sequence includes:
  1. Enumeration of IAM policies and tags
  2. Creation of a tag binding
  3. Performance of a privileged operation
Reference: https://cloud.google.com/resource-manager/docs/tags/tags-overview
Runbook: >
  Verify if the user has legitimate business need for this sequence of operations.
  If unauthorized, revoke the tag binding and review IAM policies.
Reports:
    MITRE ATT&CK:
        - TA0004:T1548  # Abuse Elevation Control Mechanism
Detection:
    - Sequence:
        - ID: Enumeration
          RuleID: GCP.IAM.Tag.Enumeration
        - ID: TagBinding
          RuleID: GCP.Tag.Binding.Creation
        - ID: PrivilegedOperation
          RuleID: GCP.Privileged.Operation
      Transitions:
        - ID: Enumeration FOLLOWED BY TagBinding
          From: Enumeration
          To: TagBinding
          WithinTimeFrameMinutes: 15
          Match:
            - On: p_alert_context.principal
        - ID: TagBinding FOLLOWED BY PrivilegedOperation
          From: TagBinding
          To: PrivilegedOperation
          WithinTimeFrameMinutes: 15
          Match:
            - On: p_alert_context.principal
      Schedule:
        RateMinutes: 1440
        TimeoutMinutes: 10
      LookbackWindowMinutes: 2160
Tags:
    - attack.privilege_escalation
    - attack.t1548
    - gcp
    - iam
    - tagbinding
    - Beta
Tests:
    - Name: Complete Attack Sequence
      ExpectedResult: true
      RuleOutputs:
        - ID: Enumeration
          Matches:
            p_alert_context.principal:
              "test@example.com":
                - "2024-06-01T10:00:00Z"
        - ID: TagBinding
          Matches:
            p_alert_context.principal:
              "test@example.com":
                - "2024-06-01T10:00:05Z"
        - ID: PrivilegedOperation
          Matches:
            p_alert_context.principal:
              "test@example.com":
                - "2024-06-01T10:00:10Z"

    - Name: Incomplete Sequence
      ExpectedResult: false
      RuleOutputs:
        - ID: Enumeration
          Matches:
            p_alert_context.principal:
              "test@example.com":
                - "2024-06-01T10:00:00Z"
        - ID: PrivilegedOperation
          Matches:
            p_alert_context.principal:
              "test@example.com":
                - "2024-06-01T10:00:10Z" 

Detection logic

Stage 1: step Enumeration ordered before $TagBinding

References detection GCP.IAM.Tag.Enumeration.

Stage 2: step TagBinding ordered before $PrivilegedOperation ordered after $Enumeration

References detection GCP.Tag.Binding.Creation.

Stage 3: step PrivilegedOperation ordered after $TagBinding

References detection GCP.Privileged.Operation.