
基于 AWS-Redteam-Lab 和 OCD GOAD
每月运行该实验环境 125 小时的费用约为 14 美元。 使用免费套餐,你每月可获得 750 小时的 EC2 使用时间,因为有 6 台机器,所以每台 125 小时。但你只有 30GB 的存储空间。因此,你还需要为其他 5 台虚拟机购买存储空间:30GB * 5 = 150GB = 14 美元/月
与 GOAD 项目一样,安装分为两部分:
到目前为止,该实验环境仅在 Linux 机器上测试过,但应该也能在 macOS 上运行。Ansible 在 Windows 主机上存在一些问题,所以我不太确定。
为了正常完成部署,你需要安装:
如果你想从 Docker 容器中进行配置,可以运行以下命令来准备容器:
sudo docker build -t loadansible .
如果你想在宿主机上运行 Ansible,应执行以下命令:
sudo apt install git
git clone [email protected]:0xBallpoint/LOAD.git
cd LOAD/ansible
sudo apt install python3.8-venv
python3.8 -m virtualenv .venv
source .venv/bin/activate
ansible 和 pywinrm
python3 -m pip install --upgrade pip
python3 -m pip install ansible-core==2.12.6
python3 -m pip install pywinrm
ansible-galaxy install -r requirements.yml
你需要按照官网指南安装 Terraform:hashicorp.com
如果你想在 Linux 上手动安装 Terraform:
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
# Install the HasiCorp GPG key
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
# Verify the key's fingerprint
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
# It must match E8A0 32E0 94D8 EB4E A189 D270 DA41 8C88 A321 9F7B (from https://www.hashicorp.com/security)
# Add the official HashiCorp repository to your system
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list
# Update, install, verify
sudo apt update
sudo apt install terraform
terraform -help
你需要使用 AWS CLI 来配置访问 AWS 的访问密钥。请按照官网上的安装指南操作:docs.aws.amazon.com
对于 Linux:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
默认域为 middle-earth.local,位于子网 10.0.1.0/24 上,每台机器仅分配了 1CPU 和 1024MB 内存(t2.micro)。如果你想更改其中某些性能设置,可以修改文件:terraform/ami-instance.tf
要让实验环境启动并运行,你应该执行以下命令:
pwd
/opt/LOAD # place yourself in the LOAD folder (where you cloned the project)
cd terraform # start with AWS configuration
接下来的步骤将展示如何在 AWS 上配置你的虚拟机:
将 var.tf.example 复制为 var.tf 并修改以下值:
在你的 AWS 控制台上,你应该创建一个 terraform 用户并获取你的 AWS 密钥:
terraformAccess key - Programmatic accessAccess key ID 和 Secret access key使用 AWS CLI 在你的机器上添加密钥:
aws configure --profile terraform
AWS Access Key ID [None]: <access_key_id>
AWS Secret Access Key [None]: <secret_access_key>
cd LOAD
ssh-keygen -t rsa -N "" -b 2048 -C "TerraformKey" -f ./terraform/keys/TerraformKey.pem
terraform init
terraform apply
如果你想销毁你的实验环境:
terraform destroy
每次你的 EC2 实例启动时,你都必须更改 ansible/hosts 文件中的公网 IP。将此命令的输出添加到文件末尾:
aws ec2 describe-instances --profile terraform --region eu-central-1 --query "Reservations[*].Instances[*].{Name:Tags[?Key=='Name'].Value|[],PublicIP:PublicIpAddress}" --filters "Name=instance-state-name,Values=running" --output text |tac |awk 'NR%2 ==0 {print $0}; NR%2 != 0 {print "["tolower(substr($2,5))"]"};'
要配置虚拟机,请使用 ansible-playbook 命令。通常运行时间:1小时30分钟
ansible-playbook main.yml # this will configure the vms in order to play ansible when the vms are ready
要从 Docker 容器中运行 provisioning,请执行(你应该与 Dockerfile 位于同一文件夹中。尚未测试):
sudo docker run -ti --rm --network host -h loadansible -v $(pwd):/load -w /load/ansible loadansible ansible-playbook main.yml
安装过程中有时会出现错误。大多数情况下,你只需重新运行 playbook 即可正常。 若要逐个运行 playbook:
# The main.yml playbook is build in multiples parts. each parts can be re-run independently but the play order must be keep in cas you want to play one by one :
ansible-playbook prepare.yml # updates, passwords, dns settings...
ansible-playbook ad-servers.yml # create servers configuration
ansible-playbook ad-trusts.yml # create the trust relationships
ansible-playbook ad-data.yml # import the ad datas : users/groups...
ansible-playbook ad-groups.yml # set the rights and the group domains relations
ansible-playbook servers.yml # create IIS and MSSQL
ansible-playbook adcs.yml # add adcs and adcs templates
ansible-playbook ad-acl.yml # set ACL
ansible-playbook linux.yml # configure linux entrypoint with GLPI
ansible-playbook security.yml # enable or disable windows defender here
ansible-playbook vulnerabilities.yml # specifics vulns linked to the scenario are here
# You can also install wireguard VPN on the linux host, for that check the VPN paragraph
如果你只想运行 playbook 的特定部分,可以使用标签(始终将 data 作为标签):
ansible-playbook servers.yml
ansible-playbook servers.yml --tags data,iis
ansible-playbook linux.yml --tags data,glpi
一些帮助你管理 AWS 实验环境的命令(虽然看起来很丑,但能工作):
# aws cli profile : terraform
# region : eu-central-1
# Disable instance metadata
for i in $(aws ec2 --profile terraform --region eu-central-1 describe-instances --filters "Name=tag:Name,Values=lab-*" --query 'Reservations[].Instances[].InstanceId' |cut -d '"' -f2); do aws ec2 --profile terraform --region eu-central-1 modify-instance-metadata-options --http-endpoint disabled --instance-id $i --output json --no-cli-pager;done
# Start instances
aws ec2 --profile terraform --region eu-central-1 start-instances --instance-ids `aws ec2 --profile terraform --region eu-central-1 describe-instances --filters "Name=tag:Name,Values=lab-*" "Name=instance-state-name,Values=stopping,stopped" --query 'Reservations[].Instances[].InstanceId' --output text`
# Get running instance and output it to ansible format
aws ec2 describe-instances --profile terraform --region eu-central-1 --query "Reservations[*].Instances[*].{Name:Tags[?Key=='Name'].Value|[],PublicIP:PublicIpAddress}" --filters "Name=instance-state-name,Values=running" --output text |tac |awk 'NR%2 ==0 {print $0}; NR%2 != 0 {print "["tolower(substr($2,5))"]"};'
可选地,你可以在 Linux 主机上添加 VPN 服务器,并配置任意数量的客户端。 首先为 VPN 服务器生成密钥,并修改客户端数量:
apt install wireguard
# generate wireguard keys
privkey=$(wg genkey) sh -c 'echo "
server_privkey: $privkey
server_pubkey: $(echo $privkey | wg pubkey)"'
# encrypt server_privkey with ansible-vault and
ansible-vault encrypt_string --ask-vault-password --stdin-name server_privkey
# Add the result to group_vars/all.yml
# You can change the number of client configuration files it will create. By default it creates 6 clients.
使用以下命令运行 VPN playbook(每次运行该命令时,它都会更改客户端的密钥):
ansible-playbook --ask-vault-password vpn.yml
如果出现 Timeout (12s) waiting for privilege escalation prompt 错误,只需再次运行该命令。
你可以在 ansible/wireguard/lab_client[0-9].conf 中找到客户端配置文件。
要连接 VPN,你需要将包含私钥的客户端文件复制到本地主机的 /etc/wireguard/ 目录中。
你可以使用以下命令启动第一个客户端的 VPN 连接:
sudo wg-quick up lab_client1
你将获得一个 10.0.20.0/24 网段的 IP。

SHIRE (srv02)
- GLPI SQLi
- GLPI-htmlawed-CVE-2022-35914
USERS
- privesc user with vulnerable crontab
- privesc root with password in bash_history and sudo nopasswd for /bin/systemctl
RIVENDELL (dc02)
- anonymous RPC (enum users, pass pol, groups / rpcclient)
- brute force users names
ELF
- celebrian Responder crack hash (bot 3min)
- elrond: Responder with NTLM relay domain admin (bot 5min)
HOBBIT
- bilbo: password in description
- pippin: ASREPROAST
- merry: Constrained delegation with protocol transition / Kerberoasting
- froddo:
- sam:
MINAS-TIRITH(dc01)
- Open share RW, LNK exploit
- khamul.easterling : Open backup share, with GPO with cpassword, password increment
MORIA (srv01)
- MSSQL trusted link : donPapi to get sql_svc password
- mitm6 SRV01 -> DC01
MEN
- denethor: DOMAIN ADMIN
- theoden: ACL self-self-membership-on-group DOMAIN ADMIN
- faramir: ACL genericwrite-on-user Denethor
- boromir: ACL genericall-on-user Denethor
ACL forcechangepassword on Faramir
WriteDACL MEN
FELLOWSHIP
- legolas: execute as user on MSSQL
KERBEROASTING
- gimli: ACL genericall-on-computer MORIA
ACL writeproperty-self-membership DOMAIN ADMIN
- aragorn: execute as login on mssql / administrator
- gandalf: mssql admin
group cross domain
mssql trusted link
ACL writeproperty-self-membership Domain Admins #TODO change for someone who is not administrator, he has DCSYNC (administrator?)
ENTS
- treebeard: ACL writeproperty-on-group DOMAIN ADMIN
- skinbark: ACL genericall-on-group DOMAIN ADMIN
- ginglas: ACL write owner on group DOMAIN ADMIN
BARAD-DUR (dc03)
- Coerced DC + ntlmrelayx to ldaps
- ADCS ESC1, ESC2, ESC3, ESC4, ESC8
- NTLM downgrade attack
MINAS-MORGL (srv03)
- IIS upload webshell
- Privilege escalation Windows 2016 : SeImpersontePrivilege
DARKFORCE
- sauron: domain admin MORDOR
- saruman: mssql admin / GenericAll on gothmog (shadow credentials) / GenericAll on ECS4
- balrog:
PRISONER
- gollum: mssql trusted link
password spray -> user=pwd
ORC
- gothmog: DOMAIN ADMIN
- lurtz:
- ugluk:
- guritz:
NAZGUL
- angmar: