Elastic medium stable kql

GKE Ephemeral Container Added to Pod

Detects allowed updates or patches to the pods/ephemeralcontainers subresource on GKE by a non-system identity. Ephemeral containers are commonly used for debugging (kubectl debug) but can also be abused to inject tooling into a running pod, access mounted secrets, and execute commands in the target pod context. Attackers with sufficient RBAC may use ephemeral containers to escalate privileges, move laterally, or establish persistence without deploying a new workload.

View Source

Detection Logic

data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and
event.action:(
  "io.k8s.core.v1.pods.ephemeralcontainers.update" or
  "io.k8s.core.v1.pods.ephemeralcontainers.patch"
) and not client.user.email:(
  system\:node\:* or
  system\:serviceaccount\:kube-system\:*
)

False Positives

  • ⚠ Cluster operators or SREs may legitimately use ephemeral containers for debugging production workloads. Baseline approved admin identities and tune exclusions for known automation.

Field Validations

Loading…

Comments (0)

Loading comments...