Execution (TA0002)(external, opens in a new tab or window)
Credential Access (TA0006)(external, opens in a new tab or window)
text code block: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`
Install detection rules in Elastic Security
Detect Service Account Token or Certificate Access Followed by Kubernetes API Request 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(external, opens in a new tab or window).