Falco alerts "Terminal shell in container" on a production payments pod at 3 a.m. Walk through your response.
IntermediateScenarioKubernetes Security
Answer
Situation read → Could be an engineer debugging or an attacker with RCE. Verify fast, preserve evidence.
What I'd do →
- Check the alert fields: user, command line, parent process, pod and node.
- Check audit logs for a matching
pods/execby a known human: if found, confirm with that person. - If no exec in audit logs, the shell came from inside the app: treat it as RCE.
- Isolate: apply a deny-all NetworkPolicy to the pod label, cordon the node, but do not delete the pod yet.
- Capture evidence (process list, network connections, container filesystem diff), then rotate the pod's secrets and redeploy from a known-good image.
Why → Audit logs tell you if the shell came through the API or from an exploit.
Interview tip → "Isolate, don't delete" keeps evidence for forensics.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate