Detection rules › Panther

GCP K8s Pod Attached To Node Host Network

Status
Deprecated
Severity
medium
Group by
protoPayload.authenticationInfo.principalEmail
Log types
GCP.AuditLog
Tags
Deprecated, GCP, Optional
Reference
https://medium.com/snowflake/from-logs-to-detection-using-snowflake-and-panther-to-detect-k8s-threats-d72f70a504d7
Source
github.com/panther-labs/panther-analysis

This detection monitor for the creation of pods which are attached to the host's network. This allows a pod to listen to all network traffic for all deployed computer on that particular node and communicate with other compute on the network namespace. Attackers can use this to capture secrets passed in arguments or connections.

MITRE ATT&CK coverage

TacticTechniques
Privilege EscalationT1611 Escape to Host

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body yaml

AnalysisType: rule
RuleID: "GCP.K8s.Pod.Attached.To.Node.Host.Network"
DisplayName: "GCP K8s Pod Attached To Node Host Network"
Enabled: false
Status: Deprecated
Filename: gcp_k8s_pod_attached_to_node_host_network.py
LogTypes:
  - GCP.AuditLog
Tags:
  - Deprecated
  - GCP
  - Optional
Severity: Medium
Description:
  This detection monitor for the creation of pods which are attached to the host's network.
  This allows a pod to listen to all network traffic for all deployed computer on that particular node and
  communicate with other compute on the network namespace. Attackers can use this to capture secrets passed in
  arguments or connections.
Reports:
  MITRE ATT&CK:
    - TA0004:T1611 # Escape to Host
Runbook:
  Investigate a reason of creating a pod which is attached to the host's network. Advise that it is discouraged
  practice. Create ticket if appropriate.
Reference: https://medium.com/snowflake/from-logs-to-detection-using-snowflake-and-panther-to-detect-k8s-threats-d72f70a504d7
Tests:
  - Name: triggers
    ExpectedResult: true
    Log:
      {
        "authorizationInfo":
          [
            {
              "granted": true,
              "permission": "io.k8s.core.v1.pods.create",
              "resource": "core/v1/namespaces/default/pods/nginx-test",
            },
          ],
        "protoPayload":
          {
            "methodName": "io.k8s.core.v1.pods.create",
            "request": { "spec": { "hostNetwork": true } },
          },
      }
  - Name: ignore
    ExpectedResult: false
    Log:
      {
        "authorizationInfo":
          [
            {
              "granted": true,
              "permission": "io.k8s.core.v1.pods.create",
              "resource": "core/v1/namespaces/default/pods/nginx-test",
            },
          ],
        "protoPayload":
          {
            "methodName": "io.k8s.core.v1.pods.create",
            "request": { "spec": { "hostNetwork": false } },
          },
      }

Detection logic

Condition

protoPayload.methodName in ["io.k8s.core.v1.pods.create", "io.k8s.core.v1.pods.update", "io.k8s.core.v1.pods.patch"]
protoPayload.request.spec.hostNetwork eq "True"
not (protoPayload.authenticationInfo.principalEmail is_not_null and (protoPayload.authenticationInfo.principalEmail starts_with "system:kube-controller-manager" or protoPayload.authenticationInfo.principalEmail starts_with "system:kube-scheduler" or protoPayload.authenticationInfo.principalEmail starts_with "system:addon-manager" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-public:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:kube-node-lease:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gke-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gke-managed-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gmp-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:gmp-public:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:config-management-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:istio-system:" or protoPayload.authenticationInfo.principalEmail starts_with "system:serviceaccount:asm-system:"))
protoPayload.resourceName not is_not_null

This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
protoPayload.authenticationInfo.principalEmailstarts_withsystem:addon-manager
protoPayload.authenticationInfo.principalEmailstarts_withsystem:kube-controller-manager
protoPayload.authenticationInfo.principalEmailstarts_withsystem:kube-scheduler
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:asm-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:config-management-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:gke-managed-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:gke-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:gmp-public:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:gmp-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:istio-system:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:kube-node-lease:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:kube-public:
protoPayload.authenticationInfo.principalEmailstarts_withsystem:serviceaccount:kube-system:
protoPayload.authenticationInfo.principalEmailis_not_null(no value, null check)
protoPayload.resourceNameis_not_null(no value, null check)

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
protoPayload.methodNamein
  • io.k8s.core.v1.pods.create
  • io.k8s.core.v1.pods.patch
  • io.k8s.core.v1.pods.update
protoPayload.request.spec.hostNetworkeq
  • True

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
projectresource.labels.project_id
principalprotoPayload.authenticationInfo.principalEmail
caller_ipprotoPayload.requestMetadata.callerIP
methodNameprotoPayload.methodName
resourceNameprotoPayload.resourceName
serviceNameprotoPayload.serviceName