SlideShare a Scribd company logo
1 of 24
Download to read offline
Pentesting AWS 101
Get Ready for Hands-on AWS Security
Who IAM
12+ years of Experience in
â—Ź Application Security
â—‹ Threat Modeling
â—‹ Secure Code Review
â—‹ Secure Code Training
â—Ź Cloud Security
â—Ź Security Automation using
Python3
â—Ź Pentest & OWASP Top 10
Sanjeev Jaiswal (Jassi)
What you know
in AWS
Minimal AWS assumptions
â—Ź Can access AWS Console access
â—Ź Good idea of IAM features
â—Ź EC2 related operations
â—Ź How to work with S3 buckets
â—Ź Aware of ELB
â—Ź Security group, NACL
â—Ź API gateway
â—Ź Understanding of Lambda
â—Ź Various topics in VPC
â—Ź Security of|in the cloud
What I will cover
Fundamentals
â—Ź IAM pitfalls
â—Ź S3 Security
â—Ź IMDSv1 vs IMDSv2
â—Ź Vulnerable Public IPs, ELBs,
Endpoints
â—Ź Lambda Security (Intermediate)
â—Ź ECS Security (Advanced)
Hands-On
â—Ź Flaws.cloud (1&2)
â—Ź CloudGoat Scenarios
â—Ź Pacu
â—Ź Prowler
Prerequisites: Python3, Terraform,
aws-cli, git
Installed
&
Verified
Pentesting AWS
How itʼs different from traditional
Pentest?
â—Ź Infrastructure
â—‹ External
â—‹ Internal
â—Ź Environment
â—‹ Hybrid
â—‹ Native
â—Ź Application Implementation
â—‹ Serverless/Lambda
â—‹ Beanstalk
○ Lightsail …
● Data Storage (S3, RDS …)
â—Ź Security Misconfigurations (IAM)
Rules for Pentest in AWS
â—Ź Testing AWS Infrastructure
â—Ź No DoS and DDoS without notification
â—Ź No Port flooding
â—Ź No Protocol flooding
â—Ź No Network Stress testing without
Notification
â—Ź Mail if you are unsure:
â—‹ aws-security-simulated-event@amazon.com
Testing Customer Owned Application
Free to use any Pentest Tools
8 permitted Amazon Services
â—Ź Amazon EC2 instances, NAT Gateways, and Elastic
Load Balancers
â—Ź Amazon RDS
â—Ź Amazon CloudFront
â—Ź Amazon Aurora
â—Ź Amazon API Gateways
â—Ź AWS Lambda and Lambda Edge functions
â—Ź Amazon Lightsail resources
â—Ź Amazon Elastic Beanstalk environments
Pacu/CloudGoat Testing environments follow
AWS security Best Practices
https://aws.amazon.com/security/penetration-testing/
IAM Security issues
â—Ź Permissive policies
â—‹ Resource policy: No * please
â—‹ IAM policy: put*, attach*, policy versioning, group|user management related policies
â—‹ Service Role Trust Policy
â—Ź Cross-Account Permissions
â—Ź Misconfigured IAM Role combination
â—Ź Poorly written policies
â—Ź Published without proper validation and review
S3 Security issues
â—Ź Publicly listed buckets and objects majorly in us-east-1 and eu-west-1 region
â—Ź Authorised to any AWS user
â—Ź Authorised to any AWS user in a specific region
â—Ź Common bucket enumeration
â—Ź No Cloudfront or WAF to avoid direct bucket exposure
â—Ź Default Encryption is not enabled
â—Ź No https enforcement for put objects
â—Ź Permissive bucket policy or bucket policy missing
â—Ź Virtual hosted: https://bucketname.s3.Region.amazonaws
â—Ź Path Style: https://s3.Region.amazonaws.com/bucket-name/
IMDSv1 vs IMDSv2
â—Ź IMDS: Instance Metadata Service
● Instance Metadata Service Version 1 (IMDSv1) – a request/response method
● Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method
â—Ź By default you can use either IMDSv1 or IMDSv2 or both
â—Ź IMDS makes available metadata about the instance, its network, and its storage.
â—Ź It makes AWS creds available for any IAM role that is attached to the instance.
â—Ź SSRF attack is quite possible
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RequireImdsV2",
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringNotEquals": {
"ec2:MetadataHttpTokens": "required"
}
}
}
]
}
Enforce IMDSv2: Policy based (Mitigation)
Pentesting AWS
- Demo
Exploit the misconfigurations
â—Ź Flaws.cloud
â—Ź Cloudgoat
â—‹ Overview and tool walkthrough
â—‹ iam_privsec_by_rollback
â—‹ cloud_breach_s3
â—Ź Pacu
â—‹ Introduction and setup
â—‹ iam_privsec_by_rollback
â—‹ ec2_ssrf
flaws.cloud
Get the real heat
â—Ź Url: http://flaws.cloud/
â—Ź It has total 6 levels
â—Ź Covering misconfigurations in
â—‹ S3 (3 scenarios)
â—‹ EC2 snapshot is made public
â—‹ Reverse Proxy with IMDSv1 enabled
â—‹ Lambda with excessive permission
Cloudgoat
Exploit the vulnerable settings
â—Ź Cloudgoat
â—‹ By Rhino Security Labs
â—‹ Vulnerable by design
â—‹ Overview and tool walkthrough
â—Ź Demo of some scenarios
â—‹ iam_privsec_by_rollback
â—‹ cloud_breach_s3
â—‹ ec2_ssrf
â—‹ rce_webapp
How to use Cloudgoat
1. Once you clone the repo, go to cloudgoat directory
2. run `pip3 install -r ./core/python/requirements.txt`
3. Make sure cloudgoat.py is executable `chmod u+x cloudgoat.py`
4. run ./cloudgoat.py config profile and click y, then give profile name as default
5. whitelist your IP, run this command: `./cloudgoat.py config whitelist --auto` and
type yes to continue
6. List all scenarios: ./cloudgoat.py list all|undeployed|deployed
7. Deploy the scenario: ./cloudgoat.py create scenario_name
Pacu - Cloud
Pentesting
Framework
Tool to make attackers job easier
â—Ź Pacu
â—‹ Open-source AWS Exploitation
Framework
â—‹ By Rhino Security Labs
â—‹ Written in Python
â—Ź Exploitation Demo
â—‹ Introduction and setup
â—‹ cloud_breach_s3
â—‹ iam_privsec_by_rollback
â—‹ ec2_ssrf
â—‹ codebuild_secrets
How to use Pacu
1. You can use pacu for cloudgoat scenarios
1. First deploy some scenarios to make pacu working easily
2. Once you clone the repo, go to pacu directory
3. Run cli.py as python3 cli.py or ./cli.py
4. Set a new session name or use existing one
5. Import all keys or import only one key `import_keys --all`
6. choose which key you want to import
1. import_keys <profile-name>
2. run whoami
7. Check if pacu settings are working. Run aws sts get-caller-identity --profile
<profile-name>
8. See what modules are available in pacu: `list` (run once import key step is done)
What’s Next
â—Ź AWS Security Automation: https://github.com/awslabs/aws-security-automation
â—Ź SANS SEC573: https://www.sans.org/course/automating-information-security-with-python
● Automate event-driven security stuffs using AWS Lambda in Python
â—Ź Automate AWS Services security assessment using Python
â—Ź Automate AWS CIS benchmarks
â—Ź Automate AWS Exploits
â—Ź Automate/Solve AWS Based CTF challenges
â—Ź Use Pacu, Prowler, ScoutSuite for AWS Exploitation and Security Assessment
â—Ź Make command line tool using click module, similar to weirdAAL
â—Ź Breaking and Pwning Apps and Servers on AWS and Azure - Free Training Courseware and Labs
Resources
AWS Pentesting By PackT
AWS CLI by Amazon
Boto3 Documentation
https://github.com/RhinoSecurityLabs/cloudgoat
https://github.com/RhinoSecurityLabs/pacu
https://github.com/toniblyx/my-arsenal-of-aws-security-tools
https://sra.io/blog/aws-iam-exploitation/
https://github.com/jassics/awesome-aws-security
@jassics
/in/jassics
jassics@gmail.com
github.com/jassics
youtube.com/c/Flexmind
My Social Handles
Credits
Image Credit
â—Ź Noun Project
â—Ź Flaticon
Content Credits
â—Ź Aws-well-architected-labs
â—Ź Boto3 Doc
â—Ź Cloudgoat and pacu

More Related Content

What's hot

2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CDSimon Bennetts
 
Static Analysis Security Testing for Dummies... and You
Static Analysis Security Testing for Dummies... and YouStatic Analysis Security Testing for Dummies... and You
Static Analysis Security Testing for Dummies... and YouKevin Fealey
 
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...Amazon Web Services
 
Iam presentation
Iam presentationIam presentation
Iam presentationAWS UG PK
 
Breaking The Cloud Kill Chain
Breaking The Cloud Kill ChainBreaking The Cloud Kill Chain
Breaking The Cloud Kill ChainPuma Security, LLC
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best PracticesAmazon Web Services
 
DevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessDevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessPuma Security, LLC
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat HuntingGIBIN JOHN
 
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Amazon Web Services
 
PaloAlto Enterprise Security Solution
PaloAlto Enterprise Security SolutionPaloAlto Enterprise Security Solution
PaloAlto Enterprise Security SolutionPrime Infoserv
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SASTBlueinfy Solutions
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateAmazon Web Services
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container SecurityPhil Estes
 
Introducing Vault
Introducing VaultIntroducing Vault
Introducing VaultRamit Surana
 
Docker Container Security
Docker Container SecurityDocker Container Security
Docker Container SecuritySuraj Khetani
 
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure Success
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure SuccessAppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure Success
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure SuccessRobert Grupe, CSSLP CISSP PE PMP
 
Threat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using SplunkThreat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using Splunkjamesmbower
 

What's hot (20)

2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD
 
Static Analysis Security Testing for Dummies... and You
Static Analysis Security Testing for Dummies... and YouStatic Analysis Security Testing for Dummies... and You
Static Analysis Security Testing for Dummies... and You
 
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOps
 
Iam presentation
Iam presentationIam presentation
Iam presentation
 
Breaking The Cloud Kill Chain
Breaking The Cloud Kill ChainBreaking The Cloud Kill Chain
Breaking The Cloud Kill Chain
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
 
CI/CD on AWS
CI/CD on AWSCI/CD on AWS
CI/CD on AWS
 
DevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessDevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security Success
 
DevSecOps 101
DevSecOps 101DevSecOps 101
DevSecOps 101
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
 
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
 
PaloAlto Enterprise Security Solution
PaloAlto Enterprise Security SolutionPaloAlto Enterprise Security Solution
PaloAlto Enterprise Security Solution
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SAST
 
CI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and FargateCI/CD with AWS Developer Tools and Fargate
CI/CD with AWS Developer Tools and Fargate
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container Security
 
Introducing Vault
Introducing VaultIntroducing Vault
Introducing Vault
 
Docker Container Security
Docker Container SecurityDocker Container Security
Docker Container Security
 
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure Success
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure SuccessAppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure Success
AppSec & DevSecOps Metrics: Key Performance Indicators (KPIs) to Measure Success
 
Threat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using SplunkThreat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using Splunk
 

Similar to Pentesting AWS 101: Hands-on AWS Security Exploitation

The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldDevOps.com
 
Security and Advanced Automation in the Enterprise
Security and Advanced Automation in the EnterpriseSecurity and Advanced Automation in the Enterprise
Security and Advanced Automation in the EnterpriseAmazon Web Services
 
Building A Cloud Security Strategy for Scale
Building A Cloud Security Strategy for ScaleBuilding A Cloud Security Strategy for Scale
Building A Cloud Security Strategy for ScaleChris Farris
 
004 - Logging in the Cloud -- hide01.ir.pptx
004 - Logging in the Cloud  --  hide01.ir.pptx004 - Logging in the Cloud  --  hide01.ir.pptx
004 - Logging in the Cloud -- hide01.ir.pptxnitinscribd
 
Securing AWS environments by Ankit Giri
Securing AWS environments by Ankit GiriSecuring AWS environments by Ankit Giri
Securing AWS environments by Ankit GiriOWASP Delhi
 
A New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsA New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsChristopher Doman
 
Developer Experience at the Guardian, Equal Experts Sept 2021
Developer Experience at the Guardian, Equal Experts Sept 2021Developer Experience at the Guardian, Equal Experts Sept 2021
Developer Experience at the Guardian, Equal Experts Sept 2021Akash Askoolum
 
DEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityDEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityFelipe Prado
 
2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)Enis Afgan
 
AWS Security Best Practices (March 2017)
AWS Security Best Practices (March 2017)AWS Security Best Practices (March 2017)
AWS Security Best Practices (March 2017)Julien SIMON
 
Security best practices on AWS - Pop-up Loft TLV 2017
Security best practices on AWS - Pop-up Loft TLV 2017Security best practices on AWS - Pop-up Loft TLV 2017
Security best practices on AWS - Pop-up Loft TLV 2017Amazon Web Services
 
AWS Cyber Security Best Practices
AWS Cyber Security Best PracticesAWS Cyber Security Best Practices
AWS Cyber Security Best PracticesDoiT International
 
How to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startupsHow to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startupsAleksandr Maklakov
 
NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1Ruslan Meshenberg
 
Automating AWS security and compliance
Automating AWS security and compliance Automating AWS security and compliance
Automating AWS security and compliance John Varghese
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesRavishankar Somasundaram
 
Aws Architecture Fundamentals
Aws Architecture FundamentalsAws Architecture Fundamentals
Aws Architecture Fundamentals2nd Watch
 

Similar to Pentesting AWS 101: Hands-on AWS Security Exploitation (20)

The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Security and Advanced Automation in the Enterprise
Security and Advanced Automation in the EnterpriseSecurity and Advanced Automation in the Enterprise
Security and Advanced Automation in the Enterprise
 
Building A Cloud Security Strategy for Scale
Building A Cloud Security Strategy for ScaleBuilding A Cloud Security Strategy for Scale
Building A Cloud Security Strategy for Scale
 
Container Security Mmanagement
Container Security MmanagementContainer Security Mmanagement
Container Security Mmanagement
 
004 - Logging in the Cloud -- hide01.ir.pptx
004 - Logging in the Cloud  --  hide01.ir.pptx004 - Logging in the Cloud  --  hide01.ir.pptx
004 - Logging in the Cloud -- hide01.ir.pptx
 
Securing AWS environments by Ankit Giri
Securing AWS environments by Ankit GiriSecuring AWS environments by Ankit Giri
Securing AWS environments by Ankit Giri
 
A New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsA New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud Forensics
 
Developer Experience at the Guardian, Equal Experts Sept 2021
Developer Experience at the Guardian, Equal Experts Sept 2021Developer Experience at the Guardian, Equal Experts Sept 2021
Developer Experience at the Guardian, Equal Experts Sept 2021
 
DEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityDEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud security
 
2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)
 
AWS Security Best Practices (March 2017)
AWS Security Best Practices (March 2017)AWS Security Best Practices (March 2017)
AWS Security Best Practices (March 2017)
 
Security best practices on AWS - Pop-up Loft TLV 2017
Security best practices on AWS - Pop-up Loft TLV 2017Security best practices on AWS - Pop-up Loft TLV 2017
Security best practices on AWS - Pop-up Loft TLV 2017
 
AWS Cyber Security Best Practices
AWS Cyber Security Best PracticesAWS Cyber Security Best Practices
AWS Cyber Security Best Practices
 
How to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startupsHow to implement DevSecOps on AWS for startups
How to implement DevSecOps on AWS for startups
 
NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1
 
Automating AWS security and compliance
Automating AWS security and compliance Automating AWS security and compliance
Automating AWS security and compliance
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimes
 
Kubernetes security with AWS
Kubernetes security with AWSKubernetes security with AWS
Kubernetes security with AWS
 
Aws Architecture Fundamentals
Aws Architecture FundamentalsAws Architecture Fundamentals
Aws Architecture Fundamentals
 
Bbva bank on Open Stack
Bbva bank on Open StackBbva bank on Open Stack
Bbva bank on Open Stack
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
 

Pentesting AWS 101: Hands-on AWS Security Exploitation

  • 1. Pentesting AWS 101 Get Ready for Hands-on AWS Security
  • 2. Who IAM 12+ years of Experience in â—Ź Application Security â—‹ Threat Modeling â—‹ Secure Code Review â—‹ Secure Code Training â—Ź Cloud Security â—Ź Security Automation using Python3 â—Ź Pentest & OWASP Top 10 Sanjeev Jaiswal (Jassi)
  • 3. What you know in AWS Minimal AWS assumptions â—Ź Can access AWS Console access â—Ź Good idea of IAM features â—Ź EC2 related operations â—Ź How to work with S3 buckets â—Ź Aware of ELB â—Ź Security group, NACL â—Ź API gateway â—Ź Understanding of Lambda â—Ź Various topics in VPC â—Ź Security of|in the cloud
  • 4. What I will cover Fundamentals â—Ź IAM pitfalls â—Ź S3 Security â—Ź IMDSv1 vs IMDSv2 â—Ź Vulnerable Public IPs, ELBs, Endpoints â—Ź Lambda Security (Intermediate) â—Ź ECS Security (Advanced) Hands-On â—Ź Flaws.cloud (1&2) â—Ź CloudGoat Scenarios â—Ź Pacu â—Ź Prowler Prerequisites: Python3, Terraform, aws-cli, git
  • 6. Pentesting AWS How itĘĽs different from traditional Pentest? â—Ź Infrastructure â—‹ External â—‹ Internal â—Ź Environment â—‹ Hybrid â—‹ Native â—Ź Application Implementation â—‹ Serverless/Lambda â—‹ Beanstalk â—‹ Lightsail … â—Ź Data Storage (S3, RDS …) â—Ź Security Misconfigurations (IAM)
  • 7. Rules for Pentest in AWS â—Ź Testing AWS Infrastructure â—Ź No DoS and DDoS without notification â—Ź No Port flooding â—Ź No Protocol flooding â—Ź No Network Stress testing without Notification â—Ź Mail if you are unsure: â—‹ aws-security-simulated-event@amazon.com Testing Customer Owned Application Free to use any Pentest Tools 8 permitted Amazon Services â—Ź Amazon EC2 instances, NAT Gateways, and Elastic Load Balancers â—Ź Amazon RDS â—Ź Amazon CloudFront â—Ź Amazon Aurora â—Ź Amazon API Gateways â—Ź AWS Lambda and Lambda Edge functions â—Ź Amazon Lightsail resources â—Ź Amazon Elastic Beanstalk environments Pacu/CloudGoat Testing environments follow AWS security Best Practices https://aws.amazon.com/security/penetration-testing/
  • 8. IAM Security issues â—Ź Permissive policies â—‹ Resource policy: No * please â—‹ IAM policy: put*, attach*, policy versioning, group|user management related policies â—‹ Service Role Trust Policy â—Ź Cross-Account Permissions â—Ź Misconfigured IAM Role combination â—Ź Poorly written policies â—Ź Published without proper validation and review
  • 9. S3 Security issues â—Ź Publicly listed buckets and objects majorly in us-east-1 and eu-west-1 region â—Ź Authorised to any AWS user â—Ź Authorised to any AWS user in a specific region â—Ź Common bucket enumeration â—Ź No Cloudfront or WAF to avoid direct bucket exposure â—Ź Default Encryption is not enabled â—Ź No https enforcement for put objects â—Ź Permissive bucket policy or bucket policy missing â—Ź Virtual hosted: https://bucketname.s3.Region.amazonaws â—Ź Path Style: https://s3.Region.amazonaws.com/bucket-name/
  • 10. IMDSv1 vs IMDSv2 â—Ź IMDS: Instance Metadata Service â—Ź Instance Metadata Service Version 1 (IMDSv1) – a request/response method â—Ź Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method â—Ź By default you can use either IMDSv1 or IMDSv2 or both â—Ź IMDS makes available metadata about the instance, its network, and its storage. â—Ź It makes AWS creds available for any IAM role that is attached to the instance. â—Ź SSRF attack is quite possible
  • 11. { "Version": "2012-10-17", "Statement": [ { "Sid": "RequireImdsV2", "Effect": "Deny", "Action": "ec2:RunInstances", "Resource": "arn:aws:ec2:*:*:instance/*", "Condition": { "StringNotEquals": { "ec2:MetadataHttpTokens": "required" } } } ] } Enforce IMDSv2: Policy based (Mitigation)
  • 12. Pentesting AWS - Demo Exploit the misconfigurations â—Ź Flaws.cloud â—Ź Cloudgoat â—‹ Overview and tool walkthrough â—‹ iam_privsec_by_rollback â—‹ cloud_breach_s3 â—Ź Pacu â—‹ Introduction and setup â—‹ iam_privsec_by_rollback â—‹ ec2_ssrf
  • 13. flaws.cloud Get the real heat â—Ź Url: http://flaws.cloud/ â—Ź It has total 6 levels â—Ź Covering misconfigurations in â—‹ S3 (3 scenarios) â—‹ EC2 snapshot is made public â—‹ Reverse Proxy with IMDSv1 enabled â—‹ Lambda with excessive permission
  • 14. Cloudgoat Exploit the vulnerable settings â—Ź Cloudgoat â—‹ By Rhino Security Labs â—‹ Vulnerable by design â—‹ Overview and tool walkthrough â—Ź Demo of some scenarios â—‹ iam_privsec_by_rollback â—‹ cloud_breach_s3 â—‹ ec2_ssrf â—‹ rce_webapp
  • 15. How to use Cloudgoat 1. Once you clone the repo, go to cloudgoat directory 2. run `pip3 install -r ./core/python/requirements.txt` 3. Make sure cloudgoat.py is executable `chmod u+x cloudgoat.py` 4. run ./cloudgoat.py config profile and click y, then give profile name as default 5. whitelist your IP, run this command: `./cloudgoat.py config whitelist --auto` and type yes to continue 6. List all scenarios: ./cloudgoat.py list all|undeployed|deployed 7. Deploy the scenario: ./cloudgoat.py create scenario_name
  • 16. Pacu - Cloud Pentesting Framework Tool to make attackers job easier â—Ź Pacu â—‹ Open-source AWS Exploitation Framework â—‹ By Rhino Security Labs â—‹ Written in Python â—Ź Exploitation Demo â—‹ Introduction and setup â—‹ cloud_breach_s3 â—‹ iam_privsec_by_rollback â—‹ ec2_ssrf â—‹ codebuild_secrets
  • 17. How to use Pacu 1. You can use pacu for cloudgoat scenarios 1. First deploy some scenarios to make pacu working easily 2. Once you clone the repo, go to pacu directory 3. Run cli.py as python3 cli.py or ./cli.py 4. Set a new session name or use existing one 5. Import all keys or import only one key `import_keys --all` 6. choose which key you want to import 1. import_keys <profile-name> 2. run whoami 7. Check if pacu settings are working. Run aws sts get-caller-identity --profile <profile-name> 8. See what modules are available in pacu: `list` (run once import key step is done)
  • 18. What’s Next â—Ź AWS Security Automation: https://github.com/awslabs/aws-security-automation â—Ź SANS SEC573: https://www.sans.org/course/automating-information-security-with-python â—Ź Automate event-driven security stuffs using AWS Lambda in Python â—Ź Automate AWS Services security assessment using Python â—Ź Automate AWS CIS benchmarks â—Ź Automate AWS Exploits â—Ź Automate/Solve AWS Based CTF challenges â—Ź Use Pacu, Prowler, ScoutSuite for AWS Exploitation and Security Assessment â—Ź Make command line tool using click module, similar to weirdAAL â—Ź Breaking and Pwning Apps and Servers on AWS and Azure - Free Training Courseware and Labs
  • 19. Resources AWS Pentesting By PackT AWS CLI by Amazon Boto3 Documentation https://github.com/RhinoSecurityLabs/cloudgoat https://github.com/RhinoSecurityLabs/pacu https://github.com/toniblyx/my-arsenal-of-aws-security-tools https://sra.io/blog/aws-iam-exploitation/ https://github.com/jassics/awesome-aws-security
  • 20.
  • 21.
  • 23.
  • 24. Credits Image Credit â—Ź Noun Project â—Ź Flaticon Content Credits â—Ź Aws-well-architected-labs â—Ź Boto3 Doc â—Ź Cloudgoat and pacu