Skip to content

Commit

Permalink
Merge pull request #34 from teamssix/main
Browse files Browse the repository at this point in the history
feat: add aliyun oss bucket readable scenario
  • Loading branch information
teamssix committed May 18, 2022
2 parents e985eaf + 44eadab commit 849332d
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 47 deletions.
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,31 @@ Currently supported cloud vendors include Alibaba Cloud, Tencent Cloud, Huawei C
| 5 | Alibaba Cloud | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/object_acl_writable) |
| 6 | Alibaba Cloud | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/special_bucket_policy) |
| 7 | Alibaba Cloud | Object Storage | [Bucket Public Access](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_public_access) |
| 8 | Alibaba Cloud | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_object_traversal) |
| 9 | Alibaba Cloud | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/unrestricted_file_upload) |
| 10 | Alibaba Cloud | Elastic Computing Service | [ECS SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/ecs/ecs_ssrf) |
| 11 | Huawei Cloud | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/object_acl_writable) |
| 12 | Huawei Cloud | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/special_bucket_policy) |
| 13 | Huawei Cloud | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/unrestricted_file_upload) |
| 14 | Huawei Cloud | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/bucket_object_traversal) |
| 15 | Huawei Cloud | Elastic Computing Service | [ECS SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/ecs/ecs_ssrf) |
| 16 | Amazon Web Services | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/object_acl_writable) |
| 17 | Amazon Web Services | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_acl_writable) |
| 18 | Amazon Web Services | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 19 | Amazon Web Services | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 20 | Amazon Web Services | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/unrestricted_file_upload) |
| 21 | Amazon Web Services | Elastic Computing Service | [EC2 SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 22 | Amazon Web Services | Elastic Computing Service | [Console Takeover](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 23 | Amazon Web Services | Identity and Access Management | [IAM Privilege Escalation](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 24 | Google Cloud Platform | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 25 | Google Cloud Platform | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 26 | Google Cloud Platform | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 27 | Google Cloud Platform | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 28 | Google Cloud Platform | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 29 | Microsoft Azure | Object Storage | [Blob Public Access](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 30 | Microsoft Azure | Object Storage | [Container Blob Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 31 | Microsoft Azure | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |
| 8 | Alibaba Cloud | Object Storage | [Bucket Policy Readable](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_policy_readable) |
| 9 | Alibaba Cloud | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_object_traversal) |
| 10 | Alibaba Cloud | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/unrestricted_file_upload) |
| 11 | Alibaba Cloud | Elastic Computing Service | [ECS SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/ecs/ecs_ssrf) |
| 12 | Huawei Cloud | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/object_acl_writable) |
| 13 | Huawei Cloud | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/special_bucket_policy) |
| 14 | Huawei Cloud | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/unrestricted_file_upload) |
| 15 | Huawei Cloud | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/bucket_object_traversal) |
| 16 | Huawei Cloud | Elastic Computing Service | [ECS SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/ecs/ecs_ssrf) |
| 17 | Amazon Web Services | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/object_acl_writable) |
| 18 | Amazon Web Services | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_acl_writable) |
| 19 | Amazon Web Services | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 20 | Amazon Web Services | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 21 | Amazon Web Services | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/unrestricted_file_upload) |
| 22 | Amazon Web Services | Elastic Computing Service | [EC2 SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 23 | Amazon Web Services | Elastic Computing Service | [Console Takeover](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 24 | Amazon Web Services | Identity and Access Management | [IAM Privilege Escalation](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 25 | Google Cloud Platform | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 26 | Google Cloud Platform | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 27 | Google Cloud Platform | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 28 | Google Cloud Platform | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 29 | Google Cloud Platform | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 30 | Microsoft Azure | Object Storage | [Blob Public Access](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 31 | Microsoft Azure | Object Storage | [Container Blob Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 32 | Microsoft Azure | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |

## :dizzy: Install

Expand Down
47 changes: 24 additions & 23 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,30 @@ Cloud Platform、Microsoft Azure 六个云厂商的云场景漏洞搭建。
| 6 | 阿里云 | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_object_traversal) |
| 7 | 阿里云 | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/object_acl_writable) |
| 8 | 阿里云 | 对象存储 | [Bucket 公开访问](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_public_access) |
| 9 | 阿里云 | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/special_bucket_policy) |
| 10 | 阿里云 | 弹性计算服务 | [ECS SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/ecs/ecs_ssrf) |
| 11 | 华为云 | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/unrestricted_file_upload) |
| 12 | 华为云 | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/object_acl_writable) |
| 13 | 华为云 | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/bucket_object_traversal) |
| 14 | 华为云 | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/special_bucket_policy) |
| 15 | 华为云 | 弹性计算服务 | [ECS SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/ecs/ecs_ssrf) |
| 16 | Amazon Web Services | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/unrestricted_file_upload) |
| 17 | Amazon Web Services | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/object_acl_writable) |
| 18 | Amazon Web Services | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_acl_writable) |
| 19 | Amazon Web Services | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 20 | Amazon Web Services | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 21 | Amazon Web Services | 弹性计算服务 | [EC2 SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 22 | Amazon Web Services | 弹性计算服务 | [控制台接管漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 23 | Amazon Web Services | 身份和访问管理 | [IAM 提权环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 24 | Google Cloud Platform | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 25 | Google Cloud Platform | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 26 | Google Cloud Platform | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 27 | Google Cloud Platform | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 28 | Google Cloud Platform | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 29 | Microsoft Azure | 对象存储 | [Blob 公开访问](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 30 | Microsoft Azure | 对象存储 | [Container Blob 遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 31 | Microsoft Azure | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |
| 9 | 阿里云 | 对象存储 | [Bucket 策略可读](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/bucket_policy_readable) |
| 10 | 阿里云 | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/oss/special_bucket_policy) |
| 11 | 阿里云 | 弹性计算服务 | [ECS SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aliyun/ecs/ecs_ssrf) |
| 12 | 华为云 | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/unrestricted_file_upload) |
| 13 | 华为云 | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/object_acl_writable) |
| 14 | 华为云 | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/bucket_object_traversal) |
| 15 | 华为云 | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/obs/special_bucket_policy) |
| 16 | 华为云 | 弹性计算服务 | [ECS SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/huaweicloud/ecs/ecs_ssrf) |
| 17 | Amazon Web Services | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/unrestricted_file_upload) |
| 18 | Amazon Web Services | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/object_acl_writable) |
| 19 | Amazon Web Services | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_acl_writable) |
| 20 | Amazon Web Services | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 21 | Amazon Web Services | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 22 | Amazon Web Services | 弹性计算服务 | [EC2 SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 23 | Amazon Web Services | 弹性计算服务 | [控制台接管漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 24 | Amazon Web Services | 身份和访问管理 | [IAM 提权环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 25 | Google Cloud Platform | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 26 | Google Cloud Platform | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 27 | Google Cloud Platform | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 28 | Google Cloud Platform | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 29 | Google Cloud Platform | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 30 | Microsoft Azure | 对象存储 | [Blob 公开访问](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 31 | Microsoft Azure | 对象存储 | [Container Blob 遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 32 | Microsoft Azure | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |

## :dizzy: 安装

Expand Down
52 changes: 52 additions & 0 deletions aliyun/oss/bucket_policy_readable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Alibaba Cloud OSS Bucket Policy Readable Vulnerable Environment

English | [中文](./README_CN.md)

## Description

This is a scenario used to build the Alibaba Cloud OSS bucket policy readable vulnerability environment.

After building the environment with Terraform, Anyone can access the contents of the bucket policy.

## Deployment Environment

Execute the following command in the container

```shell
cd /TerraformGoat/aliyun/oss/bucket_policy_readable
```

Configure Alibaba Cloud Access Credentials

```shell
aliyun configure
```

> You can create and view your AccessKey on the [AccessKey page](https://ram.console.aliyun.com/manage/ak) of the Alibaba Cloud console
Deploy Vulnerable Environment

```shell
terraform init
terraform apply
```

> When the terminal prompts `Enter a value:`, enter `yes`
After the environment is set up, You can see the bucket url of the scenario at Outputs.

## Vulnerability Utilization

Access the bucket url to get the content of the bucket policy

```shell
https://huoxian-terraformgoat-bucket-xxx.oss-cn-beijing.aliyuncs.com/?policy
```

![img](../../../images/1652866766.png)

## Destroy the environment

```shell
terraform destroy
```
52 changes: 52 additions & 0 deletions aliyun/oss/bucket_policy_readable/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 阿里云 OSS Bucket 策略公开可读漏洞环境

[English](./README.md) | 中文

## 描述信息

这是一个用于构建阿里云 OSS Bucket 策略公开可读漏洞环境的靶场。

使用 Terraform 构建环境后,任何人都可以直接访问到 Bucket 策略内容。

## 环境搭建

在容器中执行以下命令

```shell
cd /TerraformGoat/aliyun/oss/bucket_policy_readable
```

配置阿里云访问凭证

```shell
aliyun configure
```

> 在阿里云控制台的 [AccessKey 页面](https://ram.console.aliyun.com/manage/ak) 可以创建和查看您的 AccessKey
部署靶场

```shell
terraform init
terraform apply
```

> 在终端提示 `Enter a value:` 时,输入 `yes` 即可
环境搭建完后,在 Outputs 处可以看到 OSS 的 URL

## 漏洞利用

访问 Outputs 中的 URL,可以直接访问到 Bucket 策略的内容

```shell
https://huoxian-terraformgoat-bucket-xxx.oss-cn-beijing.aliyuncs.com/?policy
```

![img](../../../images/1652866766.png)

## 销毁环境

```shell
terraform destroy
```
33 changes: 33 additions & 0 deletions aliyun/oss/bucket_policy_readable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
provider "alicloud" {
profile = "default"
region = "cn-beijing"
}

resource "alicloud_oss_bucket" "huoxian_terraformgoat_bucket" {
acl = "private"
force_destroy = true
bucket = "huoxian-terraformgoat-bucket-${random_string.random_suffix.result}"
policy = <<POLICY
{
"Version": "1",
"Statement": [{
"Effect": "Allow",
"Action": [
"oss:GetBucketPolicy"
],
"Principal": [
"*"
],
"Resource": [
"acs:oss:*:*:*"
]
}]
}
POLICY
}

resource "random_string" "random_suffix" {
length = 5
special = false
upper = false
}
4 changes: 4 additions & 0 deletions aliyun/oss/bucket_policy_readable/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "aliyun_oss_url" {
description = "aliyun oss url"
value = "https://${alicloud_oss_bucket.huoxian_terraformgoat_bucket.bucket}.oss-cn-beijing.aliyuncs.com/?policy"
}

0 comments on commit 849332d

Please sign in to comment.