https://github.com/bigbuildbench/rhinosecuritylabs_iamactionhunter

https://github.com/bigbuildbench/rhinosecuritylabs_iamactionhunter

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: BigBuildBench
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Size: 15.6 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

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

(potentially necessary: poetry env use python3.9)

poetry install iamactionhunter --help iamactionhunter --collect --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

Configs

Builtin config options are: dangerous_iam write_actions privescs iamactionhunter --account <account_number_of_profile> --config dangerous_iam

Creating Custom Configs

A config file is a JSON file that specifies some specific permissions you want to look for. Here is an example file which searches for write actions in CodeBuild. [ { "Description": "These are all actions which may allow some kind of write privilege in CodeBuild.", "Name": "CodeBuildWriteActions", "ActionsNeeded": [ "codebuild:Put*", "codebuild:Create*", "codebuild:Delete*", "codebuild:Modify*", "codebuild:Update*", "codebuild:Attach*", "codebuild:Detach*", "codebuild:Associate*", "codebuild:Disassociate*", "codebuild:Add*", "codebuild:Remove*", "codebuild:Set*", "codebuild:Enable*", "codebuild:Disable*", "codebuild:Reset*", "codebuild:Stop*", "codebuild:Terminate*", "codebuild:Reboot*", "codebuild:Start*" ], "AllOrNone": false } ] You could then run the config by simply specifying the file name in the --config argument.
iamactionhunter --account <account_number_of_profile> --config write_code_build.json

Owner

  • Name: BigBuildBench
  • Login: BigBuildBench
  • Kind: organization

abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.

GitHub Events

Total
  • Create event: 4
Last Year
  • Create event: 4

Dependencies

.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/pypi-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
dev-requirements.txt pypi
  • black ==23.3.0 development
  • boto3 ==1.26.113 development
  • botocore ==1.29.113 development
  • click ==8.1.3 development
  • colorama ==0.4.6 development
  • exceptiongroup ==1.1.1 development
  • flake8 ==6.0.0 development
  • iniconfig ==2.0.0 development
  • jmespath ==1.0.1 development
  • mccabe ==0.7.0 development
  • mock ==5.0.1 development
  • mypy-extensions ==1.0.0 development
  • numpy ==1.24.2 development
  • packaging ==23.1 development
  • pandas ==2.0.0 development
  • pathspec ==0.11.1 development
  • platformdirs ==3.2.0 development
  • pluggy ==1.0.0 development
  • policyuniverse ==1.5.0.20220613 development
  • pycodestyle ==2.10.0 development
  • pyflakes ==3.0.1 development
  • pytest ==7.3.0 development
  • python-dateutil ==2.8.2 development
  • pytz ==2023.3 development
  • s3transfer ==0.6.0 development
  • semantic-version ==2.10.0 development
  • setuptools ==67.6.1 development
  • setuptools-rust ==1.5.2 development
  • six ==1.16.0 development
  • tomli ==2.0.1 development
  • typing-extensions ==4.5.0 development
  • tzdata ==2023.3 development
  • urllib3 ==1.26.15 development
pyproject.toml pypi
  • black ^23.1.0 develop
  • flake8 ^6.0.0 develop
  • mock ^5.0.1 develop
  • pytest ^7.2.2 develop
  • setuptools-rust ^1.5.2 develop
  • python ^3.9
requirements.txt pypi
  • boto3 ==1.26.113
  • botocore ==1.29.113
  • colorama ==0.4.6
  • jmespath ==1.0.1
  • numpy ==1.24.2
  • pandas ==2.0.0
  • policyuniverse ==1.5.0.20220613
  • python-dateutil ==2.8.2
  • pytz ==2023.3
  • s3transfer ==0.6.0
  • six ==1.16.0
  • tzdata ==2023.3
  • urllib3 ==1.26.15