AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 24 Bitcoin

Merge remote-tracking branch 'agent/benma-agent/unstable-key-sorting'

Public commit record

What the developer wrote

Authored by Marko Bencun

50/100 · Thin
Merge remote-tracking branch 'agent/benma-agent/unstable-key-sorting'
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit replaces Rust's stable sort with an unstable sort in three places inside the BitBox02 firmware. Stable and unstable sorts produce the same output when all items are different, but can differ when there are duplicate items. In two places (multisig xpub hashing and pkscript building), the sorted data is hashed or turned into a Bitcoin script, so any change in ordering could change the resulting wallet fingerprint or transaction address. In the third place (Cardano signing keypaths), the list is deduplicated right after sorting, so duplicates are removed anyway. The change is likely intended to save a small amount of memory or runtime, but it is a partial patch: the commit message gives no explanation, and there is no visible follow-up to ensure callers never rely on stability for duplicate entries.

Recommended action

Treat this as a code-quality and determinism concern, not as a confirmed vulnerability. Review whether duplicate xpubs or pubkeys can reach `get_hash` and `pkscript`; if they can, either deduplicate before sorting or revert to `.sort()` to preserve deterministic ordering. For Cardano, the change is safe because `dedup()` follows. Ask the vendor for the rationale behind the merge and whether it was paired with validation that guarantees unique inputs.

Security signals we found

01

Use of unstable sort on data that is later hashed or serialized into a script

02

No visible duplicate-removal before hashing/scripting in the two multisig sites

03

Merge commit with no explanatory security rationale

04

Potential non-determinism in multisig account/address derivation if duplicate keys are present

Risk score

Why this scored 24/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 5/15
Confidence 4/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.