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

Replace VarInt with custom UncheckedVarInt

Public commit record

What the developer wrote

Authored by Salvatore Ingala

68/100 · Adequate
Replace VarInt with custom UncheckedVarInt

rust-bitcoin version 0.32.9 started enforcing a consensus rule that
VarInt objects are at most 0x02000000, while the Bitcoin app
protocol uses it for arbitrary numbers up to 64 bits.

UncheckedVarInt works for any u64.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit swaps the library's standard variable-length integer type for a custom one in Ledger's Bitcoin app client code. The change is needed because a newer version of the rust-bitcoin library started rejecting large varints that the Ledger protocol legitimately uses for non-Bitcoin data. The patch itself is a compatibility fix, not an obvious vulnerability, but it removes a safety boundary and any bugs in the new custom encoder/decoder could affect how the client talks to Ledger devices.

Recommended action

Review the UncheckedVarInt encoder/decoder for off-by-one errors and non-minimal rejection logic; add unit tests for boundary values (0xFC/0xFD, 0xFFFF/0x10000, 0xFFFFFFFF/0x100000000) and malformed inputs; verify downstream Ledger firmware still accepts the produced wire format; consider pinning or documenting the rust-bitcoin dependency rationale.

Security signals we found

01

Custom reimplementation of a consensus-sensitive encoding primitive

02

Removal of an upstream library-enforced upper bound on varint values

03

New Decodable implementation must correctly reject non-minimal encodings to avoid parsing ambiguity

04

Change spans protocol parsing, command serialization, and PSBT handling

Risk score

Why this scored 34/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/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.