Tracing a Simulated Kubernetes Attack Across Audit Logs and Runtime Telemetry

· Original article ↗

Summary

A CrowdStrike walkthrough correlates Kubernetes audit logs, runtime telemetry, admission data and CloudTrail to trace a simulated attack involving service-account token theft, cluster privilege abuse, a reverse shell and AWS credential validation.

Key points

  • In the simulated investigation, a pod-associated service account used an exec API call to enter a pod in another namespace; the walkthrough treats this as the initial lateral-movement detection.
  • Runtime telemetry showed commands reading the target pod’s service-account token. Audit logs then recorded the associated cluster-admin service account listing secrets and creating a pod and CronJob.
  • The CronJob manifest specified a privileged container with host access that ran chroot and opened a reverse shell. Runtime telemetry showed repeated connections, but no further post-exploitation commands during the investigation window.
  • The article links command execution in the originating Apache pod to the activity, but says the application’s root cause requires further investigation.
  • A separate pod queried AWS instance metadata for role credentials. CloudTrail showed an STS GetCallerIdentity request; the article says the script appeared to use the credentials only for validation.
  • The walkthrough recommends rotating values stored in the cluster after the secrets were exposed and correlating audit logs, runtime events, admission data and cloud activity during investigations.

Article Details

Attack Vectors
  • The scenario begins with a service account associated with a pod in the test namespace using the Kubernetes exec API to enter a pod in kube-system.
  • Commands in the monitoring-agent pod read its mounted service-account token; the stolen token is then used for privileged Kubernetes API calls.
  • The compromised cluster-admin-sa lists cluster secrets and creates a pod and a recurring CronJob.
  • The CronJob starts a privileged container with hostNetwork, hostPID, and host-root access, then uses chroot /host to access the host and opens a reverse shell.
  • A metadata-stealer pod requests credentials from the AWS instance metadata service; the article says the credentials were subsequently used only to validate access with STS GetCallerIdentity.
  • Runtime telemetry showed commands running through a process spawned by Apache; the article says a web-server vulnerability was a likely explanation but that root-cause investigation was still needed.
Defensive Notes
  • Rotate values stored in the cluster because the investigation found that all cluster secrets were exposed.
  • Further investigate which secrets were stolen and whether the credentials were used beyond the activity observed.
  • Correlate Kubernetes audit logs, admission-controller and asset data, container runtime telemetry, and cloud activity logs to trace identities, execution, persistence, and activity outside the cluster.
  • Investigate recurring CronJobs and newly created pods, and review privileged container settings, host access, and reverse-shell activity.

Indicators of compromise

TypeIndicatorContext
IPV435[.]183[.]69[.]114C2 IP address specified as the destination of the CronJob's recurring reverse shell.

MITRE ATT&CK

T1053.007 · Container Orchestration JobA recurring Kubernetes CronJob named system-health-check launches a privileged container every five minutes.T1059.004 · Unix ShellThe CronJob runs shell commands, including an interactive bash session that connects to the C2 IP.T1078.004 · Cloud AccountsStolen AWS credentials are used for an STS GetCallerIdentity call; the article says this appeared to validate the credentials.T1095 · Non-Application Layer ProtocolThe CronJob's bash reverse shell connects to the specified IP and port using /dev/tcp.T1105 · Ingress Tool TransferRuntime telemetry in the falcondemo-fileservice pod showed kubectl being downloaded before a series of kubectl commands.T1528 · Steal Application Access TokenThe service-account token read from the monitoring-agent pod is used for subsequent Kubernetes API calls.T1552.001 · Credentials In FilesCommands read the mounted Kubernetes service-account token from /var/run/secrets/kubernetes.io/serviceaccount/token.T1552.005 · Cloud Instance Metadata APIThe metadata-stealer pod requests AWS credentials from the instance metadata service.T1609 · Container Administration CommandThe scenario uses Kubernetes exec to run commands inside the monitoring-agent pod.T1610 · Deploy ContainerUsing compromised credentials, the operator creates the metadata-stealer pod and CronJob pods.T1611 · Escape to HostThe CronJob runs a privileged container with host-root access and uses chroot /host to access the host.T1613 · Container and Resource DiscoveryThe compromised cluster-admin-sa lists secrets across namespaces and creates Kubernetes resources during the scenario.

Vendors

Products

Related Articles