iac.htora.dev · security templates

Home/Refreshers/Containment by what was compromised: refresher

Containment by what was compromised

The fastest safe way to cut an attacker off, by what they have, and what each move leaves open.

CompromisedContain it byStill open afterwards
AWS access keyDeactivating it, then a deny-all policy on its userKeys and roles it created
AWS role sessionsRevoke active sessions on the roleNothing, once revoked. Without it, sessions last until they expire
Google Cloud service accountDisabling its keys or the account, and removing who can impersonate itWorkloads using it break when the account is disabled
EC2 instanceTag incident=<id>: protect, snapshot, memory, isolateCredentials taken from it, until the role's older sessions are revoked
Compute Engine VMSnapshot, then a deny-all firewall rule by network tagIts service account, which only changes with the VM stopped
Kubernetes podRelabel out of its controller, deny-all network policy, cordon the nodeTraffic, if the network plugin ignores network policies

Commands

Deactivate an AWS keyaws iam update-access-key --user-name <user> --access-key-id <key> --status Inactive
Disable a Google Cloud keygcloud iam service-accounts keys disable <key-id> --iam-account <sa-email>
Take a pod out of its controllerkubectl label pod <pod> app-
Mark a pod for quarantinekubectl label pod <pod> quarantine=true
Stop new pods on a nodekubectl cordon <node>

Watch out

  • Delete nothing that could be evidence until it has been captured.
  • Containment that breaks production needs the commander's call. Agree the limits before the incident.
Check it worked

The attacker's next API call fails. Confirm it in the audit log.

Read the full pageDownload PDF

Registry 0.23.0. Built 2026-11-17.

Made by Habibullah Tora. Source on GitHub. Code under the MIT licence, writing under CC BY 4.0.