Elastic medium stable kql
AWS EKS Pod Created With HostPID
This rule detects an attempt to create or modify a pod attached to the host PID namespace. HostPID allows a pod to access all the processes running on the host and could allow an attacker to take malicious action. When paired with ptrace this can be used to escalate privileges outside of the container. When paired with a privileged container, the pod can see all of the processes on the host. An attacker can enter the init system (PID 1) on the host. From there, they could execute a shell and continue to escalate privileges to root.
Detection Logic
data_stream.dataset : "aws.eks_audit" and aws.eks.audit.annotations.authorization_k8s_io/decision:"allow" and
aws.eks.audit.objectRef.resource:"pods" and aws.eks.audit.verb:("create" or "update" or "patch") and
aws.eks.audit.requestObject.spec.hostPID:true and
not aws.eks.audit.requestObject.spec.containers.image: (
ghcr.io/aquasecurity/node-collector* or rancher/system-agent* or ghcr.io/kubereboot/kured* or
*elastic/elastic-agent* or registry.k8s.io/sig-storage/csi-node-driver-registrar* or quay.io/prometheus/node-exporter* or
docker.elastic.co/beats/elastic-agent* or quay.io/cephcsi/cephcsi* or registry.crowdstrike.com/falcon-sensor* or */sysdig/* or
rancher/mirrored-longhornio-longhorn-manager* or gcr.io/datadoghq/agent*
) False Positives
- ⚠ An administrator or developer may want to use a pod that runs as root and shares the hosts IPC, Network, and PID namespaces for debugging purposes. If something is going wrong in the cluster and there is no easy way to SSH onto the host nodes directly, a privileged pod of this nature can be useful for viewing things like iptable rules and network namespaces from the host's perspective. Add exceptions for trusted container images using the query field "aws.eks.audit.requestObject.spec.container.image"
Field Validations
Loading…
Comments (0)
Loading comments...