• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An AWS IAM policy statement parser and query tool.

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

More Repositories

1

pacu

The AWS exploitation framework, designed for testing the security of Amazon Web Services environments.
Python
4,339
star
2

cloudgoat

CloudGoat is Rhino Security Labs' "Vulnerable by Design" AWS deployment tool
Python
2,923
star
3

Security-Research

Exploits written by the Rhino Security Labs team
Python
1,057
star
4

AWS-IAM-Privilege-Escalation

A centralized source of all AWS IAM privilege escalation methods released by Rhino Security Labs.
894
star
5

IPRotate_Burp_Extension

Extension for Burp Suite which uses AWS API Gateway to rotate your IP on every request.
Python
809
star
6

CVEs

A collection of proof-of-concept exploit scripts written by the team at Rhino Security Labs for various CVEs.
Python
793
star
7

ccat

Cloud Container Attack Tool (CCAT) is a tool for testing security of container environments.
Python
586
star
8

GCPBucketBrute

A script to enumerate Google Storage buckets, determine what access you have to them, and determine if they can be privilege escalated.
Python
478
star
9

SleuthQL

Python3 Burp History parsing tool to discover potential SQL injection points. To be used in tandem with SQLmap.
Python
464
star
10

Cloud-Security-Research

Cloud-related research releases from the Rhino Security Labs team.
Python
353
star
11

GCP-IAM-Privilege-Escalation

A collection of GCP IAM privilege escalation methods documented by the Rhino Security Labs team.
Python
336
star
12

Swagger-EZ

A tool geared towards pentesting APIs using OpenAPI definitions.
JavaScript
169
star
13

Aggressor-Scripts

Aggregation of Cobalt Strike's aggressor scripts.
PowerShell
144
star
14

dsnap

Utility for downloading and mounting EBS snapshots using the EBS Direct API's
Python
73
star
15

Presentations

A collection of slides, videos, and proof-of-concept scripts from various Rhino presentations.
37
star
16

little-stitch

Send and receive bypassing Little Snitch alerting.
Go
10
star