[tmf] enforce link security for all TMF messages (#13048)

This commit updates Tmf::Agent::Filter to require link-layer security
for all incoming TMF requests.

Thread Management Framework (TMF) messages are used for network
management and configuration. The Thread specification requires that
all TMF messages be secured. While individual handlers often have
specific checks, enforcing this at the TMF Agent level provides a
consistent security layer for all TMF traffic.

For most TMF messages, security is provided by the Network Key. For
commissioning-related messages (like Joiner Entrust), security is
provided by the Key Encryption Key (KEK). In all cases, a valid TMF
message must have link-layer security enabled.

This change prevents unauthenticated attackers from sending unsecured
TMF messages to manipulate network state or configuration.
This commit is contained in:
Jonathan Hui
2026-05-05 15:22:45 -07:00
committed by GitHub
parent bf79332530
commit 36b398ef61
+10 -4
View File
@@ -173,10 +173,16 @@ Error Agent::Filter(void *aContext, const Msg &aRxMsg) { return static_cast<Agen
Error Agent::Filter(const Msg &aRxMsg) const
{
return IsTmfMessage(aRxMsg.mMessageInfo.GetPeerAddr(), aRxMsg.mMessageInfo.GetSockAddr(),
aRxMsg.mMessageInfo.GetSockPort())
? kErrorNone
: kErrorNotTmf;
Error error = kErrorNone;
VerifyOrExit(IsTmfMessage(aRxMsg.mMessageInfo.GetPeerAddr(), aRxMsg.mMessageInfo.GetSockAddr(),
aRxMsg.mMessageInfo.GetSockPort()),
error = kErrorNotTmf);
VerifyOrExit(aRxMsg.mMessage.IsLinkSecurityEnabled(), error = kErrorSecurity);
exit:
return error;
}
bool Agent::IsTmfMessage(const Ip6::Address &aSourceAddress, const Ip6::Address &aDestAddress, uint16_t aDestPort) const