This Docker container aims to ease the process of auditing AWS environments for security issues. It bundles handy open-source AWS security analysis tools (plus the AWS CLI/Shell), handles their installation/dependencies, and provides a convenience launcher script. The focus is on finding issues by interrogating AWS APIs and analyzing the results (rather than e.g. looking inside EC2 instances, at application code, or other resources that are opaque to the AWS APIs).
Thanks to the tool authors for their efforts!
- AWS CLI: manually interrogate AWS APIs
- AWS Shell: manually interrogate AWS APIs, in a helpful interactive environment
- Scout2: call various AWS APIs, assess security posture, generate report
- Prowler: call various AWS APIs, assess security posture focusing on the AWS CIS Foundations Benchmark, generate report
- CloudSploit Scans: call various AWS APIs, assess security posture, report to STDOUT
- s3-inspector: examine S3 bucket permissions, report to STDOUT
- AWS Bucket Dump: unauthenticated, wordlist-based S3 bucket enumeration and loot search.
- Pacu: AWS exploitation framework. "Metasploit for AWS"
- Docker (for building/running the container)
- git (for cloning this repo)
- Read-only AWS credentials (convenient if they're in
~/.aws
on your Docker host) - Internet access (for tool/dependency installation, and running tools)
On a host meeting the prereqs:
- Clone this repo:
git clone https://github.com/dachiefjustice/aws-sec-tools aws-sec-tools && cd aws-sec-tools
(or manually download/extract) - Build the container from the directory containing the Dockerfile:
docker build -t aws-sec-tools:01 .
(or whatever tag you want) - (Optional, but recommended) Make a directory for storing tool output:
mkdir ~/aws-reports
Once you have the container built, on a host meeting the prereqs:
- Run the container interactively. It's easiest to bind-mount your AWS dir and a reports dir into the container (adjust container name/tag and volume mounts as needed):
docker run -it -v ~/.aws:/home/awssec/.aws -v ~/aws-reports:/home/awssec/reports aws-sec-tools:01
- Decide if you want want to run a tool manually, or use the launcher to get started quickly.
Inside an interactive shell in the container:
cd ~/toolname
- Activate the virtualenv:
source ~/toolname/bin/activate
(for Python-based tools, i.e. most of them) - Run the tool
- Deactivate the virtualenv:
deactivate
(for Python-based tools)
Inside an interactive shell in the container:
./tool_launcher.py
- Select the tool you want to run
- After running a tool from the launcher, you might find yourself in the tool's virtualenv (handy for re-running the tool with different parameters, maybe to redirect STDOUT to a file in
~/reports
, etc.). Alternately,exit
the bash shell invoked by the launcher script, re-run~/tool_launcher.py
, and choose another tool.
- Familiarize yourself with the tools included in this image before running them.
- Use read-only AWS credentials. The AWS-managed SecurityAudit policy (arn:aws:iam::aws:policy/SecurityAudit) is a good starting point; customize as appropriate to your AWS environment/the tools you're using.
- To get the latest tool versions, delete the container image and re-build. The Dockerfile installs each tool via pip or clones the tool's GitHub default branch.
- Some tools launch automatically when invoked from the tool launcher script (they're labeled as such in the launcher).
- CloudSploit Scans needs AWS credentials, but doesn't check ~/.aws/credentials for them. The tool launcher script assumes you're using an IAM user (rather than role or other temporary credential), prompts for access key and secret key, and sets the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables before invoking the tool. Alternately, set theAWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
, andAWS_SESSION_TOKEN
environment variables, then run the tool manually. - To manually run a tool,
cd
into the tool's directory (under ~) and (for Python-based tools with a~/toolname/bin
directory) activate the tool's virtualenv withsource ~/toolname/bin/activate
.deactivate
when you're done using a tool with a virtualenv. - tmux is available (for convenience/running multiple tools at once in a single container instance).
- git is available.