Skip to content

Commit 90d7619

Browse files
committed
Add sysno check in MessageReader
The sysno in MessageReader is interpreted from the Message header passed from the host. A malicious Message header may provide a modified sysno to bypass the validation, and overwrites enclave memory. This change adds a check for sysno to make sure it matches the expected value. This issue was reported by Qinkun Bao, Zhaofeng Chen, Mingshen Sun, and Kang Li from Baidu Security. PiperOrigin-RevId: 377328054 Change-Id: I3ff6f60694d3390f66da89d139cf7cc7b49abaea
1 parent b0413b7 commit 90d7619

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

asylo/platform/system_call/system_call.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ extern "C" int64_t enc_untrusted_syscall(int sysno, ...) {
115115
// Copy outputs back into pointer parameters.
116116
auto response_reader =
117117
asylo::system_call::MessageReader({response_buffer, response_size});
118+
if (response_reader.sysno() != sysno) {
119+
error_handler("system_call.cc: Unexpected sysno in response");
120+
}
118121
const asylo::primitives::PrimitiveStatus response_status =
119122
response_reader.Validate();
120123
if (!response_status.ok()) {

0 commit comments

Comments
 (0)