Share
## https://sploitus.com/exploit?id=6421561B-13D2-58C9-ABB5-00C705F9E79B
# Cloud Misconfiguration Exploitation Lab
[](aws-lab/)
[](azure-lab/)
[](https://terraform.io)
[](https://python.org)
> **β οΈ EDUCATIONAL PURPOSE ONLY**: This lab creates intentionally vulnerable cloud resources for security training. **DO NOT deploy in production environments.**
## Overview
A fully reproducible cloud security lab demonstrating **privilege escalation chains** from common misconfigurations. Built on the Pacu/ScoutSuite methodology, scoped to a specific attack chain: **"from an over-permissioned Lambda with `iam:PassRole` to full account takeover."**
## Attack Chain
```
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Reconnaissance ββββββΆβ iam:PassRole ββββββΆβ Admin Lambda ββββββΆβ Account β
β (Enumerate β β Exploitation β β Creation β β Takeover β
β vulnerable β β (Pass admin role β β (Backdoor with β β (Persistent β
β Lambda roles) β β to new Lambda) β β admin creds) β β admin access) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
```
## Quick Start
### Prerequisites
- AWS CLI configured with credentials
- Terraform >= 1.5
- Python >= 3.11
- Azure CLI (for bonus module)
### AWS Lab Deployment
```bash
# 1. Clone and enter AWS lab
cd aws-lab
# 2. Initialize Terraform
terraform init
# 3. Deploy vulnerable infrastructure
terraform apply
# 4. Note the outputs (Lambda URL, role ARNs, etc.)
```
### Running the Attack Chain
```bash
# Install dependencies
cd exploit-scripts
pip install -r requirements.txt
# Phase 1: Reconnaissance
python3 reconnaissance.py --profile your-profile
# Phase 2: Privilege Escalation
python3 privilege_escalation.py --profile your-profile
# Phase 3: Post-Exploitation (use keys from Phase 2)
python3 post_exploitation.py --access-key AKIA... --secret-key ...
```
### Azure Bonus Module
```bash
cd azure-lab
terraform init
terraform apply
python3 exploit.py
```
## Project Structure
```
cloud-misconfig-lab/
βββ aws-lab/
β βββ main.tf # Vulnerable AWS infrastructure
β βββ variables.tf
β βββ terraform.tfvars
β βββ cleanup.sh
βββ azure-lab/
β βββ main.tf # Vulnerable Azure infrastructure
β βββ variables.tf
β βββ terraform.tfvars
β βββ exploit.py
β βββ cleanup.sh
βββ exploit-scripts/
β βββ reconnaissance.py # Phase 1: Information gathering
β βββ privilege_escalation.py # Phase 2: iam:PassRole exploit
β βββ post_exploitation.py # Phase 3: Data exfiltration & persistence
β βββ pacu_integration.py # Pacu-style module integration
β βββ requirements.txt
βββ docs/
βββ writeup.md # Detailed attack walkthrough
```
## Vulnerabilities Demonstrated
| Vulnerability | Impact | CWE |
|-------------|--------|-----|
| `iam:PassRole` without service restriction | Privilege escalation | CWE-250 |
| Lambda with wildcard assume role | Lateral movement | CWE-287 |
| Public S3 bucket with sensitive data | Data breach | CWE-276 |
| Overly permissive security groups | Network compromise | CWE-1326 |
| Unauthenticated Lambda function URL | Unauthorized access | CWE-306 |
| Azure Function App as Contributor | Subscription takeover | CWE-250 |
| Public Azure Blob storage | Data exfiltration | CWE-276 |
## Pacu Integration
The `pacu_integration.py` script provides Pacu-compatible output format. To use with Pacu:
```bash
# Install Pacu
pip install pacu
# Run our module in Pacu style
python3 exploit-scripts/pacu_integration.py --module recon
```
## Cleanup
**β οΈ IMPORTANT: Destroy resources after use to avoid charges**
```bash
# AWS cleanup
cd aws-lab && ./cleanup.sh
# Azure cleanup
cd azure-lab && ./cleanup.sh
```
## License
MIT License - For educational and authorized security testing only.