Sources indicate that kubernetes abstracts away infrastructure, but it does not abstract away risk. A single compromised pod can be used to escalate to cluster-admin, pivot across namespaces, steal cloud credentials, and establish persistent access, all within minutes.
Recent findings suggest that securing a Kubernetes cluster is not a single-pane problem. The control plane tells you who made an API call, but not what actually executed inside the container. Runtime telemetry shows you what ran but not whether the identity behind it was legitimate.
Comprehensive visibility and threat detection across Kubernetes components requires monitoring the entire software lifecycle across four layers: code, container, cluster, and cloud (the "4Cs"). Together those layers yield a defensible incident picture when their telemetry is correlated: audit logs for API-level accountability, sensor telemetry for runtime truth, asset and admission data for structural context, and cloud activity logs for blast radius beyond the cluster.
In this post, we walk through a real-world attack scenario on a Kubernetes cluster, from the initial detection through lateral movement, privilege escalation, persistence, and credential theft, to demonstrate how each data source answers questions the others cannot.
At 15:14 UTC, a CrowdStrike Falcon® Cloud Security newly released Kubernetes audit log detection fires on a Kubernetes cluster demo-cluster. An identity associated with a pod in one namespace uses kubectl to exec into a pod in another namespace.
Recent findings suggest that this post follows the investigation as an analyst would work it: starting from the detection, scoping the blast radius, then pulling each thread to its conclusion. By using visibility across the CrowdStrike Falcon® platform, we can piece together the entire incident story, moving deliberately between data sources based on what we've learned:.
The Falcon console demonstrates a detection at 15:14:43 UTC:.
"Exec into a pod from inside a pod using an over-permissive service account token".
In Kubernetes terms: An identity associated with a pod uses an exec API call to open a shell inside a different pod. This is a lateral movement event, and it is typically unusual for a service account to perform exec API calls.
Looking at the detection details, we can see that a ServiceAccount called pod-manager-sa from the namespace test exec'd into the monitoring-agent pod in the kube-system namespace.
For this investigation, we want to pay close attention to key information that may help us as we continue to investigate, such as:.
One of the first questions to address after a credential-based detection: “Is this a one-off, or part of a larger chain of activity?” To answer this, we leverage the Kubernetes audit logs within advanced event search. Events come in all shapes and sizes, and they can contain valuable information to reconstruct the who, what, when, and where of events on the cluster. The events themselves are in a json format. Before we continue, let’s take a second to cover the anatomy of an audit event and highlight some fields that are crucial to keep in mind when conducting an investigation.
These are some of the more important events when attempting to reconstruct behavior on a cluster. Other fields hold valuable information as well, but for now we’ll just focus on the highlighted ones.
Note: Depending on the source platform (GKE, AKS, EKS, OpenShift, self-managed, etc.), the log output may be different.
With this in mind, let’s jump back to our investigation.
Using the CrowdStrike® Falcon LogScale™ query below, we can trace all of the activity for the pod-manager-sa:.
The result from the query surfaces multiple exec attempts into the monitoring-agent pod.
First, a test id command. Then immediately: cat /var/run/secrets/kubernetes.io/serviceaccount/token. This token can be used to run kubectl commands as the service account associated with the monitoring-agent pod. We know the pod name and the Kubernetes namespace where the pod exists based on the requestURI. The pattern …/namespaces/kube-system… tells us the resource being requested exists in the kube-system namespace and …/pods/monitoring-agent… tells us the resource type being requested is a pod with the name monitoring-agent.
At this point, we are looking at an attack where the investigation will need to pivot from one identity to another. We should begin to investigate what the stolen credentials for the monitoring-agent pod did. One way to determine the service account associated with a particular pod is to search for the pod name in the Kubernetes and container inventory asset page within the Falcon platform.
Here we can see that the service account associated with this pod is cluster-admin-sa.
Searching the audit logs for what cluster-admin-sa did after the theft with the following query of the Kubernetes audit events:.
Sources indicate that the results show several API calls. The most notable calls:.
The logs show that the compromised cluster-admin-sa was used to create a upcoming CronJob, list all cluster secrets, and then create a new pod. The 200 and 201 status codes indicate that all of the events were successful. At this point during the investigation, because every secret in the cluster was exposed, it would be worthwhile to rotate any value stored on this cluster. Additionally, further investigation surrounding the secrets stolen is also necessary.
The audit log shows the exact moment of escalation: pod-manager-sa reads the token from inside the monitoring-agent at 15:08:35, and cluster-admin-sa begins making privileged API calls at 15:08:36.
We will return to these upcoming resources created later in this post, but before we do, we’ll pivot the investigation to determine if we can find where the behavior originated.
In a recent development, the original detection fired off activity from the pod-manager-sa service account. Using the Falcon Cloud Security Kubernetes Admission Controller data, we can query for the pod(s) that use that service account.
The result of this query returns one result.
There is exactly one pod in the namespace test bound to this ServiceAccount: falcondemo-fileservice. It is managed by a Deployment (ReplicaSet controller), which tells us it is an application workload, not a one-off Job. The PodUid (8f6e21c8...) is the key that will allow the investigation to pivot from pod data to all of its runtime telemetry in the Falcon sensor data with ease.
In a recent development, the next step in the investigation will be to do just that. Now we will go deeper into the investigation moving away from Kubernetes events into the Falcon Sensor events protecting the Kubernetes Node and Pods.
When runtime events are detected within a container inside a Kubernetes cluster, the telemetry is enriched with metadata about the Kubernetes cluster where the events occurred. We can utilize this data to pivot from the Kubernetes event information directly into the command line events. Using the knowledge gained earlier in the investigation and with the following query, we can query for ProcessRollup events that occurred in our pod.
Recent findings suggest that looking at the results, we can see a series of basic enumeration commands (id, uname, etc.) being executed, then Kubectl is downloaded followed by a series of kubectl commands. Every API call in the above image has a matching kubectl command here, with timestamps aligning to the second. The --token=eyJ... flag confirms the pod is using a stolen token (not its own mounted SA).
It has been revealed that note: The parent process is dash (spawned by apache2). This pod is running Apache, and the attacker is executing commands through it. This is more than likely a webserver with some kind of vulnerability that has allowed for commands to be executed through it. Further investigation of the application will be required for a full root cause analysis.
It has been revealed that earlier, we noticed a newly introduced pod and a CronJob being created. Let's jump back to that and see if we can determine what the purpose of those resources was.
According to recent reports, during the earlier investigation, we observed the cluster-admin-sa created a CronJob called system-health-check. Falcon's Kubernetes Admission Controller captures the full object spec via K8SResource events.
In the results, the K8SResourceObject field reveals us the manifest of the CronJob:.
This CronJob runs every 5 minutes, spawns a privileged container with host access, and executes chroot /host to escape the container. It then establishes a reverse shell to 35.183.69.114:8876. This will keep firing every 5 minutes until removed.
Querying the Falcon Kubernetes data for pods created by the CronJob, we can determine the pod IDs and then pivot into the runtime telemetry as we did before for this fresh set of pods. With this information, we can determine how the reverse shell was utilized.
To start, we query for the pod IDs:.
Based on the results from this query, we can confirm what actually ran by querying process telemetry for all pods spawned by this CronJob. The PodId values in the query below are based on the results from the previous query:.
Each CronJob pod follows the same pattern: chroot /host escapes the container, the host shell profile loads (reading /proc/PID/comm, /etc/locale.conf), then an interactive bash -i session connects back to the command-and-control (C2). The third pod (29694010) shows repeated reconnection attempts at 20:10 and 20:11. This indicates the reverse shell is being maintained across the C2 session. No further post-exploitation commands were observed from these shells during the investigation window. It appears to be idle, waiting for the next phase of the adversary activity.
Figure 12 shows the detection successfully triggering on the malicious container escape activity, and the CronJob pods executing chroot /host to break out of the container and establishing interactive reverse shell sessions back to the C2 infrastructure.
In addition to the CronJob pods, we also observed a pod named metadata-stealer being created with the compromised credentials.
Using the same process as above, we can find the running processes associated with the metadata-stealer pod. By querying the Falcon Kubernetes Admission Controller data, we find the metadata-stealer pod’s ID 4c115738… Using that information, we query for the processes.
We see the following series of events:.
This is the standard AWS IMDSv2 pattern to extract credentials from the service.
curl -s -X PUT http://169.254.169.254/latest/api/token -H X-aws-ec2-metadata-token-ttl-seconds:21600.
curl -s -H "X-aws-ec2-metadata-token:..." http://169.254.169.254/latest/meta-data/iam/security-credentials/.
curl -s -H "..." http://169.254.169.254/latest/meta-data/iam/security-credentials/demo-cluster-node-role.
With a little query foo, we can show the activity in the meta-data pod and the falcondemo-fileservice pod inline. Comparing timestamps just moments after this credential theft, the original pod we investigated (falcondemo-fileservice) uses the credentials to run aws_enum.py.
Seeing this information, we should now pivot into CloudTrail events to determine how the stolen AWS access key was utilized. We can do that with a quick query:.
Industry observers note that the results from the query only show a simple STS GetCallerIdentity API. Luckily for us, the script only seemed to validate the credentials.
Through this blog, we have moved through multiple different data sources retracing the steps of an incident that spans Kubernetes, runtime events, and the cloud control plane. CrowdStrike Falcon Cloud Security capabilities made it possible to correlate activity across each of these layers:.
Recent findings suggest that by joining all of these data sources together, teams can successfully and fully answer questions during an incident that they simply cannot with only a few of them. Each layer serves a distinct purpose: Harden and prevent, identify and trace, and observe and respond, to deliver the unified visibility required to detect, investigate, and remediate threats across the full cloud-native attack surface.
Falcon Cloud Security unifies Kubernetes audit log detection, runtime protection, admission control, and cloud detection and response in a single platform, so the pivots in this investigation happen in one console rather than across a patchwork of tools. To see how Falcon Cloud Security can protect your clusters, try it for free for 15 days.
Learn more about Kubernetes threat detection with Falcon Cloud Security in this short video:.