Skip to content

[SEC-V-07] RotateChannelKey.encrypted_keys + Event.deps vectors have no element caps #236

@intendednull

Description

@intendednull

Commit: 2f26d91 · Finding: SEC-V-07

Problem

  • RotateChannelKey.encrypted_keys: Vec<(EndpointId, Vec<u8>)> at crates/state/src/event.rs:151-155 — no cap on outer Vec length or inner bytes length. Unpacked directly into state.channel_keys at crates/state/src/materialize.rs:487-505.
  • Event.deps: Vec<EventHash> at crates/state/src/event.rs:210-212 — no declared maximum.

A ManageChannels-authorised peer can broadcast a RotateChannelKey with one entry per fabricated EndpointId (~7000 entries fit in 256 KB), each .clone()-inserted into BTreeMap<EndpointId, Vec<u8>> on every peer.

Fix

  • Cap encrypted_keys.len() at the current member count + small epsilon (there is no legitimate reason to have entries for non-members).
  • Cap individual encrypted-key Vec<u8> at 128 bytes.
  • Cap deps.len() to a small constant (e.g. 64).
  • Reject events violating any of these in Event::new and/or on inbound wire deserialization.

Obvious fix — will be auto-PR'd.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions