Falco reports a reverse shell from a pod in EKS. How do you contain it while keeping evidence?
AdvancedScenarioIncident Response and Governance
Answer
Situation read → Deleting the pod loses everything. We isolate it at the network level and capture its state.
What I'd do →
- Label the pod and apply a deny-all NetworkPolicy that selects that label:
kubectl label pod api-7d9f -n prod quarantine=true kubectl apply -f - <<'YAML' apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: {name: quarantine, namespace: prod} spec: podSelector: {matchLabels: {quarantine: "true"}} policyTypes: [Ingress, Egress] YAML - Remove app labels so the Service stops routing to it; the ReplicaSet creates a clean replacement.
- Cordon the node; snapshot its volume; capture container filesystem with
kubectl cpor the runtime. - Check the pod's service account permissions and cloud role usage in audit logs and CloudTrail.
- Find the entry point (vulnerable dependency, exposed endpoint) and patch before scaling back.
Why → Relabelling detaches the pod from traffic and its controller without killing it.
Interview tip → The "remove labels so the ReplicaSet orphans it" trick impresses interviewers.
More on Incident Response and Governance
You find a ransom note in an S3 bucket and most objects have been deleted. What do you do in the first hour?AdvancedYour company has its first real security incident and people are all talking at once in Slack. How do you organise the response?BeginnerAn EC2 instance is confirmed compromised. A colleague wants to terminate it immediately. What do you do instead?IntermediateAfter a security incident, leadership wants to know who to blame. How do you run the post-incident review?BeginnerYou are asked to run a security tabletop exercise for the engineering team. How do you design it?IntermediateA developer's GitHub account was compromised and the attacker pushed a commit to `main` that adds a postinstall script. What now?Advanced