PathShield is an advanced AWS security scanning tool that discovers privilege escalation paths attackers could exploit. It analyzes IAM relationships, cross-service interactions, and identifies potential attack vectors that could lead to privilege escalation.
- 🔍 IAM Trust Graph Analysis - Map and analyze IAM trust relationships
- 🚨 Cross-Service Escalation Detection - Identify escalation paths across EC2, Lambda, S3, KMS, RDS
- 🔧 CI/CD Ready - Terraform and CloudFormation plan scanning
- 📊 Multi-Format Reporting - CLI, JSON, SARIF, and HTML dashboards
- 🐳 Docker Support - Containerized deployment
- 📈 Plugin Architecture - Extensible design for new services
pip install pathshielddocker pull pathshield/pathshield:latest
docker run --rm -it \
-v ~/.aws:/root/.aws:ro \
pathshield/pathshield:latest \
scan --region us-east-1git clone https://github.com/pathshield/pathshield.git
cd pathshield
pip install -e ".[dev]"# Scan IAM for privilege escalation paths
pathshield scan --region us-east-1
# With verbose output
pathshield scan --region us-east-1 --verbose# Generate Terraform plan
terraform plan -out=tfplan
# Convert to JSON (required)
terraform show -json tfplan > tfplan.json
# Scan with PathShield
pathshield scan --terraform tfplan.json --output results.json# SARIF output for GitHub Advanced Security
pathshield scan --region us-west-2 --format sarif --output results.sarifPathShield can be configured via a YAML configuration file:
# config.yaml
aws:
profile: "default"
region: "us-east-1"
role_arn: "arn:aws:iam::123456789:role/PathShieldRole"
logging:
level: "INFO"
verbose: false
output:
format: "cli"| Variable | Description |
|---|---|
PATHSHIELD_AWS_PROFILE |
AWS profile name |
PATHSHIELD_AWS_REGION |
AWS region |
PATHSHIELD_LOGGING_LEVEL |
Log level (DEBUG, INFO, WARNING, ERROR) |
PATHSHIELD_OUTPUT_FORMAT |
Output format (cli, json, sarif, html) |
# Show help
pathshield --help
# Scan command
pathshield scan --help
# Show version
pathshield version
# Show configuration
pathshield config| Option | Description |
|---|---|
--region |
AWS region (default: us-east-1) |
--profile |
AWS profile name |
--output |
Output format: cli, json, sarif, html |
--output-file |
Path to output file |
--max-depth |
Maximum path depth (default: 5) |
--verbose |
Enable verbose output |
--config |
Path to configuration file |
PathShield/
├── pathshield/
│ ├── main.py # CLI entry point
│ ├── config.py # Configuration management
│ ├── logger.py # Logging setup
│ ├── exceptions.py # Custom exceptions
│ ├── aws/
│ │ └── session.py # AWS session management
│ ├── iam/
│ │ └── analyzer.py # IAM analysis engine
│ ├── services/
│ │ ├── base.py # Plugin base class
│ │ └── ec2.py # EC2 service plugin
│ ├── output/
│ │ └── base.py # Output formatters
│ └── cicd/
│ └── integration.py # CI/CD integrations
PathShield uses a plugin-based architecture for service analysis:
- BaseServicePlugin - Abstract base class for all plugins
- Service Plugins - EC2, Lambda, S3, KMS, RDS
- Output Formatters - CLI, JSON, SARIF, HTML
PathShield identifies common escalation techniques:
- PassRole + EC2 - Attach privileged role to EC2 instance
- PassRole + Lambda - Create Lambda with privileged execution role
- UpdateAssumeRolePolicy - Modify trust policy to assume role
- AttachRolePolicy - Attach policies to gain privileges
# Install development dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks
pre-commit install
# Run tests
pytest tests/ -v --cov=pathshield
# Code formatting
black pathshield/ tests/
flake8 pathshield/ tests/from pathshield.services.base import BaseServicePlugin, ServiceEscalationPath
class MyServicePlugin(BaseServicePlugin):
name = "myservice"
version = "1.0.0"
description = "My service escalation detection"
def collect(self):
# Collect resources from the service
pass
def analyze_escalation(self, iam_graph):
# Analyze for escalation paths
passname: PathShield Scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run PathShield
run: |
pip install pathshield
pathshield scan --format sarif --output results.sarif
- name: Upload SARIF
uses: github/sarif-upload@v1
with:
sarif_file: results.sarifPathShield - AWS Privilege Escalation Scanner
==============================================
Scanning region: us-east-1
Found 3 potential escalation paths:
[CRITICAL] user:developer -> role:ec2-admin
Technique: EC2 Instance Profile Privilege Escalation
[HIGH] user:lambda-tester -> role:kms-admin
Technique: Lambda Role Chaining
{
"scan_timestamp": "2024-01-01T00:00:00Z",
"escalation_paths": [
{
"source": {"name": "developer", "type": "user"},
"target": {"name": "ec2-admin", "type": "role"},
"technique": "EC2 Instance Profile",
"severity": "critical"
}
]
}Standard SARIF 2.1.0 format for integration with security tools.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- AWS IAM documentation
- Cloud Security research community
- Open source security tools