Skip to content

Commit

Permalink
Merge pull request #50 from teamssix/main
Browse files Browse the repository at this point in the history
feat: add aws s3 bucket default encryption disable scenario
  • Loading branch information
teamssix committed Jun 1, 2022
2 parents ffba0a3 + 972a7fa commit e003757
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 22 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ Currently supported cloud vendors include Alibaba Cloud, Tencent Cloud, Huawei C
| 30 | Amazon Web Services | Object Storage | [Special Bucket Policy](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 31 | Amazon Web Services | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 32 | Amazon Web Services | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/unrestricted_file_upload) |
| 33 | Amazon Web Services | Elastic Computing Service | [EC2 SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 34 | Amazon Web Services | Elastic Computing Service | [Console Takeover](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 35 | Amazon Web Services | Identity and Access Management | [IAM Privilege Escalation](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 36 | Google Cloud Platform | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 37 | Google Cloud Platform | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 38 | Google Cloud Platform | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 39 | Google Cloud Platform | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 40 | Google Cloud Platform | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 41 | Microsoft Azure | Object Storage | [Blob Public Access](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 42 | Microsoft Azure | Object Storage | [Container Blob Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 43 | Microsoft Azure | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |
| 33 | Amazon Web Services | Object Storage | [Bucket Default Encryption Disable](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_default_encryption_disable) |
| 34 | Amazon Web Services | Elastic Computing Service | [EC2 SSRF](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 35 | Amazon Web Services | Elastic Computing Service | [Console Takeover](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 36 | Amazon Web Services | Identity and Access Management | [IAM Privilege Escalation](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 37 | Google Cloud Platform | Object Storage | [Object ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 38 | Google Cloud Platform | Object Storage | [Bucket ACL Writable](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 39 | Google Cloud Platform | Object Storage | [Bucket Object Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 40 | Google Cloud Platform | Object Storage | [Unrestricted File Upload](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 41 | Google Cloud Platform | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 42 | Microsoft Azure | Object Storage | [Blob Public Access](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 43 | Microsoft Azure | Object Storage | [Container Blob Traversal](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 44 | Microsoft Azure | Elastic Computing Service | [VM Command Execution](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |

## :dizzy: Install

Expand Down
23 changes: 12 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ Cloud Platform、Microsoft Azure 六个云厂商的云场景漏洞搭建。
| 20 | Amazon Web Services | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_acl_writable) |
| 31 | Amazon Web Services | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_object_traversal) |
| 32 | Amazon Web Services | 对象存储 | [特殊的 Bucket 策略](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/special_bucket_policy) |
| 33 | Amazon Web Services | 弹性计算服务 | [EC2 SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 34 | Amazon Web Services | 弹性计算服务 | [控制台接管漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 35 | Amazon Web Services | 身份和访问管理 | [IAM 提权环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 36 | Google Cloud Platform | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 37 | Google Cloud Platform | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 38 | Google Cloud Platform | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 39 | Google Cloud Platform | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 40 | Google Cloud Platform | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 41 | Microsoft Azure | 对象存储 | [Blob 公开访问](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 42 | Microsoft Azure | 对象存储 | [Container Blob 遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 43 | Microsoft Azure | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |
| 33 | Amazon Web Services | 对象存储 | [Bucket 默认加密未开启](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/s3/bucket_default_encryption_disable) |
| 34 | Amazon Web Services | 弹性计算服务 | [EC2 SSRF 漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/ec2_ssrf) |
| 35 | Amazon Web Services | 弹性计算服务 | [控制台接管漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/ec2/console_takeover) |
| 36 | Amazon Web Services | 身份和访问管理 | [IAM 提权环境](https://github.com/HuoCorp/TerraformGoat/tree/main/aws/iam/privilege_escalation) |
| 37 | Google Cloud Platform | 对象存储 | [任意文件上传](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/unrestricted_file_upload) |
| 38 | Google Cloud Platform | 对象存储 | [Object ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/object_acl_writable) |
| 39 | Google Cloud Platform | 对象存储 | [Bucket ACL 可写](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_acl_writable) |
| 40 | Google Cloud Platform | 对象存储 | [Bucket 对象遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/cs/bucket_object_traversal) |
| 41 | Google Cloud Platform | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/gcp/vm/vm_command_execution) |
| 42 | Microsoft Azure | 对象存储 | [Blob 公开访问](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/blob_public_access/) |
| 43 | Microsoft Azure | 对象存储 | [Container Blob 遍历](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/blob/container_blob_traversal/) |
| 44 | Microsoft Azure | 弹性计算服务 | [VM 命令执行漏洞环境](https://github.com/HuoCorp/TerraformGoat/tree/main/azure/vm/vm_command_execution) |

## :dizzy: 安装

Expand Down
50 changes: 50 additions & 0 deletions aws/s3/bucket_default_encryption_disable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# AWS S3 Bucket server-side encryption disable scenario

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

## Description

This is the scenario in which the AWS S3 bucket server-side encryption disable scenario.

## Deployment Environment

Execute the following command in the container

```shell
cd /TerraformGoat/aws/s3/bucket_default_encryption_disable
```

Configure AWS Access Credentials

```shell
aws configure
```

> You can see the access key in the AWS [Console --> Security Credentials]
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 created Bucket at Outputs.

## Steps

Get the encryption method of the Bucket, if the return content is as follows, then the Bucket encryption is not enabled.

```shell
> aws s3api get-bucket-encryption --bucket houxian-xxx

An error occurred (ServerSideEncryptionConfigurationNotFoundError) when calling the GetBucketEncryption operation: The server side encryption configuration was not found
```

## Destroy the environment

```shell
terraform destroy
```
50 changes: 50 additions & 0 deletions aws/s3/bucket_default_encryption_disable/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# AWS S3 Bucket 服务端加密未开启场景

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

## 描述信息

这是一个用于构建 AWS S3 Bucket 服务端加密未开启的场景。

## 环境搭建

在容器中执行以下命令

```shell
cd /TerraformGoat/aws/s3/bucket_default_encryption_disable
```

配置 AWS 访问凭证

```shell
aws configure
```

> 在 AWS 「控制台——》安全凭证」处可以设置并查看你的 `aws_access_key_id``aws_secret_access_key`
部署靶场

```shell
terraform init
terraform apply
```

> 在终端提示 `Enter a value:` 时,输入 `yes` 即可
当命令执行完后,在 Outputs 处可以看到 Bucket 名称。

## 操作

获取 Bucket 的加密方式,如果返回内容如下所示则说明未开启 Bucket 加密。

```shell
> aws s3api get-bucket-encryption --bucket houxian-xxx

An error occurred (ServerSideEncryptionConfigurationNotFoundError) when calling the GetBucketEncryption operation: The server side encryption configuration was not found
```

## 销毁环境

```shell
terraform destroy
```
14 changes: 14 additions & 0 deletions aws/s3/bucket_default_encryption_disable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
provider "aws" {
region = "us-east-1"
}

resource "aws_s3_bucket" "huoxian_bucket" {
force_destroy = true
bucket = "houxian-${random_string.random_suffix.result}"
}

resource "random_string" "random_suffix" {
length = 5
special = false
upper = false
}
4 changes: 4 additions & 0 deletions aws/s3/bucket_default_encryption_disable/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "aws_s3_bucket_name" {
value = aws_s3_bucket.huoxian_bucket.bucket
description = "This is the bucket name of AWS S3 Service."
}
8 changes: 8 additions & 0 deletions aws/s3/bucket_default_encryption_disable/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.10.0"
}
}
}

0 comments on commit e003757

Please sign in to comment.