s3mbura 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. s3mbura-0.1.0/.gitattributes +9 -0
  2. s3mbura-0.1.0/.github/workflows/release.yml +66 -0
  3. s3mbura-0.1.0/.gitignore +33 -0
  4. s3mbura-0.1.0/Dockerfile +16 -0
  5. s3mbura-0.1.0/LICENSE +21 -0
  6. s3mbura-0.1.0/PKG-INFO +192 -0
  7. s3mbura-0.1.0/README.md +156 -0
  8. s3mbura-0.1.0/ROADMAP.md +150 -0
  9. s3mbura-0.1.0/pyproject.toml +63 -0
  10. s3mbura-0.1.0/src/s3mbura/__init__.py +4 -0
  11. s3mbura-0.1.0/src/s3mbura/__main__.py +7 -0
  12. s3mbura-0.1.0/src/s3mbura/account_id.py +103 -0
  13. s3mbura-0.1.0/src/s3mbura/aws_client.py +52 -0
  14. s3mbura-0.1.0/src/s3mbura/checks/__init__.py +17 -0
  15. s3mbura-0.1.0/src/s3mbura/checks/account_id.py +91 -0
  16. s3mbura-0.1.0/src/s3mbura/checks/content.py +188 -0
  17. s3mbura-0.1.0/src/s3mbura/checks/effective_access.py +213 -0
  18. s3mbura-0.1.0/src/s3mbura/checks/existence.py +133 -0
  19. s3mbura-0.1.0/src/s3mbura/checks/listing.py +138 -0
  20. s3mbura-0.1.0/src/s3mbura/checks/subresources.py +580 -0
  21. s3mbura-0.1.0/src/s3mbura/checks/target_info.py +51 -0
  22. s3mbura-0.1.0/src/s3mbura/checks/versioning.py +99 -0
  23. s3mbura-0.1.0/src/s3mbura/cli.py +138 -0
  24. s3mbura-0.1.0/src/s3mbura/discovery.py +96 -0
  25. s3mbura-0.1.0/src/s3mbura/findings.py +56 -0
  26. s3mbura-0.1.0/src/s3mbura/http_probe.py +77 -0
  27. s3mbura-0.1.0/src/s3mbura/listing.py +139 -0
  28. s3mbura-0.1.0/src/s3mbura/models.py +66 -0
  29. s3mbura-0.1.0/src/s3mbura/registry.py +112 -0
  30. s3mbura-0.1.0/src/s3mbura/report.py +137 -0
  31. s3mbura-0.1.0/src/s3mbura/secrets_scan.py +139 -0
  32. s3mbura-0.1.0/src/s3mbura/sigv4.py +155 -0
  33. s3mbura-0.1.0/src/s3mbura/target.py +96 -0
  34. s3mbura-0.1.0/src/s3mbura/versions.py +87 -0
  35. s3mbura-0.1.0/tests/__init__.py +0 -0
  36. s3mbura-0.1.0/tests/test_account_id.py +110 -0
  37. s3mbura-0.1.0/tests/test_content.py +111 -0
  38. s3mbura-0.1.0/tests/test_discovery.py +64 -0
  39. s3mbura-0.1.0/tests/test_effective_access.py +189 -0
  40. s3mbura-0.1.0/tests/test_existence.py +56 -0
  41. s3mbura-0.1.0/tests/test_findings.py +41 -0
  42. s3mbura-0.1.0/tests/test_listing.py +167 -0
  43. s3mbura-0.1.0/tests/test_report.py +60 -0
  44. s3mbura-0.1.0/tests/test_secrets_scan.py +64 -0
  45. s3mbura-0.1.0/tests/test_sigv4.py +84 -0
  46. s3mbura-0.1.0/tests/test_subresources.py +308 -0
  47. s3mbura-0.1.0/tests/test_target.py +66 -0
  48. s3mbura-0.1.0/tests/test_versioning.py +105 -0
@@ -0,0 +1,9 @@
1
+ # Normalise line endings: store everything with LF in the repo, let Git handle
2
+ # the working-copy conversion per platform. Silences the Windows LF->CRLF noise.
3
+ * text=auto eol=lf
4
+
5
+ # Binary types Git must never touch.
6
+ *.png binary
7
+ *.jpg binary
8
+ *.gif binary
9
+ *.ico binary
@@ -0,0 +1,66 @@
1
+ name: Release
2
+
3
+ # Mirrors the manguescan release flow (s3mbura is its future `s3` module).
4
+ # Tag a commit `vX.Y.Z` and push the tag: this verifies the tag matches the
5
+ # package version, builds, creates the GitHub release, and publishes to PyPI
6
+ # via Trusted Publishing (OIDC) -- no API token is stored anywhere.
7
+ on:
8
+ push:
9
+ tags:
10
+ - "v*"
11
+
12
+ jobs:
13
+ release:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ permissions:
17
+ contents: write # create the GitHub release
18
+ id-token: write # Trusted Publishing (OIDC)
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: "3.11"
30
+
31
+ - name: Install build tooling
32
+ run: python -m pip install --upgrade build twine
33
+
34
+ - name: Verify tag matches package version
35
+ shell: python
36
+ run: |
37
+ import os
38
+ import pathlib
39
+ import tomllib
40
+
41
+ tag = os.environ["GITHUB_REF_NAME"]
42
+ version = tomllib.loads(
43
+ pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
44
+ )["project"]["version"]
45
+ expected = f"v{version}"
46
+ if tag != expected:
47
+ raise SystemExit(f"Tag {tag!r} does not match project version {expected!r}")
48
+
49
+ - name: Build distributions
50
+ run: python -m build
51
+
52
+ - name: Check metadata
53
+ run: python -m twine check dist/*
54
+
55
+ - name: Create GitHub release
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
+ run: |
59
+ if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
60
+ gh release upload "${GITHUB_REF_NAME}" dist/* --clobber
61
+ else
62
+ gh release create "${GITHUB_REF_NAME}" dist/* --generate-notes
63
+ fi
64
+
65
+ - name: Publish package distributions to PyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ env/
11
+
12
+ # Tooling
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .mypy_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Tool output / scan artifacts
20
+ output.json
21
+ *.s3mbura.json
22
+
23
+ # Secrets & local AWS config -- never commit
24
+ .env
25
+ *.pem
26
+ credentials
27
+ .aws/
28
+
29
+ # OS / editor
30
+ .DS_Store
31
+ Thumbs.db
32
+ .idea/
33
+ .vscode/
@@ -0,0 +1,16 @@
1
+ # syntax=docker/dockerfile:1
2
+ # Minimal image that ships the s3mbura CLI.
3
+ FROM python:3.13-slim AS build
4
+ WORKDIR /src
5
+ COPY pyproject.toml README.md ./
6
+ COPY src ./src
7
+ RUN pip install --no-cache-dir build && python -m build --wheel
8
+
9
+ FROM python:3.13-slim
10
+ # Run as a non-root user; the tool needs no privileges.
11
+ RUN useradd --create-home --uid 10001 s3mbura
12
+ COPY --from=build /src/dist/*.whl /tmp/
13
+ RUN pip install --no-cache-dir /tmp/*.whl && rm -f /tmp/*.whl
14
+ USER s3mbura
15
+ ENTRYPOINT ["s3mbura"]
16
+ CMD ["--help"]
s3mbura-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 0xs3n4
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
s3mbura-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.5
2
+ Name: s3mbura
3
+ Version: 0.1.0
4
+ Summary: S3mbura - a focused security auditor for Amazon S3 buckets.
5
+ Project-URL: Homepage, https://github.com/0xs3n4/s3mbura
6
+ Project-URL: Repository, https://github.com/0xs3n4/s3mbura
7
+ Project-URL: Issues, https://github.com/0xs3n4/s3mbura/issues
8
+ Project-URL: Changelog, https://github.com/0xs3n4/s3mbura/releases
9
+ Author: 0xs3n4
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: audit,aws,bucket,cloud-security,misconfiguration,pentest,s3,sarif,security
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: System :: Systems Administration
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: boto3>=1.34
27
+ Requires-Dist: botocore>=1.34
28
+ Provides-Extra: dev
29
+ Requires-Dist: moto[s3]>=5.0; extra == 'dev'
30
+ Requires-Dist: pytest>=8.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.5; extra == 'dev'
32
+ Provides-Extra: publish
33
+ Requires-Dist: build>=1.2; extra == 'publish'
34
+ Requires-Dist: twine>=5.0; extra == 'publish'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # 🦀 S3mburá
38
+
39
+ > *Everything the bucket holds, in one basket.*
40
+
41
+ **s3mbura** is a focused security auditor for **Amazon S3**. The *samburá* is the
42
+ basket a mangrove catcher carries to hold everything pulled from the mud — and
43
+ that is exactly what this tool does to a bucket: it reaches in and brings back
44
+ everything knowable about it, in one place.
45
+
46
+ One tool that combines the three things the ecosystem spreads across separate
47
+ projects:
48
+
49
+ | Layer | What it does |
50
+ |-------|--------------|
51
+ | **Permissions** | public ACL, policy status, Public Access Block, effective access |
52
+ | **Configuration sweep** | every readable bucket sub-resource (CORS, encryption, logging, website, versioning, ...) |
53
+ | **Listing** | condition-aware listing that adapts to restrictive bucket policies |
54
+ | **Content** | verified secret / PII scanning of reachable objects |
55
+
56
+ S3-only by design: no multi-cloud, no bloat. See [`ROADMAP.md`](ROADMAP.md) for the
57
+ full design and build plan.
58
+
59
+ ### The four differentiators, in mangue terms
60
+
61
+ | Differentiator | Mangue metaphor |
62
+ |----------------|-----------------|
63
+ | Full sub-resource sweep | **Bracear** — reach your whole arm into the burrow, checking every sub-resource |
64
+ | Versioned-object recovery | **Lama** — what was "deleted" sank into the mud, but it's still down there |
65
+ | Condition-aware listing | **Siri** — the crab walks sideways, sending the request shape the policy already accepts |
66
+ | Verified secrets | **Samburá** — only the real crabs go in the basket; no false positives |
67
+
68
+ > **Status:** all 8 roadmap phases implemented — existence/region, full
69
+ > sub-resource sweep, effective-access probes, condition-aware listing,
70
+ > versioned-object recovery, verified-secret content scanning, JSON/SARIF
71
+ > output, and concurrency + namespace discovery. See [`ROADMAP.md`](ROADMAP.md).
72
+
73
+ ## Install
74
+
75
+ Requires **Python 3.11+**.
76
+
77
+ ### Via pip
78
+
79
+ > Not on PyPI yet — install straight from the repository:
80
+
81
+ ```bash
82
+ pip install git+https://github.com/0xs3n4/s3mbura.git
83
+ ```
84
+
85
+ Once published, this becomes simply `pip install s3mbura`.
86
+
87
+ ### Via git clone (for development)
88
+
89
+ Clone and install in editable mode, so your changes take effect without reinstalling:
90
+
91
+ ```bash
92
+ git clone https://github.com/0xs3n4/s3mbura.git
93
+ cd s3mbura
94
+
95
+ python -m venv .venv
96
+ source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
97
+
98
+ pip install -e ".[dev]" # editable install + test/lint tooling
99
+ ```
100
+
101
+ Either way you get the `s3mbura` command on your `PATH`. Verify with:
102
+
103
+ ```bash
104
+ s3mbura --help
105
+ ```
106
+
107
+ ## Usage
108
+
109
+ ```bash
110
+ # Audit a single bucket (passive, anonymous by default)
111
+ s3mbura dev.huge-logistics.com -v
112
+
113
+ # Any S3 addressing style works
114
+ s3mbura https://s3.amazonaws.com/dev.huge-logistics.com
115
+
116
+ # Authenticated (SigV4) audit with a named profile
117
+ s3mbura my-bucket --signed --profile prod
118
+
119
+ # Reports
120
+ s3mbura my-bucket --json report.json # full JSON
121
+ s3mbura my-bucket --sarif report.sarif # SARIF 2.1.0 (GitHub code scanning)
122
+ s3mbura my-bucket --json-stdout # JSON to stdout
123
+
124
+ # Intrusive, opt-in (authorised targets only)
125
+ s3mbura my-bucket --download # fetch + scan object content for secrets
126
+ s3mbura my-bucket --active # write-probe (canary PutObject, never deletes)
127
+
128
+ # Namespace discovery: enumerate likely bucket names from a keyword
129
+ s3mbura acme --discover
130
+
131
+ # Recover the owner AWS account ID (noisy; needs your creds + a role to assume)
132
+ s3mbura my-bucket --signed --account-id --account-id-role arn:aws:iam::<you>:role/probe
133
+ ```
134
+
135
+ Accepts every S3 addressing style: bare name, virtual-hosted URL, path-style URL,
136
+ and website endpoint. Exit code is non-zero when a finding of MEDIUM severity or
137
+ higher is reported.
138
+
139
+ ### Docker
140
+
141
+ ```bash
142
+ docker build -t s3mbura .
143
+ docker run --rm s3mbura dev.huge-logistics.com -v
144
+ ```
145
+
146
+ > Planned to also ship as a module of **manguescan** (`manguescan s3`), keeping
147
+ > *S3mburá* as the module's identity in the banner and docs.
148
+
149
+ ## Authorised use only
150
+
151
+ This is an offensive-security tool. Use it **only** against buckets you own or are
152
+ explicitly authorised to test (your own labs, CTFs, or in-scope engagements).
153
+
154
+ - **Passive by default.** Metadata and permission checks are read-only.
155
+ - `--download` is required before any object content is fetched.
156
+ - `--active` is required before any write-probe, and the tool **never deletes**.
157
+
158
+ ## Credits & inspiration
159
+
160
+ s3mbura stands on the shoulders of the tools and researchers below. It does not
161
+ reuse their code — every line here is original — but it openly borrows their
162
+ ideas and tries to unify the best of each into one S3-focused tool.
163
+
164
+ **Origin story.** This project started while solving the Pwned Labs lab
165
+ [*AWS S3 Enumeration Basics*](https://pwnedlabs.io/), where
166
+ [BucketLoot](https://github.com/redhuntlabs/BucketLoot) could not list a bucket
167
+ whose policy conditioned `s3:ListBucket` on `s3:delimiter`. Explaining *why*
168
+ (not a bug — the policy requires a request shape `aws s3 ls` happens to send)
169
+ became the seed of the condition-aware listing idea.
170
+
171
+ | Capability in s3mbura | Inspired by / idea from |
172
+ |---|---|
173
+ | Content & secret scanning (`--download`) | [BucketLoot](https://github.com/redhuntlabs/BucketLoot) (RedHunt Labs) |
174
+ | Permission / ACL enumeration model | [S3Scanner](https://github.com/sa7mon/S3Scanner) (sa7mon) |
175
+ | Scope decision (S3-only, *not* multi-cloud) | [cloud_enum](https://github.com/initstring/cloud_enum) (initstring) — deliberately narrowed |
176
+ | Check-registry + streaming findings, CIS/FSBP mapping | [Prowler](https://github.com/prowler-cloud/prowler) and [ScoutSuite](https://github.com/nccgroup/ScoutSuite) |
177
+ | Condition-aware listing (`s3:delimiter`/`s3:prefix`) | [Pwned Labs](https://pwnedlabs.io/) lab + the way `aws s3 ls` defaults to `delimiter=/` |
178
+ | Owner account-ID enumeration (`--account-id`) | [s3-account-search](https://github.com/WeAreCloudar/s3-account-search) (Ben Bridts / Cloudar) and `bucky` (umair9747) |
179
+ | The `s3:ResourceAccount` condition-key technique | [Ben Bridts, 2021](https://hackingthe.cloud/aws/enumeration/enumerate_metadata_via_iam_condition_keys/); generalised by [Plerion — conditional-love](https://github.com/plerionhq/conditional-love) |
180
+ | Namespace / wordlist discovery (`--discover`) | S3Scanner and cloud_enum name-permutation approaches |
181
+ | SARIF 2.1.0 output | severities anchored to the [CIS AWS Foundations Benchmark](https://www.cisecurity.org/benchmark/amazon_web_services) and [AWS Foundational Security Best Practices](https://docs.aws.amazon.com/securityhub/latest/userguide/fsbp-standard.html) |
182
+
183
+ **Further reading** on the account-ID technique:
184
+ [Plerion](https://www.plerion.com/blog/conditional-love-for-aws-metadata-enumeration),
185
+ [Tracebit](https://tracebit.com/blog/how-to-find-the-aws-account-id-of-any-s3-bucket),
186
+ [HackTricks Cloud](https://cloud.hacktricks.wiki/en/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum/index.html).
187
+
188
+ Thanks to all of the above authors and maintainers.
189
+
190
+ ## License
191
+
192
+ MIT © 0xs3n4
@@ -0,0 +1,156 @@
1
+ # 🦀 S3mburá
2
+
3
+ > *Everything the bucket holds, in one basket.*
4
+
5
+ **s3mbura** is a focused security auditor for **Amazon S3**. The *samburá* is the
6
+ basket a mangrove catcher carries to hold everything pulled from the mud — and
7
+ that is exactly what this tool does to a bucket: it reaches in and brings back
8
+ everything knowable about it, in one place.
9
+
10
+ One tool that combines the three things the ecosystem spreads across separate
11
+ projects:
12
+
13
+ | Layer | What it does |
14
+ |-------|--------------|
15
+ | **Permissions** | public ACL, policy status, Public Access Block, effective access |
16
+ | **Configuration sweep** | every readable bucket sub-resource (CORS, encryption, logging, website, versioning, ...) |
17
+ | **Listing** | condition-aware listing that adapts to restrictive bucket policies |
18
+ | **Content** | verified secret / PII scanning of reachable objects |
19
+
20
+ S3-only by design: no multi-cloud, no bloat. See [`ROADMAP.md`](ROADMAP.md) for the
21
+ full design and build plan.
22
+
23
+ ### The four differentiators, in mangue terms
24
+
25
+ | Differentiator | Mangue metaphor |
26
+ |----------------|-----------------|
27
+ | Full sub-resource sweep | **Bracear** — reach your whole arm into the burrow, checking every sub-resource |
28
+ | Versioned-object recovery | **Lama** — what was "deleted" sank into the mud, but it's still down there |
29
+ | Condition-aware listing | **Siri** — the crab walks sideways, sending the request shape the policy already accepts |
30
+ | Verified secrets | **Samburá** — only the real crabs go in the basket; no false positives |
31
+
32
+ > **Status:** all 8 roadmap phases implemented — existence/region, full
33
+ > sub-resource sweep, effective-access probes, condition-aware listing,
34
+ > versioned-object recovery, verified-secret content scanning, JSON/SARIF
35
+ > output, and concurrency + namespace discovery. See [`ROADMAP.md`](ROADMAP.md).
36
+
37
+ ## Install
38
+
39
+ Requires **Python 3.11+**.
40
+
41
+ ### Via pip
42
+
43
+ > Not on PyPI yet — install straight from the repository:
44
+
45
+ ```bash
46
+ pip install git+https://github.com/0xs3n4/s3mbura.git
47
+ ```
48
+
49
+ Once published, this becomes simply `pip install s3mbura`.
50
+
51
+ ### Via git clone (for development)
52
+
53
+ Clone and install in editable mode, so your changes take effect without reinstalling:
54
+
55
+ ```bash
56
+ git clone https://github.com/0xs3n4/s3mbura.git
57
+ cd s3mbura
58
+
59
+ python -m venv .venv
60
+ source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
61
+
62
+ pip install -e ".[dev]" # editable install + test/lint tooling
63
+ ```
64
+
65
+ Either way you get the `s3mbura` command on your `PATH`. Verify with:
66
+
67
+ ```bash
68
+ s3mbura --help
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ```bash
74
+ # Audit a single bucket (passive, anonymous by default)
75
+ s3mbura dev.huge-logistics.com -v
76
+
77
+ # Any S3 addressing style works
78
+ s3mbura https://s3.amazonaws.com/dev.huge-logistics.com
79
+
80
+ # Authenticated (SigV4) audit with a named profile
81
+ s3mbura my-bucket --signed --profile prod
82
+
83
+ # Reports
84
+ s3mbura my-bucket --json report.json # full JSON
85
+ s3mbura my-bucket --sarif report.sarif # SARIF 2.1.0 (GitHub code scanning)
86
+ s3mbura my-bucket --json-stdout # JSON to stdout
87
+
88
+ # Intrusive, opt-in (authorised targets only)
89
+ s3mbura my-bucket --download # fetch + scan object content for secrets
90
+ s3mbura my-bucket --active # write-probe (canary PutObject, never deletes)
91
+
92
+ # Namespace discovery: enumerate likely bucket names from a keyword
93
+ s3mbura acme --discover
94
+
95
+ # Recover the owner AWS account ID (noisy; needs your creds + a role to assume)
96
+ s3mbura my-bucket --signed --account-id --account-id-role arn:aws:iam::<you>:role/probe
97
+ ```
98
+
99
+ Accepts every S3 addressing style: bare name, virtual-hosted URL, path-style URL,
100
+ and website endpoint. Exit code is non-zero when a finding of MEDIUM severity or
101
+ higher is reported.
102
+
103
+ ### Docker
104
+
105
+ ```bash
106
+ docker build -t s3mbura .
107
+ docker run --rm s3mbura dev.huge-logistics.com -v
108
+ ```
109
+
110
+ > Planned to also ship as a module of **manguescan** (`manguescan s3`), keeping
111
+ > *S3mburá* as the module's identity in the banner and docs.
112
+
113
+ ## Authorised use only
114
+
115
+ This is an offensive-security tool. Use it **only** against buckets you own or are
116
+ explicitly authorised to test (your own labs, CTFs, or in-scope engagements).
117
+
118
+ - **Passive by default.** Metadata and permission checks are read-only.
119
+ - `--download` is required before any object content is fetched.
120
+ - `--active` is required before any write-probe, and the tool **never deletes**.
121
+
122
+ ## Credits & inspiration
123
+
124
+ s3mbura stands on the shoulders of the tools and researchers below. It does not
125
+ reuse their code — every line here is original — but it openly borrows their
126
+ ideas and tries to unify the best of each into one S3-focused tool.
127
+
128
+ **Origin story.** This project started while solving the Pwned Labs lab
129
+ [*AWS S3 Enumeration Basics*](https://pwnedlabs.io/), where
130
+ [BucketLoot](https://github.com/redhuntlabs/BucketLoot) could not list a bucket
131
+ whose policy conditioned `s3:ListBucket` on `s3:delimiter`. Explaining *why*
132
+ (not a bug — the policy requires a request shape `aws s3 ls` happens to send)
133
+ became the seed of the condition-aware listing idea.
134
+
135
+ | Capability in s3mbura | Inspired by / idea from |
136
+ |---|---|
137
+ | Content & secret scanning (`--download`) | [BucketLoot](https://github.com/redhuntlabs/BucketLoot) (RedHunt Labs) |
138
+ | Permission / ACL enumeration model | [S3Scanner](https://github.com/sa7mon/S3Scanner) (sa7mon) |
139
+ | Scope decision (S3-only, *not* multi-cloud) | [cloud_enum](https://github.com/initstring/cloud_enum) (initstring) — deliberately narrowed |
140
+ | Check-registry + streaming findings, CIS/FSBP mapping | [Prowler](https://github.com/prowler-cloud/prowler) and [ScoutSuite](https://github.com/nccgroup/ScoutSuite) |
141
+ | Condition-aware listing (`s3:delimiter`/`s3:prefix`) | [Pwned Labs](https://pwnedlabs.io/) lab + the way `aws s3 ls` defaults to `delimiter=/` |
142
+ | Owner account-ID enumeration (`--account-id`) | [s3-account-search](https://github.com/WeAreCloudar/s3-account-search) (Ben Bridts / Cloudar) and `bucky` (umair9747) |
143
+ | The `s3:ResourceAccount` condition-key technique | [Ben Bridts, 2021](https://hackingthe.cloud/aws/enumeration/enumerate_metadata_via_iam_condition_keys/); generalised by [Plerion — conditional-love](https://github.com/plerionhq/conditional-love) |
144
+ | Namespace / wordlist discovery (`--discover`) | S3Scanner and cloud_enum name-permutation approaches |
145
+ | SARIF 2.1.0 output | severities anchored to the [CIS AWS Foundations Benchmark](https://www.cisecurity.org/benchmark/amazon_web_services) and [AWS Foundational Security Best Practices](https://docs.aws.amazon.com/securityhub/latest/userguide/fsbp-standard.html) |
146
+
147
+ **Further reading** on the account-ID technique:
148
+ [Plerion](https://www.plerion.com/blog/conditional-love-for-aws-metadata-enumeration),
149
+ [Tracebit](https://tracebit.com/blog/how-to-find-the-aws-account-id-of-any-s3-bucket),
150
+ [HackTricks Cloud](https://cloud.hacktricks.wiki/en/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum/index.html).
151
+
152
+ Thanks to all of the above authors and maintainers.
153
+
154
+ ## License
155
+
156
+ MIT © 0xs3n4
@@ -0,0 +1,150 @@
1
+ # 🦀 S3mburá (s3mbura) — Design & Roadmap
2
+
3
+ A focused, AWS-native auditor for Amazon S3 that unifies the best of the existing
4
+ tools (S3Scanner's permission model, BucketLoot's content scanning) and adds the
5
+ pieces none of them do well. Built as a learning project — each module maps to a
6
+ concrete piece of the S3 API.
7
+
8
+ ## Architecture: check registry + finding model
9
+
10
+ The tool is a **registry of independent checks**, not a rigid pipeline. Each check
11
+ declares an id, may read data a previous check stashed in `ctx.shared`, and emits
12
+ `Finding` objects onto a streaming `FindingBus`. Reporters (console, JSON, later
13
+ SARIF) subscribe to the bus and react immediately.
14
+
15
+ ```
16
+ target string
17
+ |
18
+ Target resolver (4 addressing styles -> bucket + region + website?)
19
+ |
20
+ Check registry (each check: run(ctx) -> emits Findings)
21
+ |
22
+ FindingBus (streaming; severity; CIS / AWS FSBP mapping)
23
+ |
24
+ Reporters (console live + JSON / SARIF)
25
+ ```
26
+
27
+ A `Finding` is standardised: `check_id, title, severity, resource, evidence,
28
+ remediation, references, timestamp`.
29
+
30
+ ## The four real differentiators
31
+
32
+ 1. **Full sub-resource sweep** — enumerate every readable bucket configuration,
33
+ not just the ACL. The most complete S3 config audit.
34
+ 2. **Versioned-object recovery** — if `ListBucketVersions` is reachable, recover
35
+ old / deleted objects via `GetObjectVersion` (recovers "deleted" secrets).
36
+ 3. **Condition-aware listing** — when listing is denied, probe the matrix of
37
+ policy condition keys (`delimiter`, `prefix`, `max-keys`), recurse into
38
+ `CommonPrefixes`, and **report the inferred policy shape** as a finding.
39
+ (Note: this is not a "bypass" — it sends the request shape the policy already
40
+ requires; `aws s3 ls` sends `delimiter=/` by default for the same reason.)
41
+ 4. **Verified secret findings** — regex + entropy, then live-verify high-value
42
+ candidates (e.g. an AWS key via `sts:GetCallerIdentity`) to kill false
43
+ positives. A focused scanner, not a trufflehog replacement.
44
+
45
+ ## Stack & key learning levers
46
+
47
+ - **Python 3.11+ / boto3 + botocore** — closest mapping between code and the S3 API.
48
+ - **Deliberate mix of boto3 and raw HTTP** — boto3 for structured calls; raw
49
+ `requests` where we need precise control over query params (condition-aware
50
+ listing). **Signing one SigV4 request by hand** (Phase 1) is the single most
51
+ valuable AWS learning exercise.
52
+ - **Anonymous (UNSIGNED) vs signed (SigV4)** — both implemented.
53
+ - **Adaptive retry / backoff and streaming are foundational**, not polish: S3
54
+ returns `503 SlowDown`, and buckets can hold millions of objects, so key lists
55
+ are streamed via generators, never buffered whole.
56
+
57
+ ## Phased build
58
+
59
+ - **Phase 0 — Foundation** ✅
60
+ Project layout, CLI, target resolver (4 styles), `Finding` model + streaming
61
+ `FindingBus`, check registry, boto3 adaptive-retry client factory, console/JSON
62
+ reporters, tests.
63
+ - **Phase 1 — Existence & region** ✅ *(current)*
64
+ Raw-HTTP `HEAD /<bucket>` to the path-style global endpoint; reads
65
+ `x-amz-bucket-region` even on 403/404; classifies 200/403/301/404. *Learning
66
+ lever delivered:* a from-scratch SigV4 signer (`sigv4.py`), verified byte-for-byte
67
+ against botocore, used to sign the probe in `--signed` mode. boto3 takes over for
68
+ the typed sub-resource APIs from Phase 2.
69
+ - **Phase 2 — Sub-resource sweep** (the "complete" part) ✅ *(current)*
70
+ ACL, policy, `GetBucketPolicyStatus`, PublicAccessBlock, CORS, website,
71
+ versioning, logging, encryption, lifecycle, tagging, replication, notifications,
72
+ ownership controls, request-payment. Each readable one = a finding, mapped to
73
+ CIS AWS Benchmark / AWS FSBP. *Delivered:* `checks/subresources.py` — 15
74
+ independent probes behind a shared `_call` classifier (readable /
75
+ not-configured / access-denied); public ACL -> HIGH/CRITICAL, conditional
76
+ public policy -> MEDIUM (the lab's shape), missing BPA / logging -> MEDIUM, etc.
77
+ Access-denied results collapse into one summary finding instead of noise.
78
+ Tested with a deterministic `FakeS3` (every error-code branch) plus a moto
79
+ smoke test. 52 tests total.
80
+ - **Phase 3 — Effective permissions** ✅ *(current)*
81
+ Combine ACL + policy + BPA into *effective* access. Anonymous read probe. Write
82
+ probe only under `--active` (random-key canary, **never delete**).
83
+ *Delivered:* `checks/effective_access.py` — empirical anonymous `list` + object
84
+ `read` (via HeadObject, no download) proving real access, reconciled with the
85
+ Phase 2 config signals honouring the **BPA-overrides-public** precedence rule;
86
+ `--active` canary PutObject (anonymous write → CRITICAL, signed → INFO) that is
87
+ never deleted and whose key is reported. Run order is now **explicit**
88
+ (`order` attribute, sorted in the registry) instead of import-order dependent.
89
+ 64 tests total, ruff clean.
90
+ - **Phase 4 — Condition-aware listing** ✅ *(current)*
91
+ Paginated `ListObjectsV2` (streamed). On 403, probe the condition matrix, recurse
92
+ into `CommonPrefixes`, report the inferred policy shape. *Delivered:* `listing.py`
93
+ (streaming `stream_pages`/`iter_keys`, `probe_condition`, `walk_tree` with
94
+ per-prefix denial handling) + `checks/listing.py`. **Cracks the lab live**: plain
95
+ list denied, but `{delimiter:'/', prefix:''}` permitted → recovered 7 keys
96
+ including `shared/hl_migration_project.zip`, correctly flagging `admin/` and
97
+ `migration-files/` as denied. Confirmed the lab needs BOTH s3:delimiter AND
98
+ s3:prefix. Tested with moto (pagination/recursion) + fakes (condition logic).
99
+ - **Phase 5 — Versioning & recovery** ✅ *(current)*
100
+ `ListBucketVersions`, delete markers, recover versions via `GetObjectVersion`.
101
+ *Delivered:* `versions.py` (streamed `collect_versions`, `recoverable_deleted`
102
+ = keys whose latest version is a delete marker but with readable content
103
+ underneath, `version_stats`) + `checks/versioning.py`, which confirms
104
+ recoverability with HeadObject on the old VersionId (no download) and stashes
105
+ `recoverable_versions` for Phase 6. Tested end-to-end on moto (versioning,
106
+ delete markers, GetObjectVersion) + a denied-path fake.
107
+ - **Phase 6 — Content & verified secrets** ✅ *(current)*
108
+ Streamed `GetObject` under `--download`, extension filter, regex + entropy, live
109
+ verification of high-value candidates. *Delivered:* `secrets_scan.py` (curated
110
+ high-signal rules, Shannon entropy, `redact`, `find_aws_pairs`,
111
+ `verify_aws_credentials` via sts:GetCallerIdentity) + `checks/content.py`
112
+ (range-capped fetch, text + in-memory ZIP scanning with zip-bomb guards, scans
113
+ Phase-5 recovered versions too; nothing written to disk). Verified AWS key →
114
+ CRITICAL, unverified matches lower. Live: anonymous GetObject on the lab works;
115
+ pipeline fetches+scans end to end. Tests: detection unit + moto content/zip
116
+ with monkeypatched verification.
117
+ - **Phase 7 — Output & credibility** ✅ *(current)*
118
+ JSON + console + **SARIF**; severities anchored to CIS / AWS FSBP, remediation
119
+ per finding. *Delivered:* `sarif_report`/`write_sarif` (SARIF 2.1.0 with one
120
+ rule per check_id, numeric `security-severity` for GitHub code scanning,
121
+ remediation in the message, `s3://` artifact location) and `--sarif FILE`;
122
+ json_summary now uses the package version. Validated live on the lab.
123
+ - **Phase 8 — Optional** ✅ *(current)*
124
+ Controlled concurrency, S3-only wordlist discovery, account-ID enumeration,
125
+ packaging / Docker. *Delivered:* concurrent sub-resource sweep
126
+ (`ThreadPoolExecutor`, 8 workers, thread-safe `FindingBus` lock, pre-initialised
127
+ shared containers); `discovery.py` + `--discover` (name-permutation recon via
128
+ HEAD, bounded/concurrency-limited — found `huge-logistics.com` and
129
+ `dev.huge-logistics.com` live); `Dockerfile` (multi-stage, non-root).
130
+ *Account-ID enumeration:* `account_id.py` + `checks/account_id.py` + `--account-id`
131
+ — recovers the owner AWS account ID via the `s3:ResourceAccount` StringLike
132
+ brute force (Ben Bridts, 2021): assumes a user-supplied role with an inline
133
+ session policy per candidate digit, HeadObject-probes a readable key, and
134
+ reconstructs all 12 digits (~120 requests). Opt-in, needs `--signed` +
135
+ `--account-id-role`; STS/S3 seams are injected so the digit search is fully
136
+ unit-tested.
137
+
138
+ ## Testing strategy
139
+
140
+ - **Unit:** `moto` for the happy path (existence, simple ACL, unconditioned listing).
141
+ - **Condition-aware listing** cannot be validated with `moto` (it does not evaluate
142
+ policy conditions) — use **LocalStack** or a real self-owned bucket with a
143
+ conditional `s3:delimiter` policy that reproduces the lab.
144
+ - **Integration:** self-owned buckets in each config (public, versioned, CORS `*`, ...).
145
+
146
+ ## Ethics & scope
147
+
148
+ Authorised targets only. Passive by default; content download (`--download`) and
149
+ write-probes (`--active`) are opt-in, write-probes never delete, and all scanning
150
+ is rate-limited to avoid impacting the target.