Skip to content

#84: prevent valid Nonce Reports being dropped after an end node restart - #92

Open
Peter Balogh (silabs-peterb) wants to merge 1 commit into
SiliconLabsSoftware:mainfrom
silabs-peterb:GH-84-Nonce-Report-from-power-cycled-end-node-might-be-dropped-due-to-duplicate-detection
Open

Peter Balogh (silabs-peterb) wants to merge 1 commit into
SiliconLabsSoftware:mainfrom
silabs-peterb:GH-84-Nonce-Report-from-power-cycled-end-node-might-be-dropped-due-to-duplicate-detection

Conversation

@silabs-peterb

@silabs-peterb Peter Balogh (silabs-peterb) commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Issue

Closes: #84

Change

Description

Fix S2 duplicate detection incorrectly dropping valid Nonce Reports after an end node restarts.

An end node selects a random sequence number at startup. This sequence may be one below the last value stored by ZPC. Previously, the duplicate window treated both the current and preceding sequence numbers as duplicates, preventing SPAN re-establishment.

The fix rejects only an exact (peer, sequence number) match and stores any different sequence number as the new value.

Specification alignment

This follows the S2 duplicate-detection requirements CC:009F.01.00.11.02DCC:009F.01.00.11.030, which define duplicate detection using the source peer and sequence number.

It also supports CC:009F.01.00.11.0AD, which requires a random sequence number at startup.

Checklist

@silabs-peterb Peter Balogh (silabs-peterb) added the On roadmap On the official roadmap and will be implemented by Silicon Labs label Sep 15, 2026
@silabs-peterb Peter Balogh (silabs-peterb) added the Bug Issue is a bug report label Sep 15, 2026
@silabs-peterb Peter Balogh (silabs-peterb) added Silicon Labs development PR contents developed by Silicon Labs CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation labels Sep 15, 2026
@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Changes Z-Wave S2 security duplicate-detection behavior across all sequenced frames; incorrect logic could weaken replay protection or break resync after node restart.

Overview
Fixes S2 duplicate detection so valid Nonce Reports are not dropped when an end node restarts and picks a new random sequence number (often one below the value still stored in the controller’s SPAN table).

S2_verify_seq no longer uses a configurable duplicate window (S2_SEQ_DUPL_WINDOW_SIZE / S2_SEQ_DUPL_WINDOW_SIZE_NONCE_GET, removed from s2_protocol.h). It now treats a frame as a duplicate only on an exact match of the peer’s last stored rx_seq; any different sequence is accepted and stored. The same rule applies to Nonce Get, Nonce Report registration, message encapsulation, and FSM handling.

Adds test_nonce_report_accepts_new_random_sequence_after_peer_restart to verify a post-restart sequence one below the previous value is accepted while an immediate replay with the same sequence is ignored.

Reviewed by Cursor Bugbot for commit a35c3cd. Configure here.

@silabs-peterb

Copy link
Copy Markdown
Collaborator Author

PR Summary

High Risk Changes Z-Wave S2 security duplicate-detection behavior across all sequenced frames; incorrect logic could weaken replay protection or break resync after node restart.

Overview Fixes S2 duplicate detection so valid Nonce Reports are not dropped when an end node restarts and picks a new random sequence number (often one below the value still stored in the controller’s SPAN table).

S2_verify_seq no longer uses a configurable duplicate window (S2_SEQ_DUPL_WINDOW_SIZE / S2_SEQ_DUPL_WINDOW_SIZE_NONCE_GET, removed from s2_protocol.h). It now treats a frame as a duplicate only on an exact match of the peer’s last stored rx_seq; any different sequence is accepted and stored. The same rule applies to Nonce Get, Nonce Report registration, message encapsulation, and FSM handling.

Adds test_nonce_report_accepts_new_random_sequence_after_peer_restart to verify a post-restart sequence one below the previous value is accepted while an immediate replay with the same sequence is ignored.

Reviewed by Cursor Bugbot for commit a35c3cd. Configure here.

The risk classification is understandable because S2_verify_seq() is shared
by multiple S2 frame types.

The change is intentional and aligned with the S2 duplicate-detection
requirements. A frame is considered a duplicate when its peer and sequence
number match the stored entry. Any different sequence number replaces the
stored value. This also allows a node to select a new random sequence number
after restart, as required by CC:009F.01.00.11.0AD.

Replay protection for an immediate duplicate remains intact: the regression
test verifies that the first Nonce Report with the new sequence is accepted
and an immediate replay with the same sequence is rejected.

…er an end node restart

Signed-off-by: Peter Balogh <peter.balogh@silabs.com>
@silabs-peterb
Peter Balogh (silabs-peterb) force-pushed the GH-84-Nonce-Report-from-power-cycled-end-node-might-be-dropped-due-to-duplicate-detection branch from a35c3cd to 5d51445 Compare September 15, 2026 08:54
@siliconlabsdevops-svc-devops siliconlabsdevops-svc-devops Bot removed the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Sep 15, 2026
@siliconlabsdevops-svc-devops

Copy link
Copy Markdown

CTT Jenkins job: $zpc_ctt_jenkins_url/job/zw-ctt-automation-multibranch/job/main/3712/

@silabs-peterb Peter Balogh (silabs-peterb) added the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Sep 15, 2026
@siliconlabsdevops-svc-devops siliconlabsdevops-svc-devops Bot removed the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Sep 15, 2026
@siliconlabsdevops-svc-devops

Copy link
Copy Markdown

CTT Jenkins job: $zpc_ctt_jenkins_url/job/zw-ctt-automation-multibranch/job/main/3718/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Issue is a bug report On roadmap On the official roadmap and will be implemented by Silicon Labs Silicon Labs development PR contents developed by Silicon Labs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nonce Report from power cycled end node might be dropped due to duplicate detection

2 participants