PISA Pakistan — Community CERT

← ⚙️ SOC Analyst Foundations

31. Digital Forensics for Cloud Workloads and Kubernetes

⏱ 11 min

Cloud Forensics vs Traditional Forensics

Traditional forensics rely on physical disk images; cloud environments abstract storage and compute, requiring a new set of acquisition steps. In Pakistan, PTA mandates that telecom operators retain logs for at least 12 months, while SBP requires financial institutions to keep transaction data for five years. SOC analysts must understand how to collect admissible evidence without violating these regulations.

Acquiring Evidence from AWS/GCP

  1. Snapshot the EBS volume (AWS) or persistent disk (GCP) while the instance is stopped.
  2. Create an IAM role with ec2:DescribeSnapshots and ebs:CreateSnapshot permissions; apply the principle of least privilege.
  3. Generate a snapshot via the console or CLI: aws ec2 create-snapshot --volume-id vol-0abcd1234 --description "Forensic snapshot – SOC-2026-05".
  4. Copy the snapshot to a dedicated forensic S3 bucket with encryption (aws s3 cp s3://forensics-bucket/snapshot.tar.gz s3://forensics-bucket/ --sse AES256).
  5. Mount the snapshot to a forensic analysis EC2 instance using aws ec2 attach-volume and linux mount (read‑only).

Kubernetes Audit Log Collection

  • Enable audit logging in the kube‑apiserver by setting --audit-policy-file=/etc/kubernetes/audit-policy.yaml.
  • Forward logs to Elasticsearch via Fluentd or Filebeat DaemonSet.
  • Create an index pattern kubernetes-audit-* and set a retention policy aligned with PTA (12 months).

Container Image Layer Analysis

  1. Pull the suspect image from the container registry: docker pull registry.internal/malicious-app:latest.
  2. Inspect history: docker history --no-trunc registry.internal/malicious-app:latest. Look for unexpected commands (e.g., curl downloads).
  3. Extract layers: docker save registry.internal/malicious-app:latest -o /forensics/image.tar and unpack to examine file system differences.
  4. Run YARA scans on extracted binaries using the CIS Kubernetes benchmark rules.
  5. Correlate findings with pod creation timestamps in the audit log to pinpoint the deployment vector.

Do / Don't Checklist

  • Do maintain an immutable forensic bucket (S3 Object Lock) to preserve chain‑of‑custody.
  • Do document every CLI command executed with timestamps in the case management system (TheHive).
  • Don't boot a compromised VM without first creating a snapshot – you risk altering volatile evidence.
  • Don't share raw cloud logs externally without approval from the Data Protection Officer and NCCIA guidance.

Takeaway today: Create a snapshot of an AWS EBS volume associated with a suspicious EC2 instance, attach it read‑only to a forensic analysis host, and extract the relevant logs. Practice this workflow so you can respond to a cloud breach within minutes.

← PrevNext →