hardening aws environment and automating incidence response for aws cmpromises

66
Hardening AWS Environments and Automating Incident Response for AWS Compromises Hardening AWS Environments and Automating Incident Response for AWS Compromises Andrew Krug and Alex McCormack

Upload: priyanka-aash

Post on 09-Jan-2017

43 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Hardening AWS environment and automating incidence response for AWS cmpromises

Hardening AWS Environmentsand

Automating Incident Responsefor

AWS Compromises

Hardening AWS Environments and Automating Incident Response for AWS Compromises ­ Andrew Krug and Alex McCormack

Page 2: Hardening AWS environment and automating incidence response for AWS cmpromises

Disclaimer

Everything you're about to see is our opinion.

Not a guaranteed IR process.

This will not replace preparedness or anincident response retainer.

Hardening AWS Environments and Automating Incident Response for AWS Compromises ­ Andrew Krug and Alex McCormack

Page 3: Hardening AWS environment and automating incidence response for AWS cmpromises

A Challenge

Page 4: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 5: Hardening AWS environment and automating incidence response for AWS cmpromises

Poll

http://etc.ch/zT5A

Page 6: Hardening AWS environment and automating incidence response for AWS cmpromises

ResultsDo you think there's room for improvement?

0 votes ­ 0 participants

Page 7: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 8: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 9: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 10: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 11: Hardening AWS environment and automating incidence response for AWS cmpromises

The Beginning

Page 12: Hardening AWS environment and automating incidence response for AWS cmpromises

Best FreeIR Process

Page 13: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 1Disable the Access Keys

aws iam list-access-keys

aws iam update-access-key \ --access-key-id AKIAIOSFODNN7EXAMPLE \

--status Inactive \ --user-name DeveloperDave

Page 14: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 2Hunt new instances

aws ec2 describe-instances\ --region us-east-1 \

--query 'Reservations[].\

Instances[ ?LaunchTime>=̀2016-03-9̀][].\

{ id: InstanceId,

type: InstanceType, launched: LaunchTime

} '

Page 15: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 3Tell AWS Support

Page 16: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 4Isolate

aws ec2 create-security-group \ --group-name isolation-sg

aws ec2 authorize-security-group-ingress aws ec2 authorize-security-group-ingress \

--group-id sg-BLOCK-ID \ --protocol

aws ec2 modify-instance-attribute --instance-id i-INSTANCE-ID \

--groups sg-BLOCK-ID

Page 17: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 5Tag the Instance

aws ec2 create-tags \ --resources i-INSTANCE-ID \ --tags “Key=Environment, \

Value=Quarantine:REFERENCE-ID”

Page 18: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 6Save the instance metadata

aws ec2 describe-instances \ --instance-ids i-INSTANCE-ID > \

forensic-metadata.log

aws ec2 get-console-output \ --instance-id i-INSTANCE-ID

Page 19: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 7Preserve Disk Data

aws ec2 create-snapshot \ –-volume-id vol-xxxx \

–-description \ “IR-ResponderName- Date-REFERENCE-ID”

Page 20: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 8Acquire Memory

Page 21: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 9Stop the Instance

aws ec2 stop-instances \ --instance-ids i-INSTANCE-ID

Page 22: Hardening AWS environment and automating incidence response for AWS cmpromises

Step 10Analysis

Page 23: Hardening AWS environment and automating incidence response for AWS cmpromises

Poll

http://etc.ch/zT5A

Page 24: Hardening AWS environment and automating incidence response for AWS cmpromises

ResultsDo you think there's room for improvement?

0 votes ­ 0 participants

Page 25: Hardening AWS environment and automating incidence response for AWS cmpromises

Pros and Cons

Page 26: Hardening AWS environment and automating incidence response for AWS cmpromises

The Elephant in the Room

Page 27: Hardening AWS environment and automating incidence response for AWS cmpromises

Security is Difficult

Page 28: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 29: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 30: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 31: Hardening AWS environment and automating incidence response for AWS cmpromises

Tool Release

Page 32: Hardening AWS environment and automating incidence response for AWS cmpromises

Mission Statement

Be the first truly free open source incidentresponse toolkit tailored for Amazon Web

Services. Help first responders by automatingworkflows using Amazon's very own boto3 pip

module.

Page 33: Hardening AWS environment and automating incidence response for AWS cmpromises

Challenge 1

Page 34: Hardening AWS environment and automating incidence response for AWS cmpromises

Margarita Shotgun

Page 35: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 36: Hardening AWS environment and automating incidence response for AWS cmpromises

Module Warehouse

Page 37: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 38: Hardening AWS environment and automating incidence response for AWS cmpromises

Margarita ShotgunWrap Up

Page 39: Hardening AWS environment and automating incidence response for AWS cmpromises

The Road to Automation

Page 40: Hardening AWS environment and automating incidence response for AWS cmpromises

AWS­IR Moduleusage: aws_ir

[-h] [-n CASE_NUMBER]

[-e EXAMINER_CIDR_RANGE] [-c]

[-k KEY_NAME] [-b BUCKET_ID] {

host_compromise, key_compromise, create_workstation

}

Page 41: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 42: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 43: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 44: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 45: Hardening AWS environment and automating incidence response for AWS cmpromises

Analysis Views

Page 46: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 47: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 48: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 49: Hardening AWS environment and automating incidence response for AWS cmpromises

Logs

Page 50: Hardening AWS environment and automating incidence response for AWS cmpromises

Evidence CollectionDisk

Page 51: Hardening AWS environment and automating incidence response for AWS cmpromises

DiskHow it's done.

Page 52: Hardening AWS environment and automating incidence response for AWS cmpromises

Evidence CollectionMemory

Page 53: Hardening AWS environment and automating incidence response for AWS cmpromises

MemoryMethodology

Page 54: Hardening AWS environment and automating incidence response for AWS cmpromises

EvidenceInstance Metadata

Page 55: Hardening AWS environment and automating incidence response for AWS cmpromises

EvidenceConsole Output

Page 56: Hardening AWS environment and automating incidence response for AWS cmpromises

EvidenceScreenshots

Page 57: Hardening AWS environment and automating incidence response for AWS cmpromises

AWS­IRKey Compromise

A command as simple as:

$ python -m aws_ir.cli key_compromise\ --compromised-access-key-id AAYOURKEYHERE

Page 58: Hardening AWS environment and automating incidence response for AWS cmpromises
Page 59: Hardening AWS environment and automating incidence response for AWS cmpromises

ThreatPrep S3 Checks

Page 60: Hardening AWS environment and automating incidence response for AWS cmpromises

ThreatPrep IAM Checks

Page 61: Hardening AWS environment and automating incidence response for AWS cmpromises

Other Checks

Page 62: Hardening AWS environment and automating incidence response for AWS cmpromises

Alternatives From AWS

Page 63: Hardening AWS environment and automating incidence response for AWS cmpromises

Future

Page 64: Hardening AWS environment and automating incidence response for AWS cmpromises

Thank You

Page 65: Hardening AWS environment and automating incidence response for AWS cmpromises

Thank YouDon Bailey AWS

Zack Glick AWS

Page 66: Hardening AWS environment and automating incidence response for AWS cmpromises

Questions?