Skip to content

Commit 12356b8

Browse files
authored
Update ###mmistakes#2023-01-21-IAM-attacking-AWS.md
1 parent b1b67c4 commit 12356b8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

_posts/####2023-01-21-IAM-attacking-AWS.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ So to test this, we feed it a page containing an image, and view the response in
3838

3939
![retrieved_data_stored_on_s3](/assets/images/AWS_1/upload_url_feature.jpg)
4040

41-
We visit the returned s3 link to confirm it contains the original linked image and lo and behold, the best case scenario is true, and we are able to make requests in some capacity within the context of the server (aka SSRF, an often overlooked vulnerability)
41+
We visit the returned s3 link to confirm it contains the original linked image and lo and behold, the best case scenario is true, and we are able to make requests in some capacity within the context of the server (aka Server Side Request Forgery, an often overlooked vulnerability)
4242
![CATE](/assets/images/AWS_1/kitten_image.jpg)
4343

4444
The most obvious step from here is to attempt a metadata v1 attack, where we trick the underlying EC2 instance to hit the AWS metadata endpoint to retrive privileged information.
4545

4646
![ssrf_v1_attempt](/assets/images/AWS_1/ssrf_v1_attempt.jpg)
4747

48-
This however does not work and returns a server error immediately. Further testing revealed that the application required a `200` response to be suvvesful. This indicates either that metadata v2 was in use which requires more sophisticated techniques, or, that the webapp may be running on lambda.
48+
This however does not work and returns a server error immediately. Further testing revealed that the application required a `200` response to be succesful. This indicates either that metadata v2 was in use which requires more sophisticated techniques, or, that the webapp may be running on lambda.
4949

5050
After trying a few different approaches, I discovered an LFI (local file inclusion) escalation which allowed for the retrieval of files within the ephemeral environment.
5151
As a common way to feed credentials to lambda functions is via environment variables, we attempt to continue our chain of attacks by retrieving a copy of `/proc/self/environ`
@@ -60,7 +60,7 @@ We store these secrets in our envrinment variables for our terminal session and
6060

6161
![stolen_key_auth_success](/assets/images/AWS_1/stolen_key_auth_success.jpg)
6262

63-
Unfortunately from here however, we discover the account does not have IAM list privileges after trying to list policies. I even tried to enumerate with an AWS exploit tool called [PACU](![ssrf_loot](https://github.com/RhinoSecurityLabs/pacu) to see if I was missing anything, it was however a dead on the IAM front. When this happened I said "IAM dissapointed"
63+
Unfortunately from here however, we discover the account does not have IAM list privileges after trying to list policies. I even tried to enumerate with an AWS exploit tool called ![PACU](https://github.com/RhinoSecurityLabs/pacu) to see if I was missing anything, it was however a dead on the IAM front. When this happened I said "IAM dissapointed"
6464

6565
![dissapointed](/assets/images/AWS_1/dissapointed.gif)
6666
![list_policy_fail](/assets/images/AWS_1/list_policy_fail.jpg)
@@ -75,9 +75,7 @@ Although we were unable to enumerate our own level of permissions, we can determ
7575

7676
Now this is spciey, we cannot enumerate our own permissions in `IAM`, but we can not only list the `S3` buckets but can see what is inside of them,
7777

78-
discover the account does not have IAM list privileges
79-
explore s3
80-
list dev-bucket contents
78+
8179
grab ssh keys and config
8280
ssh in and enumerate current roles policies
8381
discover that the previous assumed role has full access on lambda and the current assumed role has createpolicy and attachrolepolicy

0 commit comments

Comments
 (0)