Lateral Movement (TA0008)(opens in a new tab or window)
file where host.os.type == "linux" and event.type != "deletion" and file.path like (
"/root/.kube/config",
"/home/*/.kube/config",
"/etc/kubernetes/admin.conf",
"/etc/kubernetes/super-admin.conf",
"/etc/kubernetes/kubelet.conf",
"/etc/kubernetes/controller-manager.conf",
"/etc/kubernetes/scheduler.conf",
"/var/lib/*/kubeconfig"
) and not (
process.name in ("kubeadm", "kubelet", "vcluster", "minikube") or
(process.name == "sed" and file.Ext.original.name like "sed*")
)
Install detection rules in Elastic Security
Detect Kubeconfig File Creation or Modification in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).