Elastic medium stable kql
Kubernetes Secret Get or List from Node or Pod Service Account
Kubernetes audit identities for kubelet (system:node:*) and workloads (system:serviceaccount:*) are meant to operate with tight, predictable API usage. Direct get or list on the Secrets API from those principals is often a sign of credential access. Attackers who stole a pod service-account token or node credentials sweep Secret objects for tokens, registry credentials, TLS keys, or application configuration. Even denied attempts still reveal intent to reach sensitive material. Legitimate controllers do read secrets they mount or manage, so this signal is most valuable when paired with triage (namespace scope, user agent, RBAC, and whether the identity should touch those secret names at all).
Detection Logic
data_stream.dataset:"kubernetes.audit_logs" and
event.action:(get or list) and
kubernetes.audit.objectRef.resource:"secrets" and
user.name:(system\:serviceaccount\:* or system\:node\:*) and source.ip:(* and not "127.0.0.1") and
not kubernetes.audit.user.groups:(
"system:serviceaccounts:flux-system"
or "system:serviceaccounts:kyverno"
or "system:serviceaccounts:ibm-csi"
or "system:serviceaccounts:harvester-system"
or "system:serviceaccounts:cattle-system"
or "system:serviceaccounts:cattle-monitoring-system"
or system\:serviceaccounts\:cluster-fleet-local-local-*
or "system:serviceaccounts:rabbitmq-system"
or "system:serviceaccounts:cattle-fleet-system"
) and
not (kubernetes.audit.user.username:"system:serviceaccount:security:trivy-operator" and kubernetes.audit.user.extra.authentication.kubernetes.io/pod-name :trivy-operator-*) and
not (kubernetes.audit.user.username:"system:serviceaccount:cert-manager:cert-manager-cainjector" and kubernetes.audit.user.extra.authentication.kubernetes.io/pod-name:cert-manager-cainjector-*) and
not (kubernetes.audit.user.username:"system:serviceaccount:monitoring:plat-central-monitoring-pr-operator" and kubernetes.audit.user.extra.authentication.kubernetes.io/pod-name:plat-central-monitoring-pr-operator*) and
not (kubernetes.audit.user.username:"system:serviceaccount:cert-manager:cert-manager" and kubernetes.audit.user.extra.authentication.kubernetes.io/pod-name:cert-manager-*) False Positives
- ⚠ In-cluster operators, CSI drivers, GitOps agents, and some platform controllers legitimately list or get Secrets in namespaces they manage; exclude known service accounts, namespaces, or user agents after baselining.
- ⚠ Rare kubelet or node maintenance tooling may touch Secret APIs; validate against change windows and approved node management paths.
Field Validations
Loading…
Comments (0)
Loading comments...