Back to Articles

S3Cruze: The Pentester's Swiss Army Knife for AWS Bucket Security Testing

[ View on GitHub ]

S3Cruze: The Pentester's Swiss Army Knife for AWS Bucket Security Testing

Hook

A misconfigured S3 bucket exposed Capital One's data of 100 million customers in 2019. S3Cruze was built to find these vulnerabilities before attackers do—but it's trapped in Python 2.7's grave.

Context

AWS S3 buckets have become the poster child for cloud misconfigurations. From accidentally public buckets containing sensitive data to overly permissive access policies, S3 security issues consistently top OWASP's Cloud-Native Application Security lists. The problem isn't just that buckets can be misconfigured—it's that testing them requires juggling multiple AWS CLI commands, parsing JSON outputs, and tracking which checks you've already performed across dozens or hundreds of potential bucket names.

Penetration testers and bug bounty hunters face a repetitive workflow: enumerate possible bucket names based on target reconnaissance, test each bucket for public access, attempt file operations to verify permissions, and dump configuration settings to identify the exact misconfiguration. Before consolidated tools like S3Cruze, this meant writing custom bash scripts or manually executing AWS CLI commands in sequence. S3Cruze emerged to streamline this workflow into a single Python tool that automates the entire testing pipeline—from wordlist-based bucket discovery through configuration extraction.

Technical Insight

NoSuchBucket

Accessible

CLI Input

Target Name + Wordlist

Bucket Name Generator

AWS CLI Subprocess Wrapper

Bucket Exists?

Permission Tests

List Contents

Upload Test File

Get ACL/Policy/CORS

Results Parser

Security Report

System architecture — auto-generated

S3Cruze's architecture is refreshingly straightforward: it's essentially an intelligent wrapper around AWS CLI commands with orchestration logic to execute pentesting workflows. Rather than reimplementing AWS API calls using boto3 or other SDKs, the tool spawns subprocess calls to the AWS CLI binary and parses the resulting output. This design decision makes the codebase remarkably lightweight but creates a hard dependency on having AWS CLI pre-installed and configured with valid credentials.

The core enumeration logic combines a target name with wordlist entries containing common prefixes and suffixes. For example, if you're testing a company called "acme" with a wordlist containing entries like "-backup", "-prod", "-dev", the tool generates candidates like "acme-backup", "acme-prod", "acme-dev" and tests each one. Here's the conceptual flow:

# Simplified representation of S3Cruze's enumeration approach
import subprocess
import json

def test_bucket_access(bucket_name):
    try:
        # Attempt to list bucket contents via AWS CLI
        result = subprocess.check_output(
            ['aws', 's3', 'ls', f's3://{bucket_name}'],
            stderr=subprocess.STDOUT
        )
        return True, result.decode('utf-8')
    except subprocess.CalledProcessError as e:
        # Parse error to distinguish between "no access" and "doesn't exist"
        error_msg = e.output.decode('utf-8')
        if 'NoSuchBucket' in error_msg:
            return False, 'Bucket does not exist'
        elif 'AccessDenied' in error_msg:
            return True, 'Bucket exists but access denied'
        return False, error_msg

def get_bucket_policy(bucket_name):
    try:
        result = subprocess.check_output(
            ['aws', 's3api', 'get-bucket-policy', '--bucket', bucket_name],
            stderr=subprocess.STDOUT
        )
        policy = json.loads(result.decode('utf-8'))
        return policy
    except subprocess.CalledProcessError:
        return None

What makes S3Cruze particularly useful for pentesters is its systematic approach to permission verification. Finding a bucket is one thing—understanding what you can actually do with it is another. The tool attempts to upload a test file (typically a small text file) to verify write permissions, then immediately deletes it to avoid leaving artifacts. This is critical for demonstrating exploitability in security reports rather than just theoretical access.

The configuration dumping functionality is where S3Cruze shines for comprehensive assessments. It automatically retrieves ACLs, bucket policies, CORS configurations, replication settings, website configurations, and region locations. For each discovered bucket, you get a complete security posture snapshot without manually executing six different AWS CLI commands. The tool essentially runs:

aws s3api get-bucket-acl --bucket <name>
aws s3api get-bucket-policy --bucket <name>
aws s3api get-bucket-cors --bucket <name>
aws s3api get-bucket-replication --bucket <name>
aws s3api get-bucket-website --bucket <name>
aws s3api get-bucket-location --bucket <name>

For each command, S3Cruze captures both successful responses and specific error messages, helping identify partial misconfigurations where some settings are publicly readable while others aren't. This granular approach helps pentesters understand the exact attack surface rather than just getting a binary "accessible or not" result.

The wordlist-based discovery, while simple, is effective because S3 bucket naming tends to follow predictable patterns. Companies often use conventions like "company-environment-purpose" (e.g., "acme-prod-backups") or "purpose-company" (e.g., "backups-acme"). A well-crafted wordlist targeting these patterns can discover buckets that aren't directly referenced in application code or DNS records.

Gotcha

The elephant in the room is Python 2.7. The language version reached end-of-life on January 1, 2020, and no longer receives security updates. Running Python 2.7 code on modern systems requires either maintaining legacy Python installations or using compatibility layers like pyenv. Many Linux distributions have completely removed Python 2.7 from their default repositories. For a security tool, depending on an unsupported language runtime is particularly problematic—you're using outdated software to find security vulnerabilities, which creates its own risk surface.

The AWS CLI dependency introduces both setup friction and potential version incompatibilities. You need AWS CLI v1 or v2 installed, configured with credentials that have appropriate S3 permissions, and available in your PATH. If the AWS CLI output format changes between versions, S3Cruze's parsing logic could break. The tool also inherits AWS CLI's performance characteristics—each bucket check spawns a new subprocess with full AWS CLI initialization overhead. For testing hundreds of potential bucket names, this becomes noticeably slower than tools that use native AWS SDK connections with connection pooling. Additionally, S3Cruze's wordlist approach is purely brute-force without permutation generation, subdomain correlation, or integration with certificate transparency logs—more sophisticated discovery techniques that modern alternatives employ.

Verdict

Use S3Cruze if you're conducting authorized penetration tests or bug bounty assessments on AWS infrastructure and need a quick, consolidated tool to enumerate S3 buckets and dump their security configurations. It's particularly valuable when you want all common S3 security checks in one command rather than juggling multiple AWS CLI invocations. The tool works well for one-off engagements where you can tolerate the Python 2.7 dependency in an isolated environment. Skip it if you're building this into CI/CD pipelines, need Python 3 compatibility for modern infrastructure, want actively maintained security tooling, or require advanced enumeration beyond basic wordlist brute-forcing. For production security workflows, invest time in alternatives like S3Scanner (Python 3, actively maintained) or build custom scripts with boto3 that you can maintain and extend. The Python 2.7 anchor makes S3Cruze a historical curiosity rather than a forward-looking choice, regardless of its clever design.

// ADD TO YOUR README
[![Featured on Starlog](https://starlog.is/api/badge/cybersecurity/jr0ch17-s3cruze.svg)](https://starlog.is/api/badge-click/cybersecurity/jr0ch17-s3cruze)