Closed mustakimur closed 5 years ago
That's a good point. There needs to be a check that and buf
and buf + ssl->out_left
is within the range of the outgoing buffer. Would you like to submit a fix? Or I can work on it later too.
I saw there is a fix for this in the main project. I will clone that here soon.
There is a massive information leak case in mbedtls_ssl_flush_output() using the ocall_mbedtls_net_send(). The vulnerable code is here:
Here,
ssl->out_left
is size_t (unsigned) and theret
is ocall return (hence untrusted). Thessl->out_left -=ret;
line can causessl->out_left
to a large positive integer (hence infinite loop). Moreover, thebuf
is pointed to memory using the untrustedssl->out_left
can let it pointing to any memory location and using the next ocall, dump the entire enclave memory. Note,ret
is only check for negative value filter. A value greater thanssl->out_left
can cause this issue.