Detection Library
highexperimentalKubernetesCloudT1609T1021

Exec or Attach Into Running Pod

Detects kubectl exec/attach requests into a running pod via the Kubernetes API audit log subresource, with emphasis on exec into pods that are privileged or owned by a different team than the requesting principal -- a common post-compromise lateral movement and discovery step.

Updated Oct 29, 2026 · Detection Engineering Team

kubernetescontainerskubectl-execlateral-movement

Problem Statement

kubectl exec is a routine operational action, which is exactly why it's a high-value blind spot: an attacker who compromises a developer's kubeconfig or a CI service account with broad exec RBAC can use it to pivot into any pod they have permission to reach, often to steal mounted secrets or pivot further.

Sample Logs

{"kind":"Event","verb":"create","objectRef":{"resource":"pods","subresource":"exec","namespace":"payments","name":"api-7d9f-x2k4"},"user":{"username":"jdoe@company.com"},"requestURI":"/api/v1/namespaces/payments/pods/api-7d9f-x2k4/exec?command=/bin/sh","stageTimestamp":"2026-10-29T14:22:07Z"}

Required Fields

verb
objectRef.resource
objectRef.subresource
objectRef.namespace
objectRef.name
user.username

False Positives

  • ·Legitimate production debugging by on-call engineers (correlate with incident/change tickets to suppress)
  • ·CI/CD health-check or migration-runner steps that exec into pods as part of normal deployment

Tuning Guidance

Score severity up when the exec target is a pod with a privileged security context, mounts a service account token with broad RBAC, or sits in a namespace the requesting user has no prior exec history in. Score down (but still log) for break-glass accounts during declared incidents.