(sec309) amazon vpc configuration: when least privilege meets the penetration tester | aws re:invent...

56
November 13, 2014 | Las Vegas, NV Jason Bubolz, iSEC Partners

Upload: amazon-web-services

Post on 02-Jul-2015

931 views

Category:

Technology


1 download

DESCRIPTION

Enterprises trying to deploy infrastructure to the cloud and independent software companies trying to deliver a service have similar problems to solve. They need to know how to create an environment in AWS that enforces least-privilege access between components while also allowing administration and change management. Amazon Elastic Cloud Compute (EC2) and Identity and Access Management (IAM), coupled with services like AWS Security Token Service (STS), offer the necessary building blocks. In this session, we walk through some of the mechanisms available to control access in an Amazon Virtual Private Cloud (VPC). Next, we focus on using IAM and STS to create a least-privilege access model. Finally, we discuss auditing strategies to catch common mistakes and discuss techniques to audit and maintain your infrastructure.

TRANSCRIPT

Page 1: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

November 13, 2014 | Las Vegas, NV

Jason Bubolz, iSEC Partners

Page 2: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 3: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 4: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 5: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 6: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 7: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 8: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 9: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Default

Inbound

22 TCP 0.0.0.0/0

80 TCP 0.0.0.0/0

443 TCP 0.0.0.0/0

WebServers-SG

Inbound

22 TCP JumpHosts-SG

80 TCP 0.0.0.0/0

443 TCP 0.0.0.0/0

JumpHosts-SG

Inbound

22 TCP 192.168.10.0/24

Page 10: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Amazon S3

Administrators

Page 11: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 12: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 13: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 14: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 15: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Web Front End

Application Layer

Data LayerETL Host Data Warehouse

Amazon S3: Storage

& Configuration

Amazon SNS: Mobile Push

Admin Jump Host

Amazon DynamoDB:

Session Management

Page 16: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 17: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 18: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Amazon S3: Storage

& Configuration

Amazon DynamoDB:

Session Management

Amazon SNS: Mobile Push

Web Front End

Application Layer

Data LayerETL Host Data Warehouse

Admin Jump Host

Page 19: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Admin HostNAT Front End

ELB

Data LayerETL Host

App LayerWeb Front End

Data Warehouse

Monkeybuffer.org VPC

private subnet: Data Storage

private subnet: Application Servers

private subnet: Analytics

VPN Connection to Corpnet

public subnet: Internet Access Layer

Internet Gateway

Page 20: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 21: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 22: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 23: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 24: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 25: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

default

In 22 TCP 192.168.10.0/24

In 80 TCP 0.0.0.0/0

In 443 TCP 0.0.0.0/0

In 3306 TCP 192.168.10.0/24

Out ALL TCP 0.0.0.0/0

Web Front End Application

Layer

Data

WarehouseAdmin

Jump Host

Page 26: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Web Front End Application Layer Data Layer Data Warehouse ETL Host Admin Jump Host

Web Front End Data LayerApplication

LayerData

WarehouseAdmin

Jump Host

ETL Host

Page 27: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

HTTP Listener WS Client AWS Client Admin Client

Admin Listener

Web Front End

Page 28: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Web Front End

Application Layer

Data Layer

ETL Host

Data Warehouse

Admin Jump Host

Admin

Client

Admin

Client

Admin

Client

Admin

Client

Admin

Client

Admin

Listener

HTTP

Listener

WS

Listener

Data

Client

WS

Client

Data

Listener

Data

ClientEDW

Client

EDW

Listener

AWS

Client

AWS

Client

Page 29: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Web Front End

Application Layer

Data Layer

ETL Host

Data Warehouse

Admin Jump Host

Page 30: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 31: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 32: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 33: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 34: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 35: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 36: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

aws:SecureTransport Enforce HTTPS use for API access

aws:MultiFactorAuthAge Using a Null check comparison, force MFA

authentication for sensitive operations (works with

AssumeRole workflows)

aws:CurrentTime Using a DateLessThan comparison, limit the lifetime

of temporary privilege escalations

aws:SourceIp Restrict deployment-altering actions to requests

originating from the corporate network

Page 37: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 38: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Operations

Engineering

Business

Intelligence

Support

{"Version": "2012-10-17","Statement": [

{ "Action": "ec2:*", "Effect": "Allow", "Resource": "*" }, { "Action": "s3:*", "Effect": "Allow", "Resource": "*" }, { "Action": "dynamodb:*", "Effect": "Allow", "Resource": "*" },{ "Action": "sns:*", "Effect": "Allow", "Resource": "*" },

] }

Initial Engineering Policy Document

Page 39: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 40: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

EC2 Instance

MgmtEC2

Configuration

Readers

EC2 Admin

S3

Configuration

Bucket

Readers

S3 Writers

IAM Readers

Engineering User

Page 41: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 42: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 43: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 44: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 45: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 46: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 47: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Web Front End

Application Layer

Page 48: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Action": ["s3:ListBucket"],"Resource": ["arn:aws:s3:::monkeybufferfiles"]

},{"Effect": "Allow","Action": [ "s3:GetObject" ],"Resource": [

"arn:aws:s3:::monkeybufferfiles/configuration” ]}

]}

WebFrontEndInstance Role Policy Document

Page 49: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

{"Id": "Policy1412633321994","Statement": [{"Sid": "Stmt1412633314407","Action": [ "s3:ListBucket", "s3:GetObject"

],"Effect": "Allow","Resource":

"arn:aws:s3:::monkeybufferfiles/configuration","Principal": {"AWS": [

"arn:aws:iam::accountid:role/WebFrontEndInstance","arn:aws:iam::accountid:role/AppLayerInstance" ]

}}

]} MonkeyBufferFiles S3 Bucket Policy Document

Page 50: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:RunInstances", "Resource": "*"

}, { "Effect": "Allow", "Action": "iam:PassRole", "Resource":

"arn:aws:iam::accountid:role/WebFrontEndInstance" }

] }

PassRole User Policy Document

Page 51: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

Does the account follow IAM Best Practices?

Is CloudTrail logging enabled?

Do IAM and resource access policies match requirements

and are they minimal?

Are AWS access keys, cryptography keys, or other

passwords exposed in source or configuration?

Does the account follow proper security design for all

additional AWS services?

Page 52: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 53: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014
Page 54: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

https://github.com/Netflix/security_monkey

https://github.com/iSECPartners/Scout2

Page 55: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

To Begin • Ensure consistency across regions

• Enable CloudTrail logging

• Enforce IAM Best Practices: manage user accounts like you

would manage your own infrastructure

• Limit access to "* on *" policies

Next Steps • Match access to roles and requirements

• Employ IAM roles and Amazon EC2 instance credentials

• Strictly limit policies assigned to static service credentials

• Eliminate access to unused AWS services

• Lock down storage services to mitigate information leaks

Finally • Establish regular reviews

• Investigate changes and challenge expansive privileges

Page 56: (SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration Tester | AWS re:Invent 2014

http://bit.ly/awsevals