AWS EKS Container Created with Excessive Linux Capabilities


Description

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.

Query · kuery

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*)
)

Implementation guide

This rule reads EKS control-plane audit logs collected by the AWS integration into logs-aws.eks_audit-*, where the AWS EKS audit ingest pipelines normalize each audit record under aws.eks.audit.*.

Enable the audit control-plane log type on the EKS cluster, send its CloudWatch log group through the AWS integration, and confirm events carry data_stream.dataset: aws.eks_audit and cloud.provider: aws before enabling this rule.

Known 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.

Analyst notes

Investigating AWS EKS Container Created with Excessive Linux Capabilities

Linux capabilities were designed to divide root privileges into smaller units. Each capability grants a thread just enough power to perform specific privileged tasks. In Kubernetes, containers are given a set of default capabilities that can be dropped or added to at the time of creation. Added capabilities entitle containers in a pod with additional privileges that can be used to change core processes, change network settings of a cluster, or directly access the underlying host. The following have been used in container escape techniques:

BPF - Allow creating BPF maps, loading BPF Type Format (BTF) data, retrieve JITed code of BPF programs, and more. DAC_READ_SEARCH - Bypass file read permission checks and directory read and execute permission checks. NET_ADMIN - Perform various network-related operations. SYS_ADMIN - Perform a range of system administration operations. SYS_BOOT - Use reboot(2) and kexec_load(2), reboot and load a new kernel for later execution. SYS_MODULE - Load and unload kernel modules. SYS_PTRACE - Trace arbitrary processes using ptrace(2). SYS_RAWIO - Perform I/O port operations (iopl(2) and ioperm(2)). SYSLOG - Perform privileged syslog(2) operations.

Possible investigation steps

  • Identify the principal that created the pod via user.name, aws.eks.audit.user.groups, source.ip, and user_agent.original, and determine whether it is a human operator, a CI/CD pipeline, or a controller such as a Deployment or DaemonSet acting on behalf of a workload owner.
  • Review aws.eks.audit.requestObject.spec.containers.image and aws.eks.audit.requestObject.spec.containers.securityContext.capabilities.add to establish which image requested which capabilities, and whether the image comes from a trusted registry and tag.
  • Inspect the rest of the pod spec in aws.eks.audit.requestObject.spec for other escape primitives that often accompany added capabilities, such as privileged: true, hostPID, hostNetwork, hostIPC, or sensitive hostPath volumes.
  • Check aws.eks.audit.objectRef.namespace and the owning workload (ownerReferences) to understand whether the pod belongs to an expected security, networking, or storage agent, or was created ad hoc in an application namespace.
  • Correlate with surrounding audit events from the same identity, such as pod exec, secret reads, TokenRequest, or RBAC changes, and with host telemetry from the node for signs of container breakout.

False positive analysis

  • While these capabilities are not included by default in containers, some legitimate images may need to add them. 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.
  • Networking, storage, observability, and runtime-security agents (CNI plugins, eBPF-based tooling, CSI drivers, load balancer speakers) commonly require NET_ADMIN, SYS_ADMIN, BPF, or SYS_PTRACE. Confirm the image and namespace match the deployed agent and add a scoped exception on namespace plus image rather than on the capability alone.

Response and remediation

  • If the pod is not an approved workload, delete it and scale down or delete the owning controller so it is not recreated, then review the node it was scheduled on for signs of container escape or host modification.
  • Revoke or tighten RBAC that allows the creating identity to create pods with added capabilities, and rotate credentials for that identity if the request looks unauthorized.
  • Enforce Pod Security Admission (baseline or restricted) or an admission policy that restricts capabilities.add to an allowlist, scoped to namespaces where privileged agents are expected.
  • If evidence of breakout is found, isolate and rebuild the affected node, rotate node and workload credentials, and engage incident response per policy.
  • Add any confirmed-legitimate images to the rule exceptions, scoped by namespace and image, to keep the rule high-signal.
Raw source AWS EKS Container Created with Excessive Linux Capabilities · Elastic TOML
Esc
Published by elastic/detection-rules ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[metadata]
creation_date = "2026/08/03"
integration = ["aws"]
maturity = "production"
min_stack_comments = "The AWS integration adds the aws.eks_audit data stream in package 8.9.0, which requires Kibana 9.6.0 or later."
min_stack_version = "9.6.0"
updated_date = "2026/10/21"

[rule]
author = ["Elastic"]
description = """
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.
"""
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.
    """,
]
from = "now-6m"
index = ["logs-aws.eks_audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EKS Container Created with Excessive Linux Capabilities"
note = """## Triage and analysis

### Investigating AWS EKS Container Created with Excessive Linux Capabilities
Linux capabilities were designed to divide root privileges into smaller units. Each capability grants a thread just enough power to perform specific privileged tasks. In Kubernetes, containers are given a set of default capabilities that can be dropped or added to at the time of creation. Added capabilities entitle containers in a pod with additional privileges that can be used to change
core processes, change network settings of a cluster, or directly access the underlying host. The following have been used in container escape techniques:

BPF - Allow creating BPF maps, loading BPF Type Format (BTF) data, retrieve JITed code of BPF programs, and more.
DAC_READ_SEARCH - Bypass file read permission checks and directory read and execute permission checks.
NET_ADMIN - Perform various network-related operations.
SYS_ADMIN - Perform a range of system administration operations.
SYS_BOOT - Use reboot(2) and kexec_load(2), reboot and load a new kernel for later execution.
SYS_MODULE - Load and unload kernel modules.
SYS_PTRACE - Trace arbitrary processes using ptrace(2).
SYS_RAWIO - Perform I/O port operations (iopl(2) and ioperm(2)).
SYSLOG - Perform privileged syslog(2) operations.

### Possible investigation steps

- Identify the principal that created the pod via user.name, aws.eks.audit.user.groups, source.ip, and user_agent.original, and determine whether it is a human operator, a CI/CD pipeline, or a controller such as a Deployment or DaemonSet acting on behalf of a workload owner.
- Review aws.eks.audit.requestObject.spec.containers.image and aws.eks.audit.requestObject.spec.containers.securityContext.capabilities.add to establish which image requested which capabilities, and whether the image comes from a trusted registry and tag.
- Inspect the rest of the pod spec in aws.eks.audit.requestObject.spec for other escape primitives that often accompany added capabilities, such as privileged: true, hostPID, hostNetwork, hostIPC, or sensitive hostPath volumes.
- Check aws.eks.audit.objectRef.namespace and the owning workload (ownerReferences) to understand whether the pod belongs to an expected security, networking, or storage agent, or was created ad hoc in an application namespace.
- Correlate with surrounding audit events from the same identity, such as pod exec, secret reads, TokenRequest, or RBAC changes, and with host telemetry from the node for signs of container breakout.

### False positive analysis

- While these capabilities are not included by default in containers, some legitimate images may need to add them. 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.
- Networking, storage, observability, and runtime-security agents (CNI plugins, eBPF-based tooling, CSI drivers, load balancer speakers) commonly require NET_ADMIN, SYS_ADMIN, BPF, or SYS_PTRACE. Confirm the image and namespace match the deployed agent and add a scoped exception on namespace plus image rather than on the capability alone.

### Response and remediation

- If the pod is not an approved workload, delete it and scale down or delete the owning controller so it is not recreated, then review the node it was scheduled on for signs of container escape or host modification.
- Revoke or tighten RBAC that allows the creating identity to create pods with added capabilities, and rotate credentials for that identity if the request looks unauthorized.
- Enforce Pod Security Admission (baseline or restricted) or an admission policy that restricts capabilities.add to an allowlist, scoped to namespaces where privileged agents are expected.
- If evidence of breakout is found, isolate and rebuild the affected node, rotate node and workload credentials, and engage incident response per policy.
- Add any confirmed-legitimate images to the rule exceptions, scoped by namespace and image, to keep the rule high-signal."""
references = [
    "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-capabilities-for-a-container",
    "https://0xn3va.gitbook.io/cheat-sheets/container/escaping/excessive-capabilities",
    "https://man7.org/linux/man-pages/man7/capabilities.7.html",
    "https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities",
]
risk_score = 47
rule_id = "264a1d7c-be1b-57c2-a9b4-ec90559e2f68"
setup = """This rule reads EKS control-plane audit logs collected by the AWS integration
into `logs-aws.eks_audit-*`, where the AWS EKS audit ingest
pipelines normalize each audit record under `aws.eks.audit.*`.

Enable the `audit` control-plane log type on the EKS cluster, send its
CloudWatch log group through the AWS integration, and confirm events carry
`data_stream.dataset: aws.eks_audit` and
`cloud.provider: aws` before enabling this rule.
"""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Containers",
    "Platform: AWS",
    "Platform: Kubernetes",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: Kubernetes API Server Audit Logs",
    "Service: AWS EKS",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Tactic: Privilege Escalation",
    "Tactic: Defense Evasion",
    "Rule Type: Custom Query (KQL)",
    "Threat: Container Escape",
    "Resources: Investigation Guide",
    "Profile: Beta",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
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*)
)
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1611"
name = "Escape to Host"
reference = "https://attack.mitre.org/techniques/T1611/"


[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1610"
name = "Deploy Container"
reference = "https://attack.mitre.org/techniques/T1610/"


[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1610"
name = "Deploy Container"
reference = "https://attack.mitre.org/techniques/T1610/"


[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.