Threats

T1611, T1525, T1574.002

Container and Kubernetes Threats

A comprehensive guide to container and Kubernetes threats — container escape, RBAC abuse, admission controller bypass, pod security policy evasion, and supply chain attacks — and how analysts detect each.

View on Graph

What Makes Container Security Different

  • Containers share the host kernel — a container escape vulnerability compromises the entire host. Unlike VMs where each guest has its own kernel, a container breakout from any container affects all other containers on the same node.
  • Kubernetes adds a control plane layer (API server, etcd, kubelet) with its own authentication/authorization model (RBAC, ServiceAccounts, PodSecurity Policies) that has no equivalent in traditional infrastructure.
  • Traditional EDR agents often do not run inside containers. Detection requires runtime security tools (Falco, Aqua, Sysdig), Kubernetes audit logs, and container-aware threat detection.
  • MITRE ATT&CK maps container attacks to T1611 (Escape to Host), T1525 (Cloud Service Discovery), and T1574.002 (DLL Side-Loading / image hijack).

Container Escape

Container escape is the most severe container threat — an attacker breaks out of a container and gains access to the host operating system.

Escape Methods

MethodHow It WorksVulnerability Class
Kernel vulnerabilityExploit a kernel CVE (Dirty Pipe CVE-2022-0847, Dirty COW CVE-2016-5195) to escape the container’s namespace isolationKernel exploit
Capability abuseContainer with CAP_SYS_ADMIN or SYS_PTRACE can mount the host filesystem or attach to host processesMisconfiguration
Mount propagationContainer mounts a host path with mount propagation: bidirectional — changes in the container propagate to the hostMisconfiguration
--privileged containerA privileged container has all capabilities and can directly manipulate the host kernelMisconfiguration
cgroup escapeContainer with cgroup v1 access can write to release_agent to trigger host-side executionMisconfiguration or CVE
Container runtime CVEExploit in runc (CVE-2019-5736), containerd, or Docker (CVE-2018-15664)Runtime exploit

Detecting Privileged Containers

Kubernetes — find privileged pods:

# List all privileged containers in the cluster
kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.metadata.namespace} {.metadata.name} {.spec.containers[].securityContext.privileged}{"\n"}{end}' | grep true

Detection — Falco rule for privileged container:

- rule: Container with SYS_ADMIN Capability
  desc: Detect containers running with CAP_SYS_ADMIN (potential escape vector)
  condition: container and evt.type=clone and container.capabilities contains "SYS_ADMIN"
  output: "CAP_SYS_ADMIN container started (user=%user.name container=%container.id image=%container.image.repository)"
  priority: HIGH
  tags: [container, escape, misconfiguration]

Detection — Container Escape via Mount Namespace

SPL query — detect host filesystem mounts from unknown containers:

index=kubernetes sourcetype=kube_audit
| search verb=CREATE resource=pod
| select requestObject.spec.containers[].volumeMounts[].mountPath
| where requestObject.spec.containers[].volumeMounts[].mountPath = "/host" OR requestObject.spec.containers[].volumeMounts[].mountPath = "/var/run/docker.sock"
| eval alert = "Container mounting host filesystem — possible escape preparation"
| table _time, user.username, requestObject.metadata.name, requestObject.spec.containers[].volumeMounts, alert

Kubernetes RBAC Abuse

Kubernetes RBAC is the primary access control mechanism but is frequently misconfigured — granting more permissions than necessary.

Dangerous RBAC Permissions

PermissionWhat It AllowsRisk Level
cluster-admin (ClusterRoleBinding)Full admin access to the entire clusterCritical — should never be granted to a user or pod
* on all resourcesAbility to create, read, update, delete any resourceCritical
create pods/execAbility to execute commands in any podCritical — equivalent to root on every pod
get secrets (across all namespaces)Read all secrets including service account tokensCritical
create deployments + delete deploymentsAbility to create/deploy arbitrary workloadsHigh
list podsEnumeration of all running podsMedium — reconnaissance
get nodesInformation gathering about cluster nodesMedium
get eventsRead cluster events (may reveal sensitive info)Low

Detection — Overly Permissive Roles

Kubernetes audit log — detect cluster-admin grants:

index=kubernetes sourcetype=kube_audit
| search verb=CREATE OR verb=UPDATE resource=clusterrolebindings
| where requestObject.roleRef.name = "cluster-admin"
| eval alert = "Cluster-admin binding created by " . user.username
| table _time, user.username, sourceIPs, requestObject.subjects, alert

KQL — detect pods creating other pods (RBAC abuse from compromised service account):

KubernetesAuditLogs
| where OperationName == "CREATE"
| where Resource == "pods"
| where User.Username != "system:kube-controller-manager" and User.Username != "system:node:*"
| extend PodCreator = User.Username
| summarize PodsCreated = count() by PodCreator, bin(TimeGenerated, 1h)
| where PodsCreated > 5
| project TimeGenerated, PodCreator, PodsCreated

Admission Controller Bypass

Admission controllers (PodSecurityPolicy, OPA/Gatekeeper, Kyverno) enforce security policies before pods are created. Attackers try to bypass them.

Bypass Techniques

TechniqueHow It WorksHow to Detect
Privileged namespaceCreate pods in a namespace that has lax admission policiesAudit log — pod creation in non-standard namespace with privileged fields
Mutating webhook evasionCraft a pod spec that avoids the mutating webhook’s pattern (e.g., set runAsUser: 0 explicitly before webhook sets it to non-root)Compare pod spec before and after webhook mutation
CRD abuseCreate a Custom Resource that triggers a controller to create pods without passing through admissionMonitor controller create operations
Static pod creationPlace pod manifest in /etc/kubernetes/manifests/ on a node — bypasses API server entirelyNode-level file monitoring — extremely difficult to detect centrally
Direct kubelet API accessIf the kubelet read-only port (10250) is exposed, an attacker can create pods directly without API server admission controlNetwork monitoring — direct connections to node port 10250

Detection — Direct Kubelet API Access

index=network sourcetype=firewall_log
| search dest_port=10250 AND dest_ip=10.96.0.0/12 (kubernetes pod CIDR)
| stats count by src_ip, dest_ip, dest_port, bin(_time, 5m)
| where count > 3
| eval alert = "Direct kubelet API access from " . src_ip . " — possible admission controller bypass"
| table _time, src_ip, dest_ip, dest_port, count, alert

Pod Security Policy Evasion

Pod Security Policies (PSPs are deprecated; Pod Security Admission is the replacement) enforce constraints on pod security contexts. Attackers evade them to run privileged containers.

Common Evasion Patterns

EvasionWhat the Attacker DoesDetection
runAsUser: 0Explicitly set the user to root (bypasses non-root constraint)Audit log — container with runAsUser: 0
allowPrivilegeEscalation: trueAllows the container process to gain more privileges than its parentPod spec in audit logs — allowPrivilegeEscalation: true
Host networkingUse hostNetwork: true to bypass network policiesPod spec — hostNetwork: true
HostPID / HostIPCUse hostPID: true to see all host processesPod spec — hostPID: true or hostIPC: true
seccomp disabledRun without seccomp profile, enabling syscalls that should be filteredFalco — syscall denied by default seccomp but executed in container

Container Supply Chain Attacks

Attackers compromise the container image supply chain by injecting malicious code into base images, registry images, or CI/CD pipelines.

Attack Vectors

VectorExampleDetection
Malicious base imageTyposquatted image: node vs n0de, or upstream image compromiseImage hash verification, vulnerability scanning (Trivy, Grype)
Dependency confusionPackage name that exists in both public and private registries — attacker uploads a malicious version to the public registryLock file verification, private registry mirror configuration
Build pipeline compromiseAttacker modifies Dockerfile or CI pipeline to add malicious layerCI/CD audit logs, artifact hash verification
Registry compromiseAttacker pushes malicious image to public or private registryRegistry audit logs, image signing (Cosign, Notary)
Sidecar injection via admission controllerAttacker modifies a mutating webhook to inject a sidecar container into every podWebhook configuration change audit

Detection — Image Scan Results

index=kubernetes sourcetype=image_scan
| search vulnerability_critical > 0 OR vulnerability_high > 0
| stats sum(vulnerability_critical) as critical, sum(vulnerability_high) as high by image, repository
| where critical > 0
| eval alert = "Image " . image . " has " . critical . " critical vulnerabilities"
| sort - critical
| table image, repository, critical, high, alert

Kubernetes Threat Reference Table

Threat CategoryDetection SourceKey SignalsMITRE Reference
Container escapeFalco, Sysdig, host-level EDRCAP_SYS_ADMIN, privileged container, mount propagation, runc CVE exploitationT1611
RBAC abuseKubernetes audit logsCluster-admin binding, pod/exec permissions, secrets read from unusual usersT1078
Admission controller bypassKubernetes audit logs, webhook logsPod specs bypassing constraints, direct kubelet API accessT1610
Pod security policy evasionKubernetes audit logs, FalcorunAsUser: 0, hostNetwork: true, allowPrivilegeEscalationT1610
Supply chain attackImage scanning, Sigstore, CI/CD audit logsMalicious image, dependency confusion, unsigned imageT1195
Service account token theftKubernetes audit logs, container runtimeMounted service account token from unexpected pod, pod enumerationT1528
K8s data plane attackKubernetes audit logs, network logsUnauthorized get secrets, list pods across namespacesT1078.004

Sources