Fix: Treat all-zero channel secrets as empty/deleted slots instead of valid channel keys#2894
Open
burningtree wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treat all-zero channel secrets as empty or deleted slots instead of valid channel keys.
This PR was prompted after multiple users reported receiving unexpected group messages on channel they had never configured. Depending on the client, these messages appeared only in the RX log, as an unnamed channel, or as #unknown (also in meshcore-cli).
Clients represent channel removal by writing an empty channel record with a 32-byte zero secret. Previously, such a slot could still be interpreted as a valid 128-bit channel: the firmware would hash the first 16 zero bytes, producing channel hash
0x37.Because empty slots were still considered during channel lookup, packets created with the publicly known zero key could be decrypted and handled like normal group messages. This could cause unsolicited messages to appear in connected clients under an empty or unknown channel and enter the regular message notification flow.
Changes
searchChannelsByHash().setChannel()as channel deletion and clear the slot.findChannelIdx().Result
Empty and deleted channel slots are now consistently treated as inactive. They no longer participate in channel lookup or decryption, preventing zero-key group messages from reaching connected Companion clients.
Cases
Shared key:
00000000000000000000000000000000Example packet:
154535 B9 56 8F 05 60 10 0A B1 B537 7F 9A 2F 24 96 7F 45 5A C9 B5 4A 6C 12 E0 14 0F B7 B5 67 33 69 6D 37 64 A0 ED 9E A4 B4 50 A2 54 82 E7(analyzer)