PIVTR-D
ROracle Cloud playbook · Compute and containers

OKE cluster compromise

The attacker reaches the Kubernetes API of a Kubernetes Engine (OKE) cluster with a stolen kubeconfig or token, or runs code in a pod and works outward. Typical steps are reading secrets, running commands in other pods, launching a privileged workload, and calling the instance metadata service or a workload identity to reach OCI resources. Restrict the API endpoint first, and save the Audit and kube-apiserver entries before anyone rotates credentials.

Look here

LogSearch for
Audit, Kubernetes API server admin eventsAdministrative changes made with kubectl or the API, such as creating a service, for clusters on Kubernetes 1.13 or later. Events are available from July 15, 2020, and read-only requests do not appear, so use the service log below for them. In the Console, open Observability & Management, Logging, Audit, choose the cluster's compartment, and search for the keyword OKE API Server Admin Access
OKE service logs, kube-apiserverEvery request sent to the API server, including reads, if the log was on. Enable it in Logging with Enable service log, service Container Engine for Kubernetes, the cluster, and log category kube-apiserver or All log sources. The logs run at Kubernetes verbosity v=2. The other categories are kube-scheduler, kube-controller-manager and cloud-controller-manager
Audit, cluster control planeKubeconfig creation, cluster and endpoint changes, credential rotation and node pool changes. The events use API operation names such as CreateKubeconfig, UpdateCluster, UpdateClusterEndpointConfig, StartCredentialRotation, CreateNodePool and UpdateNodePool. Confirm the exact event names in your Audit export: oci audit event list -c <compartment-ocid> --start-time <utc> --end-time <utc> --all
Cluster configurationThe cluster type (BASIC_CLUSTER or ENHANCED_CLUSTER), the endpoint configuration (public IP and network security groups), the image verification policy and the Kubernetes version: oci ce cluster get --cluster-id <cluster-ocid>
Node poolsNode pools and their images, including pools no one approved: oci ce node-pool list -c <compartment-ocid> --cluster-id <cluster-ocid>
IAM for workloads and nodesPolicies that give workloads and nodes OCI access. Workload identity is available on enhanced clusters, and its policies name a namespace, service account and cluster with request.principal.type = 'workload', request.principal.namespace, request.principal.service_account and request.principal.cluster_id. List those policies and the policies that name the node pool's dynamic group: oci iam policy list -c <compartment-ocid> --all
Cluster contentsNew privileged pods, host path mounts, unfamiliar images and cluster-admin bindings: kubectl get pods,serviceaccounts,clusterrolebindings,rolebindings -A -o yaml
Admission webhooksMutating and validating webhooks that no owner added: kubectl get mutatingwebhookconfigurations,validatingwebhookconfigurations -o yaml
Object Storage and other service logsCalls made to OCI services by the workload identity or by the node's instance principal. Search the target service's log or Audit for the principal name

Contain

#Item
1Save the cluster and node pool details, the Kubernetes objects listed above, and the Audit and kube-apiserver entries for the window. See Evidence
2Restrict who can reach the API endpoint with a network security group that allows only responder addresses. If responders reach the cluster from inside the VCN, also add --is-public-ip-enabled false: oci ce cluster update-endpoint-config --cluster-id <cluster-ocid> --nsg-ids '["<nsg-ocid>"]'
3Isolate suspect pods. Change their labels so they leave Service selectors, and apply a NetworkPolicy if the cluster's network plugin enforces it. Keep the pods running for evidence
4Cordon the nodes that ran them with kubectl cordon <node>. Back up their boot volumes, and isolate the node in a quarantine network security group as in compromised compute instance
5Delete the role bindings and roles the attacker created destructive. Start with any that grant cluster-admin: kubectl delete clusterrolebinding <name>
6Remove IAM access the workload or node identity gave the attacker, as in stolen instance principal credentials. Edit the policy that names the workload identity or the node pool's dynamic group: oci iam policy update --policy-id <ocid> --statements file://known-good.json
7Start cluster credential rotation. It adds new credentials, and the old ones keep working until the delay ends. The delay is a number of days in ISO 8601 form, up to 90 days: oci ce cluster start-credential-rotation --cluster-id <cluster-ocid> --auto-completion-delay-duration P1D
8Give every legitimate client a new kubeconfig: oci ce cluster create-kubeconfig --cluster-id <cluster-ocid> --file $HOME/.kube/config --region <region> --token-version 2.0.0
9Retire the old credentials early, once your own clients have new ones: oci ce cluster complete-credential-rotation --cluster-id <cluster-ocid>

Eradicate and recover

#Item
1Rotate every Kubernetes secret, database password and API key the attacker could read, using the kube-apiserver entries for secret reads and the scope in Scope
2Replace the boot volume of each compromised node from the known-good image: oci ce cluster replace-boot-volume-cluster-node --cluster-id <cluster-ocid> --node-id <node-ocid>
3Delete a compromised node pool after evidence is saved destructive. It removes every node in the pool: oci ce node-pool delete --node-pool-id <ocid>
4Move workloads to workload identity. Write one policy per namespace, service account and cluster, and remove instance principal permissions the workloads no longer need. Workload identity needs an enhanced cluster: oci ce cluster update --cluster-id <cluster-ocid> --type ENHANCED_CLUSTER
5Turn on image verification so the cluster runs only signed images. The policy file names a Vault key. Check the images in use against image tampering: oci ce cluster update --cluster-id <cluster-ocid> --image-policy-config file://policy.json
6Remove attacker persistence: webhooks, CronJobs, DaemonSets, static pods, and service accounts in system namespaces
7Enable the kube-apiserver service log and set its retention, so the next incident has request-level history
8Keep the API endpoint private, or limit it with a network security group, and review who has manage cluster-family
Watch out
  • The Audit entries for the Kubernetes API cover administrative changes. Reads such as listing secrets appear only in the kube-apiserver service log, and only if it was on. If it was off, treat every secret the attacker's identity could read as read.
  • Starting credential rotation leaves the old credentials working until you complete the rotation or the delay ends. An attacker with an old kubeconfig keeps access until then, so complete the rotation as soon as your own clients have new credentials.
  • A pod runs on a compute instance. Without workload identity, code in a pod can ask the instance metadata service for the node's identity, so the node's dynamic group policies apply to every pod on it. Requiring version 2 of the metadata service adds a header requirement and does not remove the access.

Oracle documentation: Viewing Kubernetes API server audit logs; viewing OKE service logs; granting workloads access to OCI resources; instance metadata service versions; OCI CLI reference for ce cluster (update, update-endpoint-config, start-credential-rotation, subcommands). Checked September 2026. Rechecked October 2026: every command, the 90-day maximum rotation delay and the 2.0.0 token version against OCI CLI 3.94.2.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.