Claude-powered AWS security automation: discover vulnerabilities with ScoutSuite, validate with Pacu, and remediate via AWS MCP servers
Project description
๐ฃ AutoPurple
Claude-powered AWS security automation: discover vulnerabilities with ScoutSuite, validate with Pacu, and remediate via AWS MCP servers
AutoPurple is an intelligent AWS security automation system that combines the power of ScoutSuite discovery, Claude AI analysis, Pacu validation, and AWS MCP servers for end-to-end security remediation.
๐ฏ Mission
AutoPurple automates the complete AWS security assessment and remediation pipeline:
ScoutSuite Discovery โ Claude Analysis โ Pacu Validation โ Claude Planning โ MCP Remediation โ Validation
๐๏ธ Architecture
Core Principles
- Extension over replacement: Reuse and extend ScoutSuite/Pacu; do not reimplement their core logic
- Remediation only after validation: Never remediate unless Pacu confirms exploitability with evidence
- MCP-only infra changes: All AWS changes are executed through AWS MCP servers
- Security-first: Respect existing security mechanisms; least-privilege IAM; audit everything
- Async Python 3.11+: Prefer
asyncio/anyio, structured concurrency, timeouts, and robust error handling
Components
- ScoutSuite Adapter: AWS security discovery and findings normalization
- Pacu Adapter: Exploit validation using Pacu's SQLite session
- MCP Clients: AWS CCAPI, CloudFormation, and Documentation MCP servers
- Claude Planner: AI-driven analysis and remediation planning
- Pipeline Orchestrator: Async DAG for the complete workflow
- Post-Remediation Validator: Confirmation of successful fixes
๐ Quick Start
Prerequisites
- Python 3.11+
- AWS credentials configured
- ScoutSuite installed
- Pacu installed
- MCP servers running (optional)
Installation
# Clone the repository
git clone https://github.com/autopurple/autopurple.git
cd autopurple
# Install dependencies
pip install -e .
# Install development dependencies
pip install -e ".[dev]"
Configuration
Create a .env file:
# Environment
AUTOPURPLE_ENV=dev
# AWS Configuration
AWS_PROFILE=default
AWS_REGION=us-east-1
# MCP Server Endpoints (optional)
MCP_ENDPOINT_CCAPI=http://localhost:8080
MCP_ENDPOINT_CFN=http://localhost:8081
MCP_ENDPOINT_DOCS=http://localhost:8082
# AI Configuration (optional)
CLAUDE_API_KEY=your_claude_api_key
# Database
AUTOPURPLE_DB_PATH=~/.autopurple/db.sqlite
Usage
# Run the complete pipeline
autopurple run --profile my-aws-profile --region us-west-2 --max-findings 20
# Run in dry-run mode (default)
autopurple run --dry-run
# Run discovery only
autopurple discover --output findings.json
# Run validation only
autopurple validate findings.json
# Check system health
autopurple health
# Show recent runs
autopurple status
๐ Database Schema
AutoPurple uses SQLite with the following schema (compatible with Pacu):
-- AutoPurple runs table
CREATE TABLE ap_runs (
id TEXT PRIMARY KEY,
started_at TIMESTAMP NOT NULL,
ended_at TIMESTAMP,
aws_account TEXT,
aws_region TEXT,
status TEXT CHECK(status IN ('started','validated','remediated','failed')) NOT NULL,
notes TEXT
);
-- AutoPurple findings table
CREATE TABLE ap_findings (
id TEXT PRIMARY KEY,
run_id TEXT NOT NULL REFERENCES ap_runs(id) ON DELETE CASCADE,
source TEXT CHECK(source IN ('scoutsuite')) NOT NULL,
service TEXT NOT NULL,
resource_id TEXT NOT NULL,
title TEXT NOT NULL,
severity TEXT CHECK(severity IN ('low','medium','high','critical')) NOT NULL,
evidence JSON NOT NULL,
status TEXT CHECK(status IN ('new','validated','dismissed','remediated')) NOT NULL DEFAULT 'new'
);
-- AutoPurple validations table
CREATE TABLE ap_validations (
id TEXT PRIMARY KEY,
finding_id TEXT NOT NULL REFERENCES ap_findings(id) ON DELETE CASCADE,
tool TEXT CHECK(tool IN ('pacu')) NOT NULL,
module TEXT NOT NULL,
executed_at TIMESTAMP NOT NULL,
result TEXT CHECK(result IN ('exploitable','not_exploitable','error')) NOT NULL,
evidence JSON NOT NULL
);
-- AutoPurple remediations table
CREATE TABLE ap_remediations (
id TEXT PRIMARY KEY,
finding_id TEXT NOT NULL REFERENCES ap_findings(id) ON DELETE CASCADE,
planned_change JSON NOT NULL,
mcp_server TEXT NOT NULL,
mcp_call JSON NOT NULL,
executed_at TIMESTAMP,
status TEXT CHECK(status IN ('planned','executed','rolled_back','failed')) NOT NULL,
audit_ref TEXT
);
๐ง Development
Project Structure
autopurple/
โโโ __init__.py
โโโ config.py # Configuration management
โโโ logging.py # Structured logging
โโโ db/
โ โโโ __init__.py
โ โโโ connection.py # Database connection
โ โโโ schema.sql # Database schema
โโโ models/
โ โโโ __init__.py
โ โโโ findings.py # Finding data models
โ โโโ remediation.py # Remediation data models
โ โโโ runs.py # Run data models
โ โโโ validations.py # Validation data models
โโโ adapters/
โ โโโ __init__.py
โ โโโ scoutsuite_adapter.py # ScoutSuite integration
โ โโโ pacu_adapter.py # Pacu integration
โ โโโ mcp/
โ โโโ __init__.py
โ โโโ ccapi_client.py # AWS CCAPI MCP client
โ โโโ cfn_client.py # AWS CloudFormation MCP client
โ โโโ docs_client.py # AWS Documentation MCP client
โโโ orchestrator/
โ โโโ __init__.py
โ โโโ pipeline.py # Main pipeline orchestrator
โ โโโ planner.py # Claude planning
โ โโโ validators.py # Post-remediation validation
โโโ cli/
โ โโโ __init__.py
โ โโโ main.py # CLI interface
โโโ tests/
โโโ unit/
โโโ integration/
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=autopurple
# Run specific test file
pytest tests/unit/test_findings.py
# Run integration tests
pytest tests/integration/
Code Quality
# Run linting
ruff check .
# Run type checking
mypy autopurple/
# Run formatting
black autopurple/
๐ Security Considerations
Credential Management
- Use AWS profiles and STS tokens
- MFA required for AWS operations (configurable)
- Credentials stored in memory only
- Support for role assumption and chaining
Least Privilege
- Generate example IAM policies for MCP operations
- Validate all MCP plans against allowlist
- Audit trail for every automated action
Safety Features
- Dry-run mode enabled by default
- Explicit confirmation required for actual changes
- Rollback capabilities for all remediations
- Comprehensive logging and audit trails
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Run the test suite
- Submit a pull request
Development Guidelines
- Follow the existing code style
- Add type hints to all functions
- Write comprehensive docstrings
- Include tests for new functionality
- Update documentation as needed
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- ScoutSuite - AWS security auditing
- Pacu - AWS exploitation framework
- AWS MCP Servers - Model Context Protocol
- Claude - AI assistant for analysis and planning
๐ Support
- Issues: GitHub Issues
- Documentation: Read the Docs
- Discussions: GitHub Discussions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autopurple-1.2.0.tar.gz.
File metadata
- Download URL: autopurple-1.2.0.tar.gz
- Upload date:
- Size: 70.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a4e5ba925c74d023a8c62cf3594f4497dda30c2ea452d08876a54cd271727a8
|
|
| MD5 |
1822171f6aaee5edde7f91fa5b23b874
|
|
| BLAKE2b-256 |
52dfd1cde3e6289d8d0f7521790d7fe339245b6fe70234193024994c79072d0c
|
File details
Details for the file autopurple-1.2.0-py3-none-any.whl.
File metadata
- Download URL: autopurple-1.2.0-py3-none-any.whl
- Upload date:
- Size: 54.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bde7d5fb3e5a119e3ff2ceb83cee577c170cd315ed1f6637ae3ec7dfc2ed48d8
|
|
| MD5 |
60ca69ffa41348e5868e21428196122b
|
|
| BLAKE2b-256 |
6295f29b4c9254c084d38f821bbc05368e322a61247e2fe22a7e354f6b185cdb
|