Skip to content

Add AWS API Gateway IP rotation module#53

Open
incogbyte wants to merge 4 commits intoblacklanternsecurity:trevorspray-v2from
incogbyte:trevorspray-v2
Open

Add AWS API Gateway IP rotation module#53
incogbyte wants to merge 4 commits intoblacklanternsecurity:trevorspray-v2from
incogbyte:trevorspray-v2

Conversation

@incogbyte
Copy link
Copy Markdown

Summary

  • Add source IP rotation via AWS API Gateway endpoints deployed across multiple AWS regions
  • Each spray request is routed through a randomly selected API Gateway, resulting in a different source IP per attempt
  • Helps bypass rate-limiting and IP-based lockout mechanisms during password spray engagements
  • API Gateways are created automatically on start and cleaned up on exit or interrupt
  • Credentials are validated via STS before gateway creation to fail fast on bad keys
  • Supports interactive credential prompt, persistent config file (~/.trevorspray/aws_config.ini), AWS profiles, and direct CLI keys
  • Mutually exclusive with existing proxy modes (--ssh, --subnet, --proxy)
  • boto3 added as optional dependency (pip install trevorspray[aws])
  • README updated with usage examples and CLI reference

Files changed

  • trevorspray/lib/aws_gateway.py — New module: manages API Gateway lifecycle (create, proxy, delete)
  • trevorspray/lib/proxy.py — Rewrite request URLs through random gateway before sending
  • trevorspray/lib/trevor.py — Initialize and cleanup AWS gateway manager
  • trevorspray/cli.py — New argument group for AWS options
  • pyproject.toml — boto3 as optional dependency
  • README.md — Documentation and usage examples
  • .gitignore — Ignore venv, pycache, *.pyc

Implement source IP rotation by routing spray traffic through AWS API
Gateway endpoints deployed across multiple regions. Each request goes
through a randomly selected gateway, resulting in a different source IP
per attempt, which helps bypass rate-limiting and IP-based lockout
mechanisms during password spray engagements.

Features:
- Create/destroy API Gateways automatically across 16 AWS regions
- Credential validation via STS before gateway creation
- Persistent credential storage in ~/.trevorspray/aws_config.ini (chmod 600)
- Interactive credential prompt when no keys are provided
- Mutual exclusion with existing proxy modes (--ssh, --subnet, --proxy)
- Full cleanup of AWS resources on exit or interrupt

New CLI options:
  --aws                  Enable IP rotation through AWS API Gateway
  --aws-regions          Limit to specific AWS regions
  --aws-profile          Use named AWS credentials profile
  --aws-access-key       AWS access key ID
  --aws-secret-key       AWS secret access key
  --aws-clear-creds      Delete saved credentials and exit

Optional dependency: boto3 (pip install trevorspray[aws])
Add usage examples and CLI reference for the new --aws feature,
including credential management, region selection, and cleanup.
@hashtaginfosec
Copy link
Copy Markdown

An FYI, AWS has been banning accounts for using their AWS API Gateway for password sprays. Got mine almost banned for using AWS API Gateways with CredMaster.

image

May I suggest using Cloudflare Workers? Something like; knavesec/CredMaster#96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants