Techniques
Sample rules
Service Account Token or Certificate Access Followed by Kubernetes API Request
- source: elastic
- technicques:
- T1059
- T1552
- T1613
Description
This rule leverages a combination of Defend for Containers and Kubernetes audit logs to detect the access to the service account token or certificate followed by the execution of a direct interactive Kubernetes API request. An adversary may need to access the service account token or certificate to gain access to the Kubernetes API server or other resources within the cluster. These requests are often used to enumerate the Kubernetes API server or other resources within the cluster, and may indicate an attempt to move laterally within the cluster.
Detection logic
sequence with maxspan=60s
[file where host.os.type == "linux" and event.type == "change" and event.action == "open" and
file.path in ("/var/run/secrets/kubernetes.io/serviceaccount/token", "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt") and
process.interactive == true and container.id like "*"] by orchestrator.resource.name
[any where event.dataset == "kubernetes.audit_logs" and kubernetes.audit.stage in ("ResponseComplete", "ResponseStarted")] by `kubernetes.audit.user.extra.authentication.kubernetes.io/pod-name`