You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Hardening] Validate legacy block_headers length before slicing (F-007) #236
In rust-electrum-client 0.25.2 (reported upstream commit 7c1d759), the pre-1.6 legacy response path for blockchain.block.headers trusts the server-controlled result.count and slices the decoded header bytes in fixed 80-byte chunks without validating the available length. A malicious or compromised Electrum server (or an attacker able to alter the Electrum connection) can make a release build panic, causing client/wallet availability loss.
range end index 80 out of range for slice of length 0
A negative control containing one valid 80-byte header with count=1 returns normally. A count=3 response containing only one header panics at the second slice.
Source
Reported source location: raw_client.rs lines 1062–1068 (in the affected revision).
Suggested hardening
Validate the decoded header byte length (and its consistency with count) before fixed-size slicing.
Return a normal protocol error on mismatch instead of panicking.
Add regression tests for empty/truncated headers and mismatched counts.
This is a hardening issue: the demonstrated impact is availability loss in release mode; no fund or privacy compromise was observed.
Activity