CVE-2021-22549 (published 2021-06-08T14:15Z)

An attacker can modify the address to point to trusted memory to overwrite arbitrary trusted memory. It is recommended to update past 0.6.2 or git commit https://github.com/google/asylo/commit/53ed5d8fd8118ced1466e509606dd2f473707a5c

Severity: MEDIUM
CVSS v2 base score: 4.6 (AV:L/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-668
cwe_name: Exposure of Resource to Wrong Sphere
description: The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
extended_description: 
            Resources such as files and directories may be inadvertently exposed through mechanisms such as insecure permissions, or when a program accidentally operates on the wrong object. For example, a program may intend that private files can only be provided to a specific user. This effectively defines a control sphere that is intended to prevent attackers from accessing these private files. If the file permissions are insecure, then parties other than the user will be able to access those files.
            A separate control sphere might effectively require that the user can only access the private files, but not any other files on the system. If the program does not ensure that the user is only requesting private files, then the user might be able to access other files on the system.
            In either case, the end result is that a resource has been exposed to the wrong party.
         
         

Fix information:
repo_url: https://github.com/google/asylo
commit_details: repo_url: https://github.com/google/asylo
author: Chong Cai
author_date: 2021-03-12 10:43:12-08:00
msg: Store untrusted input to enclave variable

The untrusted input pointer should be stored to trusted variable before
checking to avoid unexpected modifications after checking.

PiperOrigin-RevId: 362553830
Change-Id: I743f9bd3487de60269e247d74f2188f2ffc06d01
repository: repo_url: https://github.com/google/asylo
repo_name: google/asylo
description: An open and flexible framework for developing enclave applications
repo_language: C++
owner: google
file_changes: filename: trusted_sgx.cc
change_type: ModificationType.MODIFY
diff: @@ -281,12 +281,13 @@ PrimitiveStatus TrustedPrimitives::UntrustedCall(uint64_t untrusted_selector,
     if (sgx_params->input_size > 0) {
       // Allocate and copy data to |input_buffer|.
       sgx_params->input = untrusted_cache->Malloc(sgx_params->input_size);
-      if (!TrustedPrimitives::IsOutsideEnclave(sgx_params->input,
-                                               sgx_params->input_size)) {
+      const void *input_pointer = sgx_params->input;
+      uint64_t input_size = sgx_params->input_size;
+      if (!TrustedPrimitives::IsOutsideEnclave(input_pointer, input_size)) {
         TrustedPrimitives::BestEffortAbort(
             "UntrustedCall: sgx_param input should be in untrusted memory");
       }
-      input->Serialize(const_cast<void *>(sgx_params->input));
+      input->Serialize(const_cast<void *>(input_pointer));
     }
   }
   sgx_params->output_size = 0;

programming_language: C++