Security Incident and Breach Response Questions
Responding to a confirmed or suspected security incident or data breach where the hard part is coordination, evidence and disclosure: deciding between rapid containment and preserving forensic artifacts (including on Kubernetes nodes and cloud accounts that are also the crime scene), chain of custody and legal holds, separating a security compromise from an operational failure, dividing ownership between operations and the security team, involving legal and compliance, deciding whether a breach is notifiable and who must be told by when (regulators, affected individuals, customers), sequencing notifications when one breach touches several regimes with different clocks, scoping exposure from a misconfiguration, an over-broad internal audience, a supply-chain dependency or a machine learning dataset, briefing executives and customers during a breach, and post-breach analysis and safeguards. The generic detect-contain-eradicate-recover lifecycle and its containment mechanics, hands-on forensic artifact analysis, privacy law as law, vulnerability triage, detection engineering and outage response are covered elsewhere.
A Kubernetes node is likely compromised and containers on it have been modified. How do you sequence isolating the node, preserving evidence, rotating credentials and replacing it, and what is the trade-off between rebuilding quickly and keeping the node for investigation?
Sample Answer
The idea in plain words
A compromised node holds two kinds of value for the attacker and for you: live access (the attacker can still run code, read mounted secrets and reach the network) and evidence (what was changed, which processes ran, where traffic went). Fast rebuilding removes the access but also deletes the evidence; keeping the node for study preserves evidence but leaves a foothold. The way out is to cut the access first without touching the machine's state, copy the evidence that disappears when pods or the machine are removed, and only then rebuild. Terms: containment is limiting what the attacker can reach; eradication is removing the attacker's foothold; volatile evidence is data that vanishes on reboot or pod deletion (memory, running processes, open network connections, container writable layers); a cordon marks a Kubernetes node unschedulable; a drain evicts its pods, which deletes them from that node. Other terms: the kubelet is the agent on each node that starts and watches its pods; journald is the Linux service that stores system logs; a service account token is the credential a pod uses to call the Kubernetes API, so a stolen one lets the attacker act as that pod; a container's writable layer is where its changes since start are kept on top of the unchanged image; host network means a pod shares the node's own network instead of having a private one; egress is outbound traffic; lateral movement is an attacker using one compromised machine to reach others; a kernel module is code loaded into the operating system's kernel; a legal hold is counsel's instruction to keep records and delete nothing relevant to a legal matter.
The sequence I would run, and why in this order
- Isolate the network, keep the machine running. Cordon the node (
kubectl cordon node-a: no new pods land there) and cut its traffic at a layer the attacker cannot undo from inside the node: the cloud firewall or security group on the node's network interface, set to deny all egress except a forensic collection path (the single allowed route to the evidence storage), rather than editing iptables (the Linux host firewall) on the node, which a root attacker can reverse. An illustrative change: replace the node's security group with one whose only outbound rule is tcp 443 to the collection host 198.51.100.10 and whose only inbound rule is the response team's address. A Kubernetes NetworkPolicy can quarantine individual pods but only if the cluster's network plugin enforces it, and it does not stop a process using the host network. Do not drain yet: draining deletes the pods and their writable layers. - Capture volatile evidence first, ordered by how fast it disappears. Memory image and process list; network connections; then container-level data (below). Use a tool that runs from outside the compromised processes where possible, and assume the node's own binaries may be tampered with. In order of preference: (a) if the node is a virtual machine on infrastructure you control and the platform can capture guest memory, do it from the hypervisor, so nothing runs inside the node; (b) otherwise run a Linux memory acquisition tool you staged in advance from read-only media, as a separate root session, writing to remote storage. Two such tools are AVML, used in current releases as
avml acquire /mnt/evidence/node-a.lime(theacquiresubcommand plus one output file argument; older releases took the file name alone, so run the version you staged; the evidence share is mounted from the collection host), and LiME, a kernel module that must be built for the node's exact kernel version and is loaded withinsmod. AVML needs no kernel module: it reads memory through/dev/crash,/proc/kcoreor/dev/mem, so it is the choice when the hardened image forbids loading modules. If kernel lockdown is enabled, AVML cannot acquire memory either; then fall back to the process list and connection table plus the disk snapshot. Capture the process list and connections withps -eo pid,ppid,user,lstart,args(every process, with parent, owner, start time and full command line) andss -tanp(TCP sockets, all states, numeric addresses, owning process), writing the output to the same remote share and hashing it. - Snapshot the disks. A cloud snapshot of the node's root volume and any attached persistent volumes is a copy taken by the provider with no load on neighbouring pods. Record the snapshot ID, time, and who took it, then hash exports used for analysis (chain of custody).
- Start replacement capacity in parallel, not afterwards. Bring up a new node from a trusted image, schedule fresh pods from image digests (immutable content hashes, not mutable tags) that were verified, and shift traffic. This is what keeps recovery fast while step 2 and 3 run.
- Rotate credentials in dependency order, after isolation. Rotating while the attacker still has a path lets them capture the new secret. Rotate what the node could reach: secrets mounted into pods on that node, the pods' service account tokens, the node's cloud role credentials (cut at the cloud account side), image registry pull secrets, and any key the workloads held. Then check API server and cloud audit logs for use of the old values.
- Remove the node. After the snapshot and memory image are verified readable, terminate the machine. Keep the snapshot under legal hold if counsel says so. Rebuild only from the trusted image.
Pod-level evidence with minimal disruption to neighbouring pods
Take it from the data plane that does not require touching other pods:
- Logs:
kubectl logs <pod> --previous(prints the logs of the previous, terminated instance of the container, which matters when it has restarted and the live logs start empty) for the last crashed container, plus the node's container runtime and kubelet logs (for example via journald) copied off the node. Cluster-wide, export the Kubernetes audit log from the API server (it records who called the API, with what verb on what object) to storage outside the cluster, because an attacker with API access can try to tamper with in-cluster copies. - Filesystem changes: the container's writable layer on the node's disk is captured by the disk snapshot; to see what changed, compare it with the image: modified binaries, new files, new cron entries. Reading from the snapshot copy, not the live node, avoids altering timestamps.
- Pod specs and events:
kubectl get pod <pod> -o yaml(the full object, including image digest and mounts) andkubectl get eventssaved before anything is deleted: they show which image digest, which service account, which mounts. - Persistent volumes: snapshot through the storage API, not by mounting the live volume in a new pod on the compromised node.
- Neighbours: do not exec into neighbouring pods; selecting evidence by node and pod labels keeps the collection read-only for them. Those pods are rescheduled onto clean nodes afterwards anyway.
Worked example (all numbers are assumptions)
Node node-a runs 12 pods, each requesting 0.5 CPU, so the demand to replace is 12 x 0.5 = 6 CPU. The rest of the cluster has 8 CPU of free capacity, so 6 fits (8 - 6 = 2 CPU of headroom) and no new node is needed to rehome the pods; one is added anyway so the cluster is not left tight. Suppose the memory image takes 15 minutes, the root volume snapshot completes in about 10 minutes and runs while the image is being taken, and replacement pods are healthy 10 minutes after they are scheduled. Lay it out by minute, with the assumption that isolation takes 2 minutes and replacement capacity starts at minute 2: minutes 0 to 2, cordon and cut egress at the cloud firewall; minutes 2 to 17, memory image (15 minutes); minutes 2 to 12, root volume snapshot in parallel (10 minutes); minute 2 onward, new node and pods start, and are healthy at minute 2 + 10 = 12, when traffic shifts; minute 17, both copies are done and, once checked readable, the node can be removed. Service is back on clean capacity at minute 12 either way, so keeping the node alive costs no recovery time; the only difference is that the node lives until minute 17 instead of being deleted at minute 2. Then the node stays isolated but alive for roughly 15 minutes of collection, versus drain-and-delete at minute 2. The cost of keeping it is 15 minutes of a single node's capacity plus a window in which the attacker still has local code execution but no network. The cost of not keeping it is losing the memory image, which is the only place unwritten attacker tooling may exist.
The trade-off and my recommendation
Rebuilding quickly wins when the workloads are customer-facing and the node is one of many, and the damage is probably limited to this node. Keeping the node for investigation wins when there are signs the attacker moved laterally (cluster credentials used from the node), when a regulator or law-enforcement inquiry is likely, or when the intrusion path is unknown and the node is the only place it can be learned. I would not choose between them: isolate, take a memory image and disk snapshot (about a quarter of an hour in the example), rebuild immediately, and keep the copies instead of the machine. The exception is a node that already holds credentials with wide cluster rights: rotate those immediately after isolation and before the memory image, since the speed of rotation then matters more than the completeness of the memory image. Isolation still comes first, because rotating while the attacker has a network path lets them capture the new secret.
Common mistakes
- Draining first "to protect the workloads", which deletes the pods and the writable layers.
- Isolating with commands run on the node itself.
- Rotating before the attacker is cut off, or forgetting the cloud role of the node.
- Redeploying from a mutable image tag that the attacker may have changed in the registry.
- Collecting evidence from the live node with its own possibly tampered tools and no record of what was run.
You discover that real personal data or a credential was included in the training data of a production model. How do you contain it, investigate how it got there and who or what could have extracted it, decide whether it is a notifiable incident, remediate the data and the model, and change the process so it cannot recur?
Sample Answer
The idea in plain words
Training data is a copy of whatever went into the pipeline, and a trained model can sometimes reproduce parts of what it was trained on (this is called memorisation). So real personal data or a live credential in the training set creates two separate exposures: the data sitting in the dataset, its copies and backups, and the possibility that the model itself can be made to repeat it. Notifiability depends on whether an unauthorised party could actually reach the data, through the dataset, a vendor, a public release or the model's outputs, and not merely on the data being in the wrong place. The order of work is: freeze and preserve, rotate any credential, work out how it got in and who could reach it, test the model for leakage, decide notifiability with privacy and legal, clean up the data and the model, and fix the pipeline.
Step 1: contain, and preserve what you will need
- Freeze promotion. Promotion is moving a dataset or model from experiment to production use; freeze it. Stop new training runs and deployments from using this dataset. Stop sharing it with vendors, annotators or other teams.
- Limit the model. If the model is served externally, restrict it according to the risk: lower the access, add output filtering (a check that blocks responses matching the affected patterns, such as a card number format), or take it offline if extraction is plausible. If it is internal only, restricting access to the team is usually enough.
- Preserve before you delete. Copy the dataset, its lineage records (where each record came from and what changed it), the model checkpoints (saved states of the model during training) and access logs into a restricted location under a legal hold (an instruction to stop routine deletion of anything relevant). Cleaning comes later and the clean-up must not destroy the evidence. Chain of custody (the record of every hand-off of that evidence) starts here.
- Rotate the credential immediately. Rotation is cheap and reversible. Then search the credential's usage logs from the time it entered the data set to now for use from unknown places. Rotate whether or not you find misuse, because you cannot prove nobody read it.
- Bring privacy and legal in now. Inform the data protection officer (DPO, the person responsible for privacy compliance) and counsel at triage, not after the investigation. They own the notifiability decision and the clock, and early involvement lets counsel direct the investigation so the findings may be protected by legal privilege (confidential legal advice shielded from later disclosure; this varies by jurisdiction).
Step 2: investigate how it got there and who could have extracted it
How: trace lineage for the affected records. Typical sources are scraped logs, support tickets, code repositories with secrets committed, customer uploads and third-party datasets. Find the pipeline stage that should have filtered them and why it did not (no scanner, a pattern that missed, a source added without review).
Scale. A sample tells you that the problem exists, not how big it is. Assumed numbers: reviewers sample 500 records from a 2,000,000-record dataset and find 7 with real personal data. The proportion is 7 divided by 500 = 1.4 percent. The standard error (a measure of how much a sampled proportion would typically wobble if you drew another sample) is
SE=np(1−p)
where p is the sampled proportion and n the sample size. Step by step: 0.014×0.986=0.013804; 0.013804/500=0.000027608; the square root is about 0.00525, which is 0.525 percentage points (about 0.53). About 95 percent of a bell curve lies within 1.96 standard errors of its centre, so an approximate 95 percent range is 1.4±1.96×0.525=1.4±1.03, which is 0.37 to 2.43 percent, written 0.4 to 2.4 percent. Applied to the dataset: 1.4 percent of 2,000,000 = 28,000 records as a point estimate, with a range of roughly 0.4 percent of 2,000,000 = 8,000 up to 2.4 percent = 48,000. The estimate guides staffing, not the notification: run a full scan with a detector for personal data and secrets, and use that count.
Who could reach it. List every place the data and the model went: the storage buckets and their access logs, other teams, vendors and annotators (the people or firms who label examples), public or partner releases, the serving API, cached embeddings (stored numeric representations computed from the text, which can carry traces of it), evaluation sets (held-out data used to score the model) and backups. For each, record whether an unauthorised party had access.
Could the model leak it. An extraction attack is an attempt to make a model repeat its training data, for example by feeding it the start of a record and reading what it writes next. Test for memorisation the same way. Take the first part of each affected record as a prompt and check whether the model completes the rest verbatim (word for word), and run the same test on a control set of similar strings the model never saw, to confirm the detection method does not report matches by chance on common text. A tiny example: the prompt is Account holder: Jane Roe, 12 Elm Street, card ending and the model continues with the real last digits from the record; a control prompt is Account holder: Mia Voss, 98 Alder Road, card ending with an invented person, and if the model also produces plausible digits there, that behaviour is pattern, not memory, and only an exact match on the real record counts. Assumed result: 200 prompts built from affected records give 3 exact reproductions of a long, specific string (3 / 200 = 0.015, which is 1.5 percent), and the control gives 0 of 200. An exact verbatim completion of a specific personal record is itself the evidence of leakage, since a model does not reproduce an unseen specific string by chance, so the model must be treated as able to leak those records. The opposite result needs more care. Suppose the affected prompts had produced 0 of 200. Zero events in a sample do not prove the true rate is zero: by the "rule of three", with 0 events in n trials the 95 percent upper bound on the rate is about 3 divided by n, here 3 / 200 = 1.5 percent. The reason: if the true rate were r, the chance of seeing 0 events in n trials is about e−nr; setting that equal to 0.05 gives nr=ln20≈3.0, so r≈3/n. A single sensitive record can still leak at a rate far below that, so a clean result lowers the risk without clearing it. Records that appear many times in the training data tend to be memorised more readily, so check duplicates first.
Step 3: is it a notifiable incident
Ask the questions in order, with the DPO. Under EU GDPR Article 4(12), a personal data breach is a security breach leading to accidental or unlawful destruction, loss, alteration, unauthorised disclosure of, or access to, personal data. Under Article 33 a controller (the organisation deciding why and how personal data is processed) notifies its supervisory authority (the data protection regulator) within 72 hours of becoming aware of a breach, where feasible, unless a risk to individuals is unlikely; Article 34 requires telling individuals without undue delay when the risk to them is high. Credential rules, contract clauses and sector regimes add their own tests.
| Situation | Breach? | Likely action |
|---|---|---|
| Data only in an internal store used by authorised staff, model internal, no extraction | Possibly not a breach (an unauthorised disclosure or access did not occur), but a lawful-basis and purpose problem for the processing itself | Document the assessment, fix the data, DPO decides |
| Dataset or model reachable by a vendor, partner or the public | Likely yes: unauthorised disclosure or access | Start the notification clock from awareness, assess risk, notify as required |
| Model served externally and extraction demonstrated or plausible | Likely yes | As above, plus restrict the model |
| Live credential, with misuse seen in its logs | Yes, as a security incident | Treat as an intrusion investigation |
The training-data problem is also a separate compliance question (was there a lawful basis, one of the legal grounds the GDPR lists for using personal data at all, and can people exercise erasure, their right to have their data deleted), and the DPO handles it beside the notification. The clock starts when the company has a reasonable degree of certainty that a breach involving personal data occurred. A short, documented investigation to establish that is acceptable, and the decision either way is written down.
Step 4: remediate the data and the model
- Delete the affected records from the live dataset, its derived copies, caches, embeddings, evaluation sets and backups, except the preserved legal-hold copy.
- Retraining is the routine path and unlearning is the rare one. For the model, the dependable method is to retrain, or to resume from a checkpoint saved before the data entered, using the cleaned dataset. Machine unlearning (techniques for removing a record's influence without retraining) is research-grade and does not give a guarantee you can put in a regulator filing. Choose by risk: if memorisation is demonstrated for sensitive data, retrain; if the data is low-risk and the test shows no leakage, a documented output filter and a scheduled retrain may be defensible.
- Retire the old model and checkpoints once the replacement passes the same memorisation test, and record the version history.
Step 5: change the process so it cannot recur
- A scanner for personal data and secrets at ingestion, and again before any training run, that fails the pipeline on findings.
- A dataset registry: every dataset has an owner, source, lineage, retention rule and an approval from privacy before first use.
- Approved sources only, with a review for each new source and a data-minimisation default (collect only the fields the task needs).
- Experiment protocols (the run records kept by the team's experiment-tracking practice) that log which data version and code version produced each model, so an audit can answer "what did this model see" in hours.
- Memorisation tests and an access review as release gates for any model that is served outside the team.
- A privacy and legal contact in the escalation path for every data incident, so the clock decision is made on day one.
Common mistakes
- Deleting the dataset before preserving a copy.
- Treating a rotated credential as the end, without checking its usage logs.
- Deciding "no breach, the data was internal" without checking vendors, partners and the serving API.
- Believing that a filter on the model's output proves the model no longer holds the data.
- Reporting an extrapolated count as a measured one.
An attacker with stolen cloud credentials deleted production database snapshots. Restoration is urgent but the account is also the crime scene. How do you decide what to preserve, what logs you need, how you restore, and who you inform internally and externally?
Sample Answer
The idea in plain words
When an attacker uses stolen cloud credentials, the cloud account is both the thing you must repair and the evidence of what happened. Two moves protect both: first make sure the account's audit trail is copied somewhere the attacker cannot reach, and disable (do not delete) the stolen identity; second, restore into a clean place, not by pouring data back into the account you do not yet trust. Terms: audit log is the cloud provider's record of API calls (who, which call, from which address, when; AWS CloudTrail is one example, and every major cloud has an equivalent audit trail under its own name, so the steps below carry over); snapshot is a point-in-time copy of a database volume; blast radius is everything the stolen credential could touch; RPO (recovery point objective) is how much recent data you can afford to lose; RTO (recovery time objective) is how long you can afford to be down. IAM (identity and access management) is the cloud's system of users, roles and permissions; a principal is the identity making a call (a user, a role or a key); an access key is a long-lived credential pair for a user, while a role session is a temporary credential obtained by assuming a role, which expires on its own; a role's trust policy states who may assume it; federation settings link an outside login provider, so an attacker who adds one can sign in later without the stolen key; a user agent is the client software string recorded in the log entry; a deny-all policy is a permission rule that refuses every action and overrides any allow; write-once retention (also called a retention lock) stops stored objects being altered or deleted until a set date; log file integrity validation is a provider feature that signs log files so tampering is detectable; point-in-time recovery restores a database to any moment inside a window using its continuous change log; data-level events are log entries for reads and writes of individual objects, as opposed to management actions such as deleting a snapshot.
First question: is the urgency data loss or lost backups?
Deleted snapshots are a loss of recovery options, not necessarily of data. If the live production database is still running and healthy, nothing needs restoring yet; what is urgent is making a new protected copy before the attacker returns. If the live database was also deleted or encrypted, restoration is the emergency. The plan below handles both, in this order.
Step 1: preserve the evidence (first 30 minutes)
- Secure the audit logs. Confirm they are delivered to a separate log-archive account or storage with write-once retention, and copy the last 90 days now to a second, restricted location. If the logs live only inside the compromised account, assume the attacker can alter them and note that in the record. Check whether log file integrity validation is available and use it.
- Freeze, do not delete, the identity. Deactivate the stolen access key, attach an explicit deny-all policy to the user or role, and revoke active sessions. Deleting the identity removes details you want (creation date, attached policies, last-used data).
- Preserve configuration state. Export a listing of users, roles, access keys, trust policies, network rules, snapshot sharing settings and the list of surviving snapshots, so that later changes are comparable.
- Start the evidence register. One row per artifact: what, source, time collected, collector, SHA-256 hash, storage location. This is the chain of custody.
Step 2: decide what else the credential did (hours 1 to 3)
Query the audit log for every call by the stolen principal, ordered by time. Three illustrative entries (generic field names, invented values, not a real capture) show what each class looks like:
time=2026-03-02T10:31:05Z principal=user/ci-deployer credential=access_key:key-7f3a source_ip=198.51.100.23 user_agent=curl/8.5 action=CreateAccessKey target=user/svc-backup2 result=success
time=2026-03-02T10:36:50Z principal=user/ci-deployer credential=access_key:key-7f3a source_ip=198.51.100.23 user_agent=curl/8.5 action=ShareSnapshot resource=snap-0051 shared_with=account-777 result=success
time=2026-03-02T10:40:12Z principal=user/ci-deployer credential=access_key:key-7f3a source_ip=198.51.100.23 user_agent=curl/8.5 action=DeleteSnapshot resource=snap-0042 result=success
The first is persistence (a new key on another user, so revoking the stolen key alone would not remove the attacker), the second is exfiltration (a snapshot shared with an account that is not ours), and the third is the deletion that was reported. The same source address and user agent across all three ties them to one actor, and the earliest entry from that address marks the first use. Persistence means any way for the attacker to keep access after you revoke the stolen credential. Look for: the first use and the source address and user agent; reconnaissance calls (list and describe); the deletions; persistence (new users, access keys, roles, changed trust policies, new federation settings); exfiltration (snapshots shared to or copied into another account, database exports, object storage reads, new public access); and cost abuse (large compute launches). The questions the log answers decide the response: if there are only deletions, this is mainly an availability and integrity incident; if there are copies or reads of personal data, it is also a confidentiality breach with notification duties. If the log cannot tell you whether data was read (some data-level events are off by default), say that plainly to counsel: "no evidence of access" is different from "evidence of no access".
Step 3: restore without trusting the crime scene
- Find what survives. Candidates: automated backups and point-in-time recovery logs, cross-region or cross-account snapshot copies, logical dumps in object storage, replicas. Check each for attacker changes, since the same credential may have touched them.
- If the live database is intact: take a fresh snapshot now and copy it to a separate, hardened account whose permissions are separate from the compromised one. Add retention locks and a deletion delay so one credential cannot delete everything again.
- If the database is gone: restore from the newest surviving copy into a new environment (new account or a rebuilt, re-keyed network) rather than into the account with unknown persistence. Replay transaction logs if they survive to reduce data loss.
- Do not reuse the old credentials or keys in the restored environment, and rotate secrets the database held (application passwords, connection strings).
Worked example (assumptions: daily cross-account copy at 02:00, deletion at 10:40, no transaction logs): data loss = 10:40 - 02:00 = 8 h 40 min = 520 minutes of writes. If the business RPO is 60 minutes, this recovery path misses it by 520 - 60 = 460 minutes, which is why replaying transaction logs, if any exist, or rebuilding the missing rows from application event streams, belongs in the plan. RTO is the other half. Assume the business RTO is 4 hours (240 minutes), a clean environment takes 90 minutes to build and the restore takes 120 minutes: 90 + 120 = 210 minutes, which fits within 240 with 30 minutes to spare, so restoring into a clean environment does not break the RTO, while the RPO of 60 minutes is the objective that fails and needs the extra replay work.
Step 4: who is told, by whom, when
- Immediately (internal): incident commander, security lead, the owner of the account, and legal. Executives get a short brief once restoration options are known.
- Legal and privacy (first hour): they decide notification duties. If personal data was read or copied, the GDPR Article 33 clock (72 hours from awareness to the supervisory authority, where feasible, unless the breach is unlikely to result in a risk to people) and other regimes' clocks may apply; deletion of backups on its own may not trigger them if the live data is intact, and counsel makes that call.
- Outside, as legal approves: the cloud provider's security or abuse team (they can help with logs and hold actions), cyber insurance (policies often require prompt notice), law enforcement if counsel decides, affected customers and regulators if personal data or customer-contract duties apply.
- Customers: state what was affected, what is not known yet, and when the next update comes.
Judgment
I would preserve first for 30 minutes, because the logs are the only way to tell "backups deleted" from "data stolen", and the answer to that changes who must be told. I would then restore into a clean environment, even if it costs time, because rebuilding inside an account with unmapped persistence invites a second deletion. What would flip it: if the business cannot operate and the attacker's persistence has been fully enumerated and removed, restoring in place is acceptable.
Common mistakes
- Deleting the compromised user or key before recording its history.
- Restoring into the same account before listing every persistence mechanism.
- Treating deleted backups as "just an availability problem" without checking for data reads.
- Relying on logs stored in the compromised account.
- Forgetting to rotate the secrets inside the restored database.
A service that processes PII suddenly shows a large unexplained spike in outbound traffic. What do you do in the first hour to limit possible exfiltration, what evidence do you secure before you change anything, and how do you bring the service back safely?
Sample Answer
The idea in plain words
An unexplained outbound spike from a service that holds personal data (PII) is treated as possible exfiltration (data being copied out of the organisation) until something ordinary explains it. The first hour has a fixed order: confirm the spike is real and see where it goes, copy the evidence that a restart would destroy, apply the narrowest control that stops the traffic, then rebuild and return the service only when you can explain what happened or have contained it with controls you trust. "Secure evidence before you change anything" means capturing state that lives only in memory or in open connections, not freezing the service for hours.
Size the risk first (assumed numbers)
Assume the baseline egress is 20 megabits per second (Mbit/s) and the spike is 800 Mbit/s, and the service can read a 250 GB dataset (decimal gigabytes).
- 800 / 8 = 100 megabytes per second (MB/s), because 8 bits make a byte.
- The spike is 800 / 20 = 40 times the baseline.
- 250 GB = 250,000 MB, and 250,000 / 100 = 2,500 s = 41.7 minutes to move the whole dataset.
At 100 MB/s every minute of delay moves about 6 GB (100 x 60 = 6,000 MB), so ten minutes is about 60 GB, nearly a quarter of the dataset, and fifteen minutes is about 90 GB. If this is theft, the entire dataset could leave inside the first hour, which is why the plan below captures the evidence that dies with a connection in a few minutes and blocks the destination as the second step, not the last. If the dataset were 2 TB, the same rate would need about 5.6 hours (2,000,000 / 100 = 20,000 s), and I would have more time for a quieter investigation. These inputs are illustrative.
Minute-by-minute plan
Minutes 0 to 5: is it real and what is it? Check the metric source and time window. Look for ordinary causes in this order: a scheduled backup or export, a data migration, a deploy or autoscaling event that pulls images, a customer running a large legitimate download, a monitoring change that double-counts, and an outbound attack that uses the service as a relay (for example a reflection attack, where the service is tricked into sending large replies to a victim). In flow logs (the network's records of each connection: who talked to whom, on which port, and how many bytes), identify the destination addresses, ports, protocol and which host or container sends the data. Declare an incident if no ordinary cause matches within the five minutes. Page the security on-call and a service owner.
Minutes 5 to 10: capture what a block or restart would destroy. The state that exists only while the connection and process are alive is small and fast to copy. Run the read-only captures below on the affected host (in the commands, evidence/ stands for a mounted evidence volume that is separate from the host's own disk), record the time (date -u), write the output to that evidence location (not the host's own disk), and hash each file. The packet capture runs in the background for two minutes while the quick captures finish. Evidence that survives a network block (disk contents, flow logs, application logs) can wait until after containment.
# evidence/ is the mounted evidence volume, not the host's own disk
date -u > evidence/time.txt
timeout 120 tcpdump -i eth0 -nn -s 0 -w evidence/capture.pcap host 203.0.113.50 &
ss -tunap > evidence/sockets.txt
ps -eo pid,ppid,user,lstart,args > evidence/processes.txt
lsof -nP -i > evidence/open-network-files.txt
wait
sha256sum evidence/*
date -u > evidence/time.txt: saves the time in UTC, which timestamps the capture. Each>sends that command's output to a file on the evidence volume instead of the screen.ss -tunap: lists sockets.-tTCP,-uUDP,-nnumeric addresses (no DNS lookups that would alert the attacker or slow the command),-aall sockets including listeners,-pthe owning process (needs root).ps -eo pid,ppid,user,lstart,args:-eevery process,-ochooses columns: process id, parent id, user, full start time, and full command line. A parent that is a web server or a process started minutes before the spike is a lead.lsof -nP -i:-inetwork files,-nand-Pskip name and port-name lookups.sha256sum evidence/*: run last, afterwaithas paused the shell until the background capture finished, it prints a hash of each saved file to the screen; paste the list into the incident record. A hash is a fingerprint that changes if the file changes, recorded for chain of custody (a record of every hand-off of evidence).tcpdump ...: the trailing&starts it in the background, andtimeout 120stops it after 120 seconds so the capture file is complete before the hashing;-i eth0the interface,-nnno name lookups,-s 0capture whole packets,-wwrite to a file, and the filter limits capture to the suspect address. If the traffic is encrypted, the capture shows who talks to whom and how much, not what is inside.
Illustrative excerpt of ss -tunap output (invented values using a documentation address range, to show what to look for):
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp ESTAB 0 1458304 10.20.4.17:48122 203.0.113.50:443 users:(("python3",pid=2214,fd=7))
tcp ESTAB 0 0 10.20.4.17:5432 10.20.4.31:51044 users:(("postgres",pid=801,fd=12))
Line 1: an outbound connection from a python3 process to an external address with 1,458,304 bytes (about 1.46 MB, from 1,458,304 / 1,000,000) of unsent data queued (Send-Q is bytes not yet acknowledged by the peer), which means a sustained upload. Line 2 is the database serving an internal client, normal. A python3 process that is not the service's own server is the next thing to inspect. The ps and lsof captures let you follow it. Illustrative excerpts (invented values), using the real column headers of each command:
PID PPID USER STARTED COMMAND
2190 1 svc Fri Nov 6 09:02:11 2026 gunicorn: master [orders-api]
2214 2190 svc Fri Nov 6 13:41:07 2026 python3 /tmp/.cache/sync.py
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3 2214 svc 7u IPv4 88213 0t0 TCP 10.20.4.17:48122->203.0.113.50:443 (ESTABLISHED)
In the ps lines, process 2214 is a child of the web application's master process (PPID 2190), started about 4.5 hours after its parent, and runs a script from /tmp, a place a legitimate service rarely runs code from. In the lsof line, FD 7u is file descriptor 7 open for reading and writing, which matches fd=7 in the ss output, and NAME shows the local address on the left of -> and the remote one on the right. Together they tie the connection to the exact process and its parent.
Memory capture is more disruptive and needs approved tooling; it is worth doing when a process of unknown origin is running, because memory holds keys, decrypted traffic and injected code that vanish on restart. Security decides.
Minutes 10 to 15: first containment, the narrowest control. Block the destination identified in minutes 0 to 5 at the egress firewall or security group. This changes only the network; it does not touch the host's memory, disk or logs, and the socket, process and packet evidence is already saved. Confirm the egress rate falls to baseline and that no new destination takes over.
Minutes 15 to 30: the remaining evidence. Export the network flow logs and application logs for the window, take a disk snapshot through the platform (which copies the disk without stopping the service), hash and record each item.
Minutes 30 to 45: broaden containment. Controls come in two categories; apply the least disruptive that works.
| Category | Examples | Cost to service |
|---|---|---|
| Network level | Block the destination at the egress firewall (a filter on traffic leaving the network) or the security group (a cloud virtual firewall attached to the instance); replace the default outbound rule with an allowlist (only listed destinations are permitted, everything else is denied); sinkhole the destination's DNS (answer lookups for that name with a harmless address so connections fail); move the host to a quarantine segment, an isolated network area that denies outbound traffic | Low if the service needs few external destinations |
| Application level | Revoke and rotate the API keys, database credentials and tokens the host can use; disable the suspect endpoint or feature through a flag; put the service into read-only mode; add a rule to the web application firewall (WAF, a filter in front of a web service that inspects requests and blocks matching ones) | Low to medium, depends on the feature |
Keep the host running and quarantined if it can be, for forensics. A block of one destination does not stop an attacker who has a second one, so keep watching the egress rate and new destinations after each control. An allow-only security group blocks by removing allow rules, and connections already open may continue until they close, which is another reason to verify by the rate and not by the rule change.
Minutes 45 to 60: scope and decide. Find out what the process read (database audit logs, object access logs), whether other hosts show the same destination, and how it got in. Tell counsel and the privacy officer: if personal data left, notification clocks may start, and counsel needs the time of awareness.
Bringing the service back safely
Return the service on new, known-good capacity, not on the suspect host:
- Rebuild from a verified image or a signed build, not from the compromised host's disk.
- Rotate every secret the old host could read, including database, API and cloud credentials, before the new hosts go live.
- Patch or remove the entry point, or at least close it with a compensating control (a control that reduces the risk when the root cause is not yet fixed), such as a WAF rule or disabling the feature.
- Keep the permanent egress allowlist so a repeat spike cannot reach unknown destinations.
- Ramp traffic gradually (a canary, which is a small share of traffic to the new hosts first) with alerts on outbound volume and new destinations, and a defined observation period before closing the incident.
- Keep the quarantined originals until forensics releases them in writing.
Criteria to go back: you can explain the cause or have contained the identified path, the secrets are rotated, and egress is at baseline on clean hosts. If the cause is unknown, return with tighter egress controls and extra monitoring, accept that confidence is lower, and keep the investigation open.
Common mistakes
- Rebooting the host first, which erases memory and active connections.
- Blocking one destination and calling it done, when the attacker has a second one.
- Using name lookups or noisy tools on the suspect host.
- Writing evidence onto the suspect host's own disk.
- Restoring the same disk image and the same credentials.
Design the incident response process for a company that handles regulated financial data and must report a qualifying incident to its regulator within 24 hours of detection. How do you preserve evidence for audits, restrict who sees what, automate data preservation, and test that the process actually meets the deadline?
Sample Answer
The idea in plain words
A 24-hour reporting deadline turns incident response into a race against a clock the company does not control. Normal practice, where leaders gather facts for days and then decide whether to report, no longer works. The design principle: decide in advance everything that can be decided in advance (what counts as "qualifying", who decides, what the first report must contain, who can approve it), and automate everything that does not need judgment (starting the clock, preserving evidence, assembling the report draft), so the humans spend their 24 hours on the few judgments that cannot be pre-made. The deadline in this question is a hypothetical rule used for design; real regimes define the starting event, the qualifying test and the content of a first report differently, so the real definitions come from counsel and the regulator's text, and are written into the process.
Terms used here:
- Qualifying incident: an incident that meets the regulator's reporting criteria (for example, defined thresholds of impact on service or data). The criteria are set by the regulation.
- Detection: the event that starts the clock. The process must define it exactly (for example, the moment an analyst classifies an alert as a possible qualifying incident) and counsel must agree the definition.
- Initial report: the first, partial notice. Many regimes allow it to be incomplete and followed by updates; the process must confirm that this one does.
- Legal hold: counsel's instruction to stop deleting relevant records. Chain of custody: the record of who handled each item of evidence.
- Write-once storage: storage that cannot be altered or deleted until a retention date.
- Tabletop: a discussion-only exercise in which people talk through a scenario; a drill actually runs the systems and the clock. A synthetic alert is a deliberately fabricated alert injected to start a drill. A regulator test channel is a non-production submission route some regulators offer for practice.
- Just-in-time access: permission granted for a short window when needed, then removed automatically. Separation of duties: no single person can both approve a report and alter the evidence behind it.
- Lifecycle and cleanup jobs: automated jobs that delete or archive old data to save cost, which would delete evidence unless told to skip it.
The design
1. Clock and definitions.
- The incident record writes a timestamp, automatically and in UTC, the moment an alert is classified as a possible qualifying incident. Nobody types it in, and nobody can edit it without a logged reason.
- Counsel pre-approves the qualifying criteria as a short checklist the decision-maker applies to facts. An illustrative checklist, with the thresholds left as placeholders because the regulation sets them: (1) Is an in-scope system or dataset affected? Yes, no or unknown. (2) Is the impact at or above the regulator's threshold of [duration, number of customers or records]? Yes, no or unknown. (3) Was regulated customer data accessed or disclosed? Yes, no or unknown. (4) Does any other regime or contract also set a clock? Yes, no or unknown. A rule on the sheet says any "unknown" on item 1 to 3 is treated as yes for the clock and revisited as facts arrive. If a fact is unknown, the default is to treat the clock as running and decide with what is known.
- The initial report template is pre-filled by the system with: incident ID, clock start in UTC, affected systems from the asset inventory, the time the activity was first seen, and a contact. The decision-maker fills in only the fields that need judgment: current impact (known and unknown, in separate lines), actions taken, and the time of the next update.
- Named decision-maker and two delegates, covering all time zones and weekends, with a paging rule if the first does not respond in a set time.
2. Time budget. A budget gives every stage a limit, so a stage that overruns is visible. The hours are assumptions for illustration:
| Stage | Budget (hours) | Ends at hour |
|---|---|---|
| Assemble first facts and complete the incident record (the clock was started automatically at hour 0 by the classification) | 1 | 1 |
| Scoping and checking the qualifying criteria | 3 | 4 |
| Qualification decision by the named decision-maker with counsel | 4 | 8 |
| Draft the initial report from a template pre-filled with system data | 6 | 14 |
| Legal and executive approval | 4 | 18 |
| Submit via the regulator channel and obtain confirmation | 2 | 20 |
| Buffer for channel failure or delay | 4 | 24 |
All hours are counted from the automatic timestamp, so the first row is the first hour after classification, not the work before it. Alert triage that happens before an alert is classified sits outside the table, which is why the definition of detection must be agreed with counsel and not drift later. The stages sum to 1 + 3 + 4 + 6 + 4 + 2 = 20 hours, and the 4-hour buffer brings the total to 24. The stages run partly in parallel in practice (drafting starts before the decision is final), which is where the real slack comes from.
3. Preserving evidence for audits, automated.
The same event that starts the clock triggers a preservation runbook (a scripted procedure), so evidence does not depend on someone remembering at 3 a.m.:
- Tag the affected resources with a hold marker that the lifecycle and cleanup jobs respect.
- Snapshot volumes and export logs and cloud audit trails for the relevant window to a write-once evidence account, then hash each item and write a custody entry.
- Record every decision, including the decision that something is not qualifying and why, because auditors look for the rationale of non-reports as well as reports.
The automation role can create snapshots and copy to the evidence account but cannot delete, so a compromised automation cannot erase evidence. Expressed as permissions, an illustrative version: the role is allowed the actions "create snapshot", "read logs" and "write object" on the evidence account, and has no "delete" or "change retention" action anywhere; the evidence account separately enforces write-once retention, so even a role that did have delete rights could not remove an item early.
4. Restricting who sees what.
- Tiers: the response team sees technical evidence; legal and compliance see the incident record and the draft report; executives see the summary; auditors get read access by request.
- Customer financial data in evidence is visible only to the named examiners, with just-in-time access that expires (for example, in 24 hours) and is logged.
- Separation of duties: the person who approves the report is not the person who can change evidence.
5. Testing that the deadline is met.
- Run timed drills, not only tabletop discussions. Inject a synthetic alert, run the whole chain and submit to the regulator's test channel if one exists, or to an internal stand-in.
- Run some drills at night and on weekends, with a different person in the lead role, and with the primary decision-maker unavailable.
- Record the time of each stage and the end-to-end time. Also verify that the preserved evidence can be restored and its hash matches.
- In production, alarm when the clock reaches 50% (hour 12) without a qualification decision, and again at 75% (hour 18) without a submission.
Worked example of a drill result (assumed values)
Six drills finish after 14.5, 17, 11, 19.5, 13 and 16 hours. Their sum is 14.5 + 17 + 11 + 19.5 + 13 + 16 = 91 hours, so the mean is 91 / 6 = 15.17 hours. The slowest is 19.5 hours (the weekend drill, assumed), which leaves 24 - 19.5 = 4.5 hours of margin, or 4.5 / 24 = 18.75% of the deadline.
An illustrative acceptance rule: every drill must finish within 20 hours, the budget before the buffer. The number that drives the decision is the slowest drill against the budget, not the mean: a deadline is missed by the worst case, not the average. All six pass (the slowest, 19.5, is below 20), but the weekend drill used 19.5 / 20 = 97.5% of the budget, so the process meets the rule only barely and the slow stage (here, approvals) is the first thing to fix. This rule only covers the elapsed time of these six drills. Six drills are too few to claim the real deadline will always be met, because a real incident can bring a bigger scope, an unavailable approver or a regulator channel outage. A real programme also tracks drill results over time, widens the scenarios and keeps the stage budgets visible.
Judgment
I would invest first in the pre-approved qualification checklist and the automated clock-and-preserve trigger, because they remove the two biggest sources of delay: debate about whether to report, and manual evidence work. What would flip it: if the regulator allows only a very thin initial report, the drafting budget shrinks and the approval stage becomes the critical path.
Common mistakes: letting the clock start when "the investigation concludes", having a single decision-maker with no delegate, drafting the report from scratch each time, and testing only in business hours.
Unlock Full Question Bank
Get access to all 7 Security Incident and Breach Response interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.