Skip to content

Commit fa87ef6

Browse files
committed
Added S3 writeup
1 parent c07e4ec commit fa87ef6

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

docs/risks/s3.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,38 @@
55
* To expose the resource using `endgame`, run the following from the victim account:
66

77
```bash
8-
export EVIL_PRINCIPAL=arn:aws:iam::999988887777:user/evil
8+
export EVIL_PRINCIPAL=*
99

1010
endgame expose --service s3 --name test-resource-exposure
1111
```
1212

13+
* To verify that the S3 bucket has been shared with the public, run the following from the victim account:
14+
15+
```bash
16+
aws s3api get-bucket-policy --bucket test-resource-exposure
17+
```
18+
19+
* Observe that the contents match the example shown below.
20+
21+
1322
## Example
1423

24+
The response of the `get-bucket-policy` command will return the below. Observe how the Evil Principal (`arn:aws:iam::999988887777:evil`) is granted full access to the S3 bucket.
25+
26+
```json
27+
{
28+
"Policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"AllowCurrentAccount\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::999988887777:evil\"},\"Action\":\"s3:*\",\"Resource\":[\"arn:aws:s3:::test-resource-exposure\",\"arn:aws:s3:::test-resource-exposure/*\"]}]}"
29+
}
30+
31+
32+
```
33+
1534
## Exploitation
1635

36+
```
37+
TODO
38+
```
39+
1740
## Remediation
1841

1942
> ‼️ **Note**: At the time of this writing, AWS Access Analyzer does **NOT** support auditing of this resource type to prevent resource exposure. **We kindly suggest to the AWS Team that they support all resources that can be attacked using this tool**. 😊
@@ -29,4 +52,5 @@ Also, consider using [Cloudsplaining](https://github.com/salesforce/cloudsplaini
2952

3053
## References
3154

32-
- [aws s3api put-bucket-policy](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-policy.html)
55+
- [aws s3api put-bucket-policy](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-policy.html)
56+
- [aws s3api get-bucket-policy](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-policy.html)

0 commit comments

Comments
 (0)