-
Notifications
You must be signed in to change notification settings - Fork 51
Bugs found in ehsm #265
Comments
Stack OOB
In case 1 in Thus, in Tips: |
Thanks for pointing the issues. for the 2nd one, we will take a look and fix it soon. (also welcome for your contribution if you want to..) for the 1st one, could you provide more details, since i'm not quite understand your point. Because it will return error directly when it hits the below condition: cmk_size != APPEND_SIZE_TO_KEYBLOB_T(cmk->keybloblen) |
Above EDL rule in If you specify size of
|
I think if you want to specify |
About this, before |
OK, I'll try to fix |
Yes, Thanks. But for your suggestion "you can set [in, count=xxx], this will malloc count * sizeof(ehsm_keyblob_t) for cmk", it may not suitable for this case, because the buffer appended to the structure is not an integer multiple of an existing structure. How do you think if we add more checks in each interfaces to check whether the in_size is larger than the size of structure before doing the existing checks? or do you have some better idea to handle it? |
Yes, I find
Maybe we can pass another parameter to specify len of |
I create a PR #267 for above stack OOB |
Oops, lot's of interfaces in EDL like
ehsm/core/Enclave/enclave_hsm.cpp Lines 861 to 878 in 7a54667
|
Yes, it's a common issue now. A quick fix is to add a check at the beginning of the original checks, to make sure the size is larger than the expected structure size in each interfaces. |
Forget to set return valueYou seems fortget to set Line 92 in 7a54667
Lines 61 to 144 in 7a54667
However, if not return -1, ehsm/core/App/untrusted_enclave_msg_exchange.cpp Lines 159 to 167 in 7a54667
Another example is at line 72, cause free an invalid pointer. ehsm/core/App/untrusted_enclave_msg_exchange.cpp Lines 62 to 72 in 7a54667
And
|
Thanks for pointing the issues. Could you provide a patch to fix them? Thanks |
@yang8621 OK |
Thanks @LeoneChen. We may need a static code scan in the future. |
Good! Hope EHSM become more and more popular |
Thanks for your contribution. |
Hi. I am trying to test this sgx-based project. May I ask how you discovered these bugs mentioned above. Did you use some fuzzing tools or just manually check the code? |
Hi~ We've developed a fuzzing tool to detect this bugs. |
Thanks~ Is this tool public? If so, could u share a link? |
We will open source after paper is accepted |
ok. Looking forward to it~ |
Hello~
Heap OOB
enclave_decrypt
defined in EDL setcmk_size
ascmk
's size, but attacker can feedcmk_size
smaller thensizeof(ehsm_keyblob_t)
, and TBridge onlymalloc
cmk_size
for it.Then in function
enclave_decrypt
,cmk->keybloblen
will out-of-bound access invalid memory, e.g.cmk->keybloblen
is at offset 0x30, butcmk_size
is fed with 0x20.The text was updated successfully, but these errors were encountered: