Skip to content

Conversation

@qlkwej
Copy link

@qlkwej qlkwej commented Feb 22, 2025

s3__enum_bucket_owner: Enum bucket owner + Fix code style and linting issues

[Purpose]: Clean up code to comply with flake8 linting standards [Changes]:

  • Fixed argument parser indentation for better readability
  • Removed unused imports (copy, uuid)
  • Fixed line endings and removed trailing whitespace
  • Added proper docstrings for all functions
  • Ensured consistent blank lines between functions

[Testing]: Module functionality remains unchanged, all flake8 checks pass

Scenario 1: No role ARN provided, and No permission to create temp role

Pacu (pwnlabs:from_default-xxxx) > run s3__enum_account --buckets mega-big-tech
  Running module s3__enum_account...

[s3__enum_bucket_owner] No role ARN provided. Checking if we can create a temporary role...
[s3__enum_bucket_owner] ERROR: No role ARN provided and no permissions to create a temporary role.
[s3__enum_bucket_owner] You must either:
[s3__enum_bucket_owner] 1. Provide an existing role ARN with --role-arn
[s3__enum_bucket_owner] 2. Or have IAM permissions to create a temporary rol

Scenario 2: With role ARN provided

Pacu (pwnlabs:from_default-xxxx) > run s3__enum_account --buckets mega-big-tech --role-arn arn:aws:iam::xxxx:role/SampleBucket
  Running module s3__enum_account...

[s3__enum_bucket_owner] Starting enumeration of 1 bucket(s)...

[s3__enum_bucket_owner] Verifying role access...
[s3__enum_bucket_owner] Successfully verified role access

[s3__enum_bucket_owner] Enumerating bucket: mega-big-tech
[s3__enum_bucket_owner] Using role ARN: arn:aws:iam::xxxx:role/SampleBucket
[s3__enum_bucket_owner] Starting account ID discovery...

[s3__enum_bucket_owner] Progress: ************
[s3__enum_bucket_owner] Progress: 1***********
[s3__enum_bucket_owner] Progress: 10**********
[s3__enum_bucket_owner] Progress: 107*********
[s3__enum_bucket_owner] Progress: 1075********
[s3__enum_bucket_owner] Progress: 10751*******
[s3__enum_bucket_owner] Progress: 107513******
[s3__enum_bucket_owner] Progress: 1075135*****
[s3__enum_bucket_owner] Progress: 10751350****
[s3__enum_bucket_owner] Progress: 107513503***
[s3__enum_bucket_owner] Progress: 1075135037**
[s3__enum_bucket_owner] Progress: 10751350379*
[s3__enum_bucket_owner] Progress: 107513503799

[s3__enum_bucket_owner] Success! Account ID: 107513503799

[s3__enum_bucket_owner] Results:
[s3__enum_bucket_owner]   mega-big-tech: 107513503799
[s3__enum_bucket_owner] s3__enum_bucket_owner completed.

[s3__enum_bucket_owner] MODULE SUMMARY:

1 account IDs found from 1 buckets.
0 buckets failed enumeration.

Found account IDs:
  mega-big-tech: 107513503799

This module inspired by:

Qlkwej and others added 2 commits February 22, 2025 19:40
… issues

[Purpose]: Clean up code to comply with flake8 linting standards
[Changes]:
- Fixed argument parser indentation for better readability
- Removed unused imports (copy, uuid)
- Fixed line endings and removed trailing whitespace
- Added proper docstrings for all functions
- Ensured consistent blank lines between functions

[Testing]: Module functionality remains unchanged, all flake8 checks pass
[Documentation]: No documentation updates required
@DaveYesland
Copy link
Contributor

To clarify this is adding an entirely new module correct?

@qlkwej
Copy link
Author

qlkwej commented Mar 22, 2025

Yes correct @DaveYesland -- feedback are welcome

@DaveYesland DaveYesland changed the title s3__enum_bucket_owner: Enum bucket owner + Fix code style and linting… New module: s3__enum_bucket_owner: Enum bucket owner Jun 20, 2025
Copy link
Contributor

@DaveYesland DaveYesland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay!
Testing this out now. Does this run for you? I receive the error:
<class 'AttributeError'>: 'PacuSession' object has no attribute 'client'

This looks to be because the IAM client is trying to be created using PacuSession. Instead it should use
iam_client = pacu_main.get_boto3_client('iam')

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