Skip to main content

Description

IAMActionHunter is an IAM policy statement parser and query tool aims to simplify the process of collecting and understanding permission policy statements for users and roles in AWS Identity and Access Management (IAM). Although its functionality is straightforward, this tool was developed in response to the need for an efficient solution during day-to-day AWS penetration testing.

Blog Post

https://rhinosecuritylabs.com/aws/iamactionhunter-aws-iam-permissions/

Offensive Use

The tool can be utilized to search for potential privilege escalation opportunities in AWS accounts by querying various AWS IAM actions that might be exploited. While other tools perform scans to identify privilege escalation risks, this tool enables a more manual approach, allowing users to investigate permissions and quickly review the roles, users, and resources they apply to for targeted analysis.

Blue Team Use

This tool also offers the ability to output and save query results in a CSV format, which is beneficial for security teams seeking a high-level overview of principal permissions and resources within an AWS account. For instance, you may want to identify users and roles with iam:put* permissions in an account. By executing a query and generating a CSV, you can easily review all users and roles with these permissions, along with the resources they have access to.

Installation

Suggested:

pip3 install iamactionhunter

Much of this functionality has also been implemented into https://github.com/RhinoSecurityLabs/pacu as a module, iam__enum_action_query if you prefer that.

Clone and use Poetry:

git clone https://github.com/RhinoSecurityLabs/IAMActionHunter.git
cd IAMActionHunter
poetry install
iamactionhunter --help
iamactionhunter --collect --profile <some-aws-profile>

Clone and use Pip:

git clone https://github.com/RhinoSecurityLabs/IAMActionHunter.git
cd IAMActionHunter
pip install .
iamactionhunter --help
iamactionhunter --collect --profile <some-aws-profile>

Usage

Help:

usage: iamactionhunter [-h] [--profile PROFILE] [--account ACCOUNT] [--query QUERY] [--role ROLE] [--user USER]
                          [--all-or-none] [--collect] [--list] [--csv CSV] [--config CONFIG]

Collect all policies for all users/roles in an AWS account and then query the policies for permissions.

optional arguments:
  -h, --help         show this help message and exit
  --profile PROFILE  The name of the AWS profile to use for authentication for user/role collection.
  --account ACCOUNT  Account number to query.
  --query QUERY      Permissions to query. A string like: s3:GetObject or s3:* or s3:GetObject,s3:PutObject
  --role ROLE        Filter role to query.
  --user USER        Filter user to query.
  --all-or-none      Check if all queried actions are allowed, not just some.
  --collect          Collect user and role policies for the account.
  --list             List accounts available to query.
  --csv CSV          File name for CSV report output.
  --config CONFIG    JSON config file for preset queries.

Examples

First download all IAM info for users and roles:
iamactionhunter --collect --profile my-aws-profile

List any account data has been collected for:
iamactionhunter --list

Then query something:
iamactionhunter --account <account_number_of_profile_above> --query iam:create*

Then query more:
iamactionhunter --account <account_number_of_profile_above> --query iam:create*,iam:put*

Query a particular role:
iamactionhunter --account <account_number_of_profile_above> --role some_role --query iam:*

Query a particular user:
iamactionhunter --account <account_number_of_profile_above> --user some_user --query iam:*

Output to a CSV:
iamactionhunter --account <account_number_of_profile_above> --query iam:* --csv report.csv

Run a preset config:
iamactionhunter --account <account_number_of_profile_above> --config dangerous_iam

Run a query which only shows the results if a user or role has all queried permissions:
iamactionhunter --account <account_number_of_profile_above> --query s3:getobject,s3:listbucket --all-or-none

Metadata

Release files for iamactionhunter 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iamactionhunter 1.0.5
File Size Uploaded Provenance Actions
IAMActionHunter-1.0.5.tar.gz 13.9 kB Without provenance Details for IAMActionHunter-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iamactionhunter 1.0.5
File Interpreter ABI Platform Actions
iamactionhunter-1.0.5-py3-none-any.whl Python 3 none any Details for iamactionhunter-1.0.5-py3-none-any.whl

Total release size: 29.6 kB

Release files / IAMActionHunter-1.0.5.tar.gz

Download URL IAMActionHunter-1.0.5.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a90bb17bd3551a8ab8c66fc5f0b4034771ce3438bb3914b74aa694061bc316fe
BLAKE2b-256 checksum
How to use checksums
647d52a8002f7a71b889600a01f275e891e0e291438ec5c99932490bf917576c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.9.7 Linux/5.10.102.1-microsoft-standard-WSL2

Release files / iamactionhunter-1.0.5-py3-none-any.whl

Download URL iamactionhunter-1.0.5-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
464b3660575a9d35f93b8e42fbdac791188b8e8b0ca8ada8c9d73bcf1c3e0327
BLAKE2b-256 checksum
How to use checksums
e631e24608d015f15970fc1a416ba6c03a0786a039eadb2d6eab7a9ef880a514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.9.7 Linux/5.10.102.1-microsoft-standard-WSL2

Security for iamactionhunter 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page