-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dcap-ql: should accept extra trailing data in quote #676
Comments
I don't think this is a bug as described. It is correct that a validation function errors out when extraneous data is passed in. The bug is that See https://download.01.org/intel-sgx/sgx-dcap/1.3/linux/docs/Intel_SGX_ECDSA_QuoteLibReference_DCAP_API.pdf for the data structure specification. |
hi then seems that we need to update It is also in |
After internal discussions we decided not to change the behavior described in the issue, because doing so runs the risk of future issues due to format changes or other unforeseen issues. I recommend changing the code producing the quote to return the exact size upon |
@jason-liang-vault which CPU family are you running on and which DCAP provider are you using? |
Describe the bug:
we've recently receive following error, which is generated in this line (https://github.com/fortanix/rust-sgx/blob/master/intel-sgx/dcap-ql/src/quote.rs#L240)
Invalid signature length, expected 4164, got 4168
After some investigation, following is the root cause
The quote function in dcap-ql which generate quote contains following two steps
The erroneous signature that trigger the error above is actually still valid, just that there are four trailing '\x00' at the end of the quote, which should be caused by a larger estimated quote size
get quote function looks like this, and the
let mut quote = vec![0; quote_size as _];
should be the root cause of those trailing '\x00'And when parsing the signature in fortanix's library, it requires the input buffer (which is vec![0; quote_size as _] to match the exact content (which is represented by format [length_of_following_bytes, byte_1, byte_2, ...], e.g. [0x5, 0xab, 0xcd, 0xef, 0x01, 0x23])
And the fix is simple, instead of failing when the expected quote length and actual quote length mismatch, we just keep parsing, and discard any trailing data (so effectively accepting longer quote, but will still reject quote that is shorter than expected)
To Reproduce:
Steps to reproduce the behavior:
dcap_ql::quote
dcap_ql
crateExpected behavior:
Extra bytes are ignored, and parsing passed
Reproducibility:
Environment:
Possible Solution:
Parse the quote as normal, but instead of failing directly after detecting extra trailing bytes, simply discard them
Severity:
The text was updated successfully, but these errors were encountered: