From b5b9a62db757109c1b2d1462990ffc38ea1f4449 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Sat, 3 Feb 2024 03:43:31 +0800 Subject: [PATCH] [ncp] set message origin to host untrusted (#9825) The IPv6 packets received from host is from a different network stack, which is untrusted. --- src/ncp/ncp_base_mtd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index fc233a657..badc6a5e4 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -2269,6 +2269,7 @@ template <> otError NcpBase::HandlePropertySet(void) // STREAM_NET requires layer 2 security. message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, nullptr); VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS); + otMessageSetOrigin(message, OT_MESSAGE_ORIGIN_HOST_UNTRUSTED); error = otIp6Send(mInstance, message); @@ -3303,6 +3304,7 @@ template <> otError NcpBase::HandlePropertySet( // STREAM_NET_INSECURE packets are not secured at layer 2. message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, &msgSettings); VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS); + otMessageSetOrigin(message, OT_MESSAGE_ORIGIN_HOST_UNTRUSTED); // Ensure the insecure message is forwarded using direct transmission. otMessageSetDirectTransmission(message, true);