-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
Context: src/signature/generalized_xmss.rs
Description:
verify() indexes sig.hashes[chain_index] without first checking sig.hashes.len() == IE::DIMENSION.
A malicious signature (e.g., decoded from SSZ/serde) with an empty/short hashes vector will trigger an out-of-bounds panic, crashing the verifier (remote DoS in any service that verifies untrusted signatures).
Impact
- Bug type: Resource management
- Code:
// ...
let chain_length = IE::BASE;
let num_chains = IE::DIMENSION;
// ...
for (chain_index, xi) in x.iter().enumerate() {
let steps = (chain_length - 1) as u8 - xi;
let start_pos_in_chain = *xi;
let start = &sig.hashes[chain_index];
let end = chain::<TH>(
&pk.parameter,
epoch,
chain_index as u8,
start_pos_in_chain,
steps as usize,
start,
);
chain_ends.push(end);
}
// ...Recommendation
Before the loop, validate sig.hashes.len() == IE::DIMENSION (and ideally reject any other length early in SSZ/serde decoding).
Return false on mismatch instead of panicking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels