-
Notifications
You must be signed in to change notification settings - Fork 261
Segfault in enclave. #1748
Comments
I can't reproduce this issue. Are you sure you're running on an up-to-date version of Graphene? |
Hi @mkow, this is for Graphene-SGX... This was reproduced on the latest release tag: v1.0.1. I was unable to build head revision. Here's the backtrace i saw:
|
Please test this on the current master, this bug was probably already fixed. v1.0.1 is 8 months old...
Why? |
IIRC there were some compilation errors on the particular revision I checked out so instinctively I went to the latest release...anyhow let me try to run it on current head too. |
@dimakuv thanks for the pointer.. yeah I remember for Intel SGX-SSL I had to update those tools... I'll give it a try later tonight.. |
@Arslan8 Any updates on this? |
@mkow sorry for such a late response.. i got caught up with a deadline.. I was able to build v1.1 as well, the issue is still there:
i yet have to debug it, but the behavior looks similar.. |
also as you can see there is no "Creating arguments failed" print.. is there maybe a log file where i could find this print? |
Here's the backtrace:
|
Here's what i see on master:
Here the function prototype is changed, instead of running the fuzzer again, i just remain the new argument unchanged. I can run the fuzzer later when i get some time..but looks like its present on both the latest tag/release and master...
let me know if anything else is required from my side.. again sorry for such a long delay.. |
Please use the current master, v1.1 is 2 months old and the results on it are probably meaningless, it's almost 100 commits old ;)
here you go: https://github.com/oscarlab/graphene/blob/34b8eb1ec2b23d5538d8ede385eb1be50e29354d/Pal/src/host/Linux-SGX/db_main.c#L321-L325
I verified the code and I think it's working as intended. In general, we can't verify if a pointer provided by untrusted runtime is valid or not, at least not without abusing hardware extensions like TSX. The only thing you can do in enclave is to dereference it and see what happens. And NULL isn't really a special value here - just an address which does not point to a readable memory. Anyways, I don't think there's any security issue with implementing it this way, if you think otherwise then please explain why this may be a problem.
No worries :) |
Yeah, we agree that in general verifying a pointer is a hard problem. But a wild dereference in enclave could have adverse effects since that dereference is not protected by hardware memory protection constraints. In contrast what some projects (e.g. Intel SDK) do is that they glue the call with an untrusted lib, which does the dereferencing outside the enclave, while this would still crash the application, but the crash would be contained within the constraints of untrusted memory protections, i.e. it won't be able to access any enclave memory. On the other side, enclaves can use sgx_is_within_enclave to check things. Contact Discovery Enclave is a good example of this. |
But not too hard, you can solve this with TSX. What I mean is that it's IMO not worth solving, because there's no gain from solving this issue.
What adverse effects? It's still protected by the standard x86 memory protection rules, plus we don't allow it to point inside the enclave (see
If I understand you correctly, that would require us to jump out of enclave for every read, which would really trash the performance. And just to reiterate, maybe I'm missing something, but I don't see any security issues with our current approach.
You can't access enclave memory this way, see
|
Hi,
While doing generation based fuzzing on existing SGX programs, we saw that graphene-sgx enclave doesn't do proper NULL checking.
Description of the problem
Steps to reproduce
This generated code triggers the NULL access:
/*[[[cog import cog filename = "./temp" with open(filename) as f: for line in f.readlines(): cog.outl(line) ]]]*/ ret = ecall_enclave_start(NULL, 100, NULL, 100); if (ret != 0) printf("Failure Code: %d",ret); //[[[end]]]
Expected results
Since the enclave is expecting the arguments from untrusted runtime, this should result in invalid argument return value.
Actual results
Segmentation fault inside Enclave.
The text was updated successfully, but these errors were encountered: