Elastic medium stable kql

AWS EKS Container Created with Excessive Linux Capabilities

This rule detects a container deployed with one or more dangerously permissive Linux capabilities. An attacker with the ability to deploy a container with added capabilities could use this for further execution, lateral movement, or privilege escalation within a cluster. The capabilities detected in this rule have been used in container escapes to the host machine.

View Source

Detection Logic

data_stream.dataset: aws.eks_audit and aws.eks.audit.annotations.authorization_k8s_io/decision:"allow" and
aws.eks.audit.verb: create and aws.eks.audit.objectRef.resource: pods and
aws.eks.audit.requestObject.spec.containers.securityContext.capabilities.add: ("BPF" or "DAC_READ_SEARCH"  or "NET_ADMIN" or "SYS_ADMIN" or "SYS_BOOT" or "SYS_MODULE" or "SYS_PTRACE" or "SYS_RAWIO"  or "SYSLOG") and
not (
  aws.eks.audit.requestObject.spec.containers.image : (docker.elastic.co/beats/elastic-agent* or "") or
  aws.eks.audit.objectRef.namespace:"kube-system" or
  (aws.eks.audit.objectRef.namespace:datadog and aws.eks.audit.requestObject.spec.containers.image:*datadog-agent*) or
  (aws.eks.audit.objectRef.namespace:kubearmor and aws.eks.audit.requestObject.spec.containers.image:(*kubearmor\:kubearmor* or kubearmor/kubearmor-snitch*)) or
  (aws.eks.audit.objectRef.namespace:defender and aws.eks.audit.requestObject.spec.containers.image:*fp-prisma\:defender-defender*) or
  (aws.eks.audit.objectRef.namespace:metallb-system and aws.eks.audit.requestObject.spec.containers.image:(quay.io/frrouting* or quay.io/metallb/speaker*)) or
  (aws.eks.audit.objectRef.namespace:longhorn-system and aws.eks.audit.requestObject.spec.containers.image:rancher/mirrored-longhornio*)
)

False Positives

  • ⚠ Some container images require the addition of privileged capabilities. This rule leaves space for the exception of trusted container images. To add an exception, add the trusted container image name to the query field, aws.eks.audit.requestObject.spec.containers.image.

Field Validations

Loading…

Comments (0)

Loading comments...