mirror of
https://github.com/espressif/openthread.git
synced 2026-08-25 11:49:51 +00:00
[mac] verify that Security Level is correct in rx frame (#4905)
This commit adds a check in `Mac::ProcessReceiveSecurity()` to verify that the Security Level in the received frame is properly set to `kSecEncMic32` before trying to decrypt and validate the frame. This helps avoid performing AES-CCM when frame is invalid and also avoid potentially reading beyond the frame length when checking MIC/footer.
This commit is contained in:
@@ -1446,6 +1446,8 @@ otError Mac::ProcessReceiveSecurity(RxFrame &aFrame, const Address &aSrcAddr, Ne
|
||||
VerifyOrExit(aFrame.GetSecurityEnabled(), error = OT_ERROR_NONE);
|
||||
|
||||
aFrame.GetSecurityLevel(securityLevel);
|
||||
VerifyOrExit(securityLevel == Frame::kSecEncMic32, OT_NOOP);
|
||||
|
||||
aFrame.GetFrameCounter(frameCounter);
|
||||
otLogDebgMac("Rx security - frame counter %u", frameCounter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user