/Incident Response & Forensics in AWS
Concept Detail

Incident Response & Forensics in AWS

Difficulty: hard

Overview


AWS incident response follows the NIST framework: Prepare → Detect → Contain → Eradicate → Recover → Post-Incident.

EC2 Instance Compromise Response:

  1. Snapshot & preserve: Create EBS snapshot and AMI before any changes
  2. Isolate: Attach a "quarantine" security group (deny all inbound/outbound)
  3. Investigate: Analyze EBS snapshot on a forensics instance in an isolated VPC
  4. Revoke: If instance profile credentials are compromised, attach deny-all policy to the role
  5. Terminate: Only after forensics are complete

Never SSH with the original key pair during forensics — use SSM Session Manager for agentless access without opening port 22.

IAM Credential Compromise Response:

  1. Immediately deactivate the compromised access key (do NOT delete yet — needed for audit)
  2. Create new access key
  3. Review CloudTrail for all API calls made with the compromised key (check ALL regions)
  4. Identify and remediate unauthorized resources created
  5. Revoke active role sessions if a role was assumed

Automated Incident Response Pattern:

  • GuardDuty finding → EventBridge rule (match finding severity/type) → Lambda → auto-remediate
  • Example: GuardDuty detects port scan → Lambda adds attacker IP to WAF IP set
  • Example: GuardDuty detects credential exfiltration → Lambda attaches deny policy to role

S3 Ransomware Response:

  • Enablement (proactive): S3 Versioning + MFA Delete + Object Lock
  • Detection: GuardDuty S3 findings, CloudTrail S3 data events
  • Recovery: Restore from previous versions; Object Lock prevents deletion in advance

Forensic Snapshot Workflow:

  1. Create EBS snapshot of all volumes (root + data)
  2. Share snapshot (if needed) to forensic account
  3. Create volume from snapshot in isolated VPC
  4. Attach to forensics instance (read-only mount recommended)
  5. Analyze with memory forensics tools, file system analysis

Key Automation Services:

  • SSM Automation: Pre-built runbooks for IR (e.g., isolate EC2, revoke credentials)
  • EventBridge + Lambda: Custom automated response workflows
  • AWS Step Functions: Complex multi-step IR workflows with error handling

Practice Linked Questions


medium

Q1. A security team needs to investigate a potentially compromised EC2 instance without SSH access and without opening inbound port 22. Which AWS service enables secure remote access for investigation?


Select one answer before revealing.

medium

Q2. During incident response, a security team finds a potentially compromised EC2 instance. What should be the FIRST action to preserve forensic evidence before containing the threat?


Select one answer before revealing.

medium

Q3. An IAM user's access keys were accidentally committed to a public GitHub repository and detected within 10 minutes. What is the CORRECT response sequence?


Select one answer before revealing.

hard

Q4. A company wants to automatically ISOLATE an EC2 instance when GuardDuty generates a HIGH-severity finding. What is the MOST efficient automated approach?


Select one answer before revealing.

medium

Q5. GuardDuty detects high-volume unusual DELETE operations on an S3 bucket, suggesting a ransomware attack. Which AWS feature, if enabled BEFORE the attack, would allow recovery of the deleted objects?


Select one answer before revealing.

hard

Q6. When responding to a confirmed AWS account compromise, which of the following are RECOMMENDED immediate actions? (More than one answer may be correct — Select THREE.)


Select one answer before revealing.

hard

Q7. A company discovers an EC2 instance in a public subnet was compromised and used to scan internal resources. The security team needs to ISOLATE the instance for forensics without losing any evidence. Which TWO actions should be taken IMMEDIATELY in the correct order? (More than one answer may be correct — Select TWO.)


Select one answer before revealing.