Detection rules › Elastic
Kubernetes 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.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1610 Deploy Container |
| Privilege Escalation | T1611 Escape to Host |
Event coverage
| Provider | Event | Title |
|---|---|---|
| Kubernetes-pods | create-pods | create pods |
Rules detecting the same action
Other rules on this platform that filter on the same API call or operation.
- Container With A hostPath Mount Created (Sigma)
- Creation Of Pod In System Namespace (Sigma)
- Kubernetes Anonymous User Create/Update/Patch Pods Request (Elastic)
- Kubernetes Create or Update Privileged Pod (Splunk)
- Kubernetes Pod Created in Default Namespace (Splunk)
- Kubernetes Pod Created with a Sensitive hostPath Volume (Elastic)
- Kubernetes Pod Created With HostIPC (Elastic)
- Kubernetes Pod Created With HostNetwork (Elastic)
Rule body elastic
[metadata]
creation_date = "2022/09/20"
integration = ["kubernetes"]
maturity = "production"
updated_date = "2026/04/10"
[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,
kubernetes.audit.requestObject.spec.containers.image.
""",
]
index = ["logs-kubernetes.audit_logs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Kubernetes Container Created with Excessive Linux Capabilities"
note = """## Triage and analysis
### Investigating Kubernetes 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.
### 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, kubernetes.audit.requestObject.spec.containers.image.
## Setup
The Kubernetes Fleet integration with Audit Logs enabled or similarly structured data is required to be compatible with this rule."""
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 = "7164081a-3930-11ed-a261-0242ac120002"
severity = "medium"
tags = [
"Data Source: Kubernetes",
"Domain: Kubernetes",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: kubernetes.audit_logs and kubernetes.audit.annotations.authorization_k8s_io/decision:"allow" and
kubernetes.audit.verb: create and kubernetes.audit.objectRef.resource: pods and
kubernetes.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 (
kubernetes.audit.requestObject.spec.containers.image : (docker.elastic.co/beats/elastic-agent* or rancher/klipper-lb* or "") or
kubernetes.audit.objectRef.namespace:"kube-system" or
(kubernetes.audit.objectRef.namespace:datadog and kubernetes.audit.requestObject.spec.containers.image:*datadog-agent*) or
(kubernetes.audit.objectRef.namespace:kubearmor and kubernetes.audit.requestObject.spec.containers.image:(*kubearmor\:kubearmor* or kubearmor/kubearmor-snitch*)) or
(kubernetes.audit.objectRef.namespace:defender and kubernetes.audit.requestObject.spec.containers.image:*fp-prisma\:defender-defender*) or
(kubernetes.audit.objectRef.namespace:metallb-system and kubernetes.audit.requestObject.spec.containers.image:(quay.io/frrouting* or quay.io/metallb/speaker*)) or
(kubernetes.audit.objectRef.namespace:longhorn-system and kubernetes.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/"
Stages and Predicates
Stage 1: query
data_stream.dataset: kubernetes.audit_logs and kubernetes.audit.annotations.authorization_k8s_io/decision:"allow" and
kubernetes.audit.verb: create and kubernetes.audit.objectRef.resource: pods and
kubernetes.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 (
kubernetes.audit.requestObject.spec.containers.image : (docker.elastic.co/beats/elastic-agent* or rancher/klipper-lb* or "") or
kubernetes.audit.objectRef.namespace:"kube-system" or
(kubernetes.audit.objectRef.namespace:datadog and kubernetes.audit.requestObject.spec.containers.image:*datadog-agent*) or
(kubernetes.audit.objectRef.namespace:kubearmor and kubernetes.audit.requestObject.spec.containers.image:(*kubearmor\:kubearmor* or kubearmor/kubearmor-snitch*)) or
(kubernetes.audit.objectRef.namespace:defender and kubernetes.audit.requestObject.spec.containers.image:*fp-prisma\:defender-defender*) or
(kubernetes.audit.objectRef.namespace:metallb-system and kubernetes.audit.requestObject.spec.containers.image:(quay.io/frrouting* or quay.io/metallb/speaker*)) or
(kubernetes.audit.objectRef.namespace:longhorn-system and kubernetes.audit.requestObject.spec.containers.image:rancher/mirrored-longhornio*)
)
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
kubernetes.audit.requestObject.spec.containers.image | match | kubearmor\:kubearmor |
kubernetes.audit.requestObject.spec.containers.image | starts_with | kubearmor/kubearmor-snitch |
kubernetes.audit.objectRef.namespace | eq | kubearmor |
kubernetes.audit.requestObject.spec.containers.image | starts_with | quay.io/frrouting |
kubernetes.audit.requestObject.spec.containers.image | starts_with | quay.io/metallb/speaker |
kubernetes.audit.objectRef.namespace | eq | metallb-system |
kubernetes.audit.objectRef.namespace | eq | datadog |
kubernetes.audit.requestObject.spec.containers.image | match | datadog-agent |
kubernetes.audit.objectRef.namespace | eq | defender |
kubernetes.audit.requestObject.spec.containers.image | match | fp-prisma\:defender-defender |
kubernetes.audit.objectRef.namespace | eq | longhorn-system |
kubernetes.audit.requestObject.spec.containers.image | starts_with | rancher/mirrored-longhornio |
kubernetes.audit.objectRef.namespace | eq | kube-system |
kubernetes.audit.requestObject.spec.containers.image | starts_with | docker.elastic.co/beats/elastic-agent |
kubernetes.audit.requestObject.spec.containers.image | starts_with | rancher/klipper-lb |
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
data_stream.dataset | eq |
|
kubernetes.audit.annotations.authorization_k8s_io/decision | eq |
|
kubernetes.audit.objectRef.resource | eq |
|
kubernetes.audit.requestObject.spec.containers.securityContext.capabilities.add | in |
|
kubernetes.audit.verb | eq |
|