Skip to content

Commit 7b66f39

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks-cloud
2 parents ffaced9 + 6ced657 commit 7b66f39

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ aws codebuild start-build --project-name <proj-name>
185185
> [!WARNING]
186186
> Now an attacker will be able to use the token from his machine, list all the privileges it has and (ab)use easier than using the CodeBuild service directly.
187187
188+
## Webhook filter ACTOR_ID regex allowlist bypass (PR-triggered privileged builds)
189+
190+
Misconfigured CodeBuild GitHub webhooks that use unanchored `ACTOR_ID` regexes let *untrusted* PRs start privileged builds. If the allowlist is like `123456|7890123` without `^`/`$`, any ID containing one of those substrings matches. Because GitHub user IDs are sequential, an attacker can race to register an “eclipsing” ID (a superstring of a trusted ID) and trigger the build.
191+
192+
**Exploit path**
193+
194+
1. Find public CodeBuild projects exposing webhook filters and extract an unanchored `ACTOR_ID` allowlist.
195+
2. Obtain an eclipsing GitHub ID:
196+
- Sample the global ID counter by creating/deleting GitHub orgs (org IDs share the pool).
197+
- Pre-stage many GitHub App manifest creations and fire the confirmation URLs when the counter is within ~100 IDs of the target to burst-register a bot ID containing the trusted substring.
198+
3. Open a PR from the eclipsing account; the regex matches the substring and the privileged build runs.
199+
4. Use build RCE (e.g., dependency install hooks) to dump process memory handling the GitHub credential and recover the PAT/OAuth token.
200+
5. With the token’s `repo` scope, invite your account as collaborator/admin and push/approve malicious commits or exfiltrate secrets.
201+
202+
## References
203+
- [Wiz: CodeBreach – AWS CodeBuild ACTOR_ID regex bypass and token theft](https://www.wiz.io/blog/wiz-research-codebreach-vulnerability-aws-codebuild)
204+
188205
{{#include ../../../../banners/hacktricks-training.md}}
189206

190207

src/pentesting-cloud/azure-security/az-services/az-storage.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,24 @@ If "Allow Blob public access" is **enabled** (disabled by default), when creatin
6565

6666
<figure><img src="https://lh7-rt.googleusercontent.com/slidesz/AGV_vUfoetUnYBPWQpRrWNnnlbqWpl8Rdoaeg5uBrCVlvcNDlnKwQHjZe8nUb2SfPspBgbu-lCZLmUei-hFi_Jl2eKbaxUtBGTjdUSDmkrcwr90VZkmuMjk9tyh92p75btfyzGiUTa0-=s2048?key=m8TV59TrCFPlkiNnmhYx3aZt" alt=""><figcaption></figcaption></figure>
6767

68-
#### Auditing anonymous blob exposure
68+
### Static website (`$web`) exposure & leaked secrets
69+
70+
- **Static websites** are served from the special `$web` container over a region-specific endpoint such as `https://<account>.z13.web.core.windows.net/`.
71+
- The `$web` container may report `publicAccess: null` via the blob API, but files are still reachable through the static site endpoint, so dropping config/IaC artifacts there can leak secrets.
72+
- Quick audit workflow:
73+
74+
```bash
75+
# Identify storage accounts with static website hosting enabled
76+
az storage blob service-properties show --account-name <acc-name> --auth-mode login
77+
# Enumerate containers (including $web) and their public flags
78+
az storage container list --account-name <acc-name> --auth-mode login
79+
# List files served by the static site even when publicAccess is null
80+
az storage blob list --container-name '$web' --account-name <acc-name> --auth-mode login
81+
# Pull suspicious files directly (e.g., IaC tfvars containing secrets/SAS)
82+
az storage blob download -c '$web' --name iac/terraform.tfvars --file /dev/stdout --account-name <acc-name> --auth-mode login
83+
```
84+
85+
### Auditing anonymous blob exposure
6986

7087
- **Locate storage accounts** that can expose data: `az storage account list | jq -r '.[] | select(.properties.allowBlobPublicAccess==true) | .name'`. If `allowBlobPublicAccess` is `false` you cannot turn containers public.
7188
- **Inspect risky accounts** to confirm the flag and other weak settings: `az storage account show --name <acc> --query '{allow:properties.allowBlobPublicAccess, minTls:properties.minimumTlsVersion}'`.
@@ -467,6 +484,7 @@ az-file-shares.md
467484
- [https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction)
468485
- [https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)
469486
- [https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support](https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support)
487+
- [Holiday Hack Challenge 2025 – Spare Key (Azure static website SAS leak)](https://0xdf.gitlab.io/holidayhack2025/act1/spare-key)
470488
- [Holiday Hack Challenge 2025: Blob Storage (Storage Secrets)](https://0xdf.gitlab.io/holidayhack2025/act1/blob-storage)
471489
- [https://learn.microsoft.com/en-us/cli/azure/storage/account](https://learn.microsoft.com/en-us/cli/azure/storage/account)
472490
- [https://learn.microsoft.com/en-us/cli/azure/storage/container](https://learn.microsoft.com/en-us/cli/azure/storage/container)

0 commit comments

Comments
 (0)