microsoft / Azure-DCAP-Client

Interfaces between SGX SDKs and the Azure Attestation SGX Certification Cache.
MIT License
60 stars 46 forks source link

Regression in Azure-DCAP-Client 1.10 for SGX Quote Verification #147

Open veenasai2 opened 3 years ago

veenasai2 commented 3 years ago

Hi,

I observed there is some regression in Azure-DCAP-Client 1.10. With the help of 1.10, sgx dcap quote generation is successful , but quote verification fails. This issue is obeserved for both in-proc and out-of-proc mode quote verification.

Steps to reproduce:

  1. Install az-dcap-client 1.10 on Azure VM.
  2. Generate SGX in-proc (or out-of-proc) mode quote (sample link: https://github.com/intel/SGXDataCenterAttestationPrimitives/tree/master/SampleCode/QuoteGenerationSample). (Successful).
  3. Verify SGX quote (error: App: sgx_qv_verify_quote failed: 0xe022).

Note: With Azure-DCAP-Client 1.8 both quote generation and verification are successful on Azure confidential compute VM.

Any thoughts on this would be really helpful.

Thanks

veenasai2 commented 3 years ago

Hi,

Please let me know if you need more information on this.

Thanks

veenasai2 commented 3 years ago

Hi,

Any update on this?

Thanks

jdbeaney commented 3 years ago

Typically, the 0xE022 error occurs when you use a different API version for retrieving PCK Certificates for Quote Generation from the API used for Quote Verification.

It appears that you are using the DCAP QVL to verify the quote. It may help to better understand your configuration. But, based on the error, I suspect that the version of the collateral used for verifying the quote have a different Root CA Certificate as used by the PCK Certificate Chain for Quote generation.

veenasai2 commented 3 years ago

@jdbeaney , thanks for your reply. I am aware of the situation you are describing here. But if you see the problem description, i face this issue only with az-dcap-client 1.10.

With az-dcap-client 1.8 on Azure confidential compute VM, both quote generation and quote verification are successful. But with az-dcap-client 1.10, I am able to generate the quote, but its verification is not successful.

I tried two cases

Case 1: az-dcap-client 1.8 installed, rest other libraries same, quote gen -> pass, quote verification ->pass.

Case 2: az-dcap-client 1.10 installed, rest other libraries same, quote gen -> pass, quote verification ->fail.

That's why I suspect there is some regression in az-dcap-client 1.10.

Thanks

jdbeaney commented 3 years ago

I'm not sure what changed between az-dcap-client 1.8 and az-dcap-client 1.10. But, if the az-dcap-client 1.8 used V2 APIs to retrieve both the PCK Certificate and the verification collateral whereas the az-dcap-client 1.10 uses V2 APIs to retrieve PCK Certificates but V3 API's to retrieve verification collateral, this may explain the issue.

The latest release of the DCAP (v1.12: https://01.org/intel-softwareguard-extensions/downloads/intel-sgx-dcap-1.12-release) does have a change in the DCAP QVL that addresses this incompatibility. Can you try using the DCAP 1.12's version of the QVL to see if that addresses your issue?

From the DCAP 1.12 release notes:

"Updated SGX ECDSA quote verification library (QVL) and quote verification enclave (QvE) to hardcode Intel® root public key instead of root certificate."

yentsanglee commented 3 years ago

I don't see much change between version 1.8 and 1.10. I agree with @jdbeaney that the issue could be the v3 encoding differences. I.e. az-dcap-client v3 encoding == DCAP QVL v3.1 encoding

@veenasai2 As a mitigation, you can try to set environment variable "AZDCAP_COLLATERAL_VERSION to "v2" which will revert your collateral version even if you have az-dcap-client 1.10.