← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Privileged Container HostPID Escape Dataset

This hunt uses a simulated Kubernetes audit and node-level auditd dataset (k8s_hostpid_escape_2022-12-04T101500.json) capturing T1611: Escape to Host, where a pod deployed with hostPID: true and elevated capabilities enumerates and interacts with host-namespace processes via /proc/<pid>/root or nsenter, breaking container isolation to execute commands directly on the underlying node.

Step 1: Hypothesis Formation

Hypothesis: A pod is created with hostPID: true and/or privileged: true in its security context, and its container process subsequently accesses /proc/1/root/ (the host's root filesystem as seen through PID 1) or invokes nsenter targeting a host PID, indicating deliberate container-escape activity rather than a legitimate need for host-process visibility. Indicators:

Null Hypothesis: The pod is an approved node-monitoring or logging DaemonSet (e.g., Falco, Datadog agent, node-exporter) that legitimately requires hostPID to observe host-level processes as part of its documented function. Invalidate by checking the pod's namespace/service-account against the approved privileged-workload inventory.

Rationale: hostPID/privileged pods are sometimes legitimately required for infrastructure tooling, so the presence of the capability alone is not sufficient evidence of compromise; the decisive signal is the container process actually using that capability to traverse into the host's process/filesystem namespace via /proc/1/root or nsenter, which has no purpose other than breaking out of the container boundary.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (5 shown) confirm a pod named to resemble a debugging utility was deployed with hostPID: true and SYS_ADMIN capability in the default namespace (not an approved system namespace), and its container process used nsenter to obtain a root shell on the underlying node.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-12-04 10:15:03k8s-api-serverK8s Audit Logverb=create, pod=debug-tools-7f9c, namespace=default, spec.hostPID=true, capabilities.add=["SYS_ADMIN"]Configuration IOC: this combination of hostPID and SYS_ADMIN in the unrestricted default namespace, rather than a controlled system namespace, has no legitimate application justification and directly enables host-namespace traversal.
2022-12-04 10:15:03k8s-api-server(Admission-controller check)Pod is not covered by any entry in the approved-privileged-workload exception listUnauthorized-Privilege IOC: no policy exception authorizes this specific pod/namespace combination for privileged/hostPID access.
2022-12-04 10:16:18node-worker-14Falco (Runtime Alert)Rule Launch Privileged Container triggered for container debug-tools-7f9cRuntime-Confirmation IOC: independent runtime telemetry corroborates the privileged configuration was actively used, not merely declared.
2022-12-04 10:16:41node-worker-14auditd (execve)nsenter --target 1 --mount --uts --ipc --net --pid -- /bin/bash executed inside the container's process namespaceEscape-Execution IOC: this is the canonical container-escape command, using PID 1 (the host's init process) as the namespace target to obtain a full host-context shell.
2022-12-04 10:16:42node-worker-14auditd (execve)Resulting shell executed cat /etc/shadow and id - output showed uid=0(root) in the host's namespaceImpact Confirmation: successful read of the host's shadow file and root UID confirms full container-escape to host-level root access was achieved.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - an unauthorized privileged pod deployed with hostPID and SYS_ADMIN in the default namespace used nsenter to escape into the underlying node's namespace, confirming full host-root access!