Skip to content

HXSecurity/TerraformGoat

Repository files navigation

TerraformGoat

License: Apache-2.0 GitHub release Github Stars PRs Welcome tweet

English | 中文

TerraformGoat is HuoCorp research lab's "Vulnerable by Design" multi cloud deployment tool.

Currently supported cloud vendors include Alibaba Cloud, Tencent Cloud, Huawei Cloud, Amazon Web Services, Google Cloud Platform, Microsoft Azure.

🎯 Scenarios

ID Cloud Service Company Types Of Cloud Services Vulnerable Environment
1 Tencent Cloud Object Storage Bucket ACL Writable
2 Tencent Cloud Object Storage Bucket ACL Readable
3 Tencent Cloud Object Storage Bucket Public Access
4 Tencent Cloud Object Storage Object Public Access
5 Tencent Cloud Object Storage Unrestricted File Upload
6 Tencent Cloud Object Storage Bucket Object Traversal
7 Tencent Cloud Object Storage Bucket Logging Disable
8 Tencent Cloud Object Storage Server Side Encryption Disable
9 Tencent Cloud Elastic Computing Service CVM SSRF
10 Tencent Cloud Elastic Computing Service CVM security group open all port
11 Tencent Cloud Elastic Computing Service CVM security group open common port
12 Tencent Cloud Elastic Computing Service CVM Virtual Machine Disks Are Unencrypted
13 Alibaba Cloud Object Storage Bucket HTTP Enable
14 Alibaba Cloud Object Storage Object ACL Writable
15 Alibaba Cloud Object Storage Object ACL Readable
16 Alibaba Cloud Object Storage Special Bucket Policy
17 Alibaba Cloud Object Storage Bucket Public Access
18 Alibaba Cloud Object Storage Object Public Access
19 Alibaba Cloud Object Storage Bucket Logging Disable
20 Alibaba Cloud Object Storage Bucket Policy Readable
21 Alibaba Cloud Object Storage Bucket Object Traversal
22 Alibaba Cloud Object Storage Unrestricted File Upload
23 Alibaba Cloud Object Storage Server Side Encryption No KMS Set
24 Alibaba Cloud Object Storage Server Side Encryption Not Using BYOK
25 Alibaba Cloud Elastic Computing Service ECS SSRF
26 Alibaba Cloud Elastic Computing Service ECS security group open all port
27 Alibaba Cloud Elastic Computing Service ECS security group open common port
28 Alibaba Cloud Elastic Computing Service ECS unattached disks are unencrypted
29 Alibaba Cloud Elastic Computing Service ECS virtual machine disks are unencrypted
30 Huawei Cloud Object Storage Object ACL Writable
31 Huawei Cloud Object Storage Special Bucket Policy
32 Huawei Cloud Object Storage Unrestricted File Upload
33 Huawei Cloud Object Storage Bucket Object Traversal
34 Huawei Cloud Object Storage Wrong Policy policy causes arbitrary file uploads
35 Huawei Cloud Elastic Computing Service ECS SSRF
36 Huawei Cloud Elastic Computing Service ECS UNSAFE SECURITY GOURP
37 Huawei Cloud Relational Database Service RDS Mysql Baseline Checking Environment
38 Amazon Web Services Object Storage Object ACL Writable
39 Amazon Web Services Object Storage Bucket ACL Writable
40 Amazon Web Services Object Storage Bucket ACL Readable
41 Amazon Web Services Object Storage MFA Delete Is Disable
42 Amazon Web Services Object Storage Special Bucket Policy
43 Amazon Web Services Object Storage Bucket Object Traversal
44 Amazon Web Services Object Storage Unrestricted File Upload
45 Amazon Web Services Object Storage Bucket Logging Disable
46 Amazon Web Services Object Storage Bucket Allow HTTP Access
47 Amazon Web Services Object Storage Bucket Default Encryption Disable
48 Amazon Web Services Elastic Computing Service EC2 SSRF
49 Amazon Web Services Elastic Computing Service Console Takeover
50 Amazon Web Services Identity and Access Management IAM Privilege Escalation
51 Google Cloud Platform Object Storage Object ACL Writable
52 Google Cloud Platform Object Storage Bucket ACL Writable
53 Google Cloud Platform Object Storage Bucket Object Traversal
54 Google Cloud Platform Object Storage Unrestricted File Upload
55 Google Cloud Platform Elastic Computing Service VM Command Execution
56 Microsoft Azure Object Storage Blob Public Access
57 Microsoft Azure Object Storage Container Blob Traversal
58 Microsoft Azure Elastic Computing Service VM Command Execution

💫 Install

Depending on the cloud service provider you are using, choose the corresponding installation command.

Alibaba Cloud

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aliyun:0.0.4
docker run -itd --name terraformgoat_aliyun_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aliyun:0.0.4
docker exec -it terraformgoat_aliyun_0.0.4 /bin/bash

Tencent Cloud

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_tencentcloud:0.0.4
docker run -itd --name terraformgoat_tencentcloud_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_tencentcloud:0.0.4
docker exec -it terraformgoat_tencentcloud.0.4 /bin/bash

Huawei Cloud

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_huaweicloud:0.0.4
docker run -itd --name terraformgoat_huaweicloud_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_huaweicloud:0.0.4
docker exec -it terraformgoat_huaweicloud_0.0.4 /bin/bash

Amazon Web Services

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aws:0.0.4
docker run -itd --name terraformgoat_aws_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aws:0.0.4
docker exec -it terraformgoat_aws_0.0.4 /bin/bash

Google Cloud Platform

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_gcp:0.0.4
docker run -itd --name terraformgoat_gcp_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_gcp:0.0.4
docker exec -it terraformgoat_gcp_0.0.4 /bin/bash

Microsoft Azure

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_azure:0.0.4
docker run -itd --name terraformgoat_azure_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_azure:0.0.4
docker exec -it terraformgoat_azure_0.0.4 /bin/bash

📄 Demo

After entering the container, cd to the corresponding scenario directory and you can start deploying the scenario.

Here is a demonstration of the Alibaba Cloud Bucket Object Traversal scenario build.

docker pull registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aliyun:0.0.4
docker run -itd --name terraformgoat_aliyun_0.0.4 registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat_aliyun:0.0.4
docker exec -it terraformgoat_aliyun_0.0.4 /bin/bash

img

cd /TerraformGoat/aliyun/oss/bucket_object_traversal/
aliyun configure
terraform init
terraform apply

img

The program prompts Enter a value:, type yes and enter, use curl to access the bucket, you can see the object traversed.

img

🚀 Uninstall

If you are in a container, first execute the exit command to exit the container, and then execute the following command under the host.

docker stop $(docker ps -a -q -f "name=terraformgoat*")
docker rm $(docker ps -a -q -f "name=terraformgoat*")
docker rmi $(docker images -a -q -f "reference=registry.cn-beijing.aliyuncs.com/huoxian_pub/terraformgoat*")

⚠️ Notice

  1. The README of each vulnerable environment is executed within the TerraformGoat container environment, so the TerraformGoat container environment needs to be deployed first.
  2. Due to the horizontal risk of intranet horizontal on the cloud in some scenarios, it is strongly recommended that users use their own test accounts to configure the scenarios, avoid using the cloud account of the production environment, and install TerraformGoat using Dockerfile to isolate the user's local cloud vendor token and the test account token.
  3. TerraformGoat is used for educational purposes only, It is not allowed to use it for illegal and criminal purposes, any consequences arising from TerraformGoat are the responsibility of the person using it, and not the HuoCorp organization.

🎊 Contributing

Contributions are welcomed and greatly appreciated. Further reading — CONTRIBUTING.md for details on contribution workflow.

🪪 License

TerraformGoat is under the Apache 2.0 license. See the LICENSE file for details.

🔮 Stats

Alt

About

TerraformGoat is HXSecurity research lab's "Vulnerable by Design" multi cloud deployment tool.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6