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

reject truncated and oversized tlv lengths when parsing keycard responses

Public commit record

What the developer wrote

Authored by Craig Raw

50/100 · Thin
reject truncated and oversized tlv lengths when parsing keycard responses
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit fixes a bug in how Sparrow Wallet reads data from Keycard hardware wallets. Previously, the code trusted the length declared inside a card response without checking whether that many bytes actually exist. A malicious or malfunctioning card could claim a huge length, causing the app to read past the end of the buffer and potentially return fabricated zero-filled data. The patch now rejects responses whose declared length is truncated, oversized, or malformed, and adds tests to confirm the new behavior.

Recommended action

Treat this as a security hardening fix for the Keycard integration. Review whether any other TLV parsers in the codebase perform similar unchecked length arithmetic, and ensure the new validation does not break legitimate Keycard responses. Users who interact with Keycards should upgrade to a release containing this commit, especially if they use cards from untrusted sources.

Security signals we found

01

Out-of-bounds read / buffer over-read in TLV length parsing

02

Truncated and oversized length values previously accepted

03

Potential memory-safety issue leading to zero-padded fabricated data

04

Input validation added for malformed BER-TLV length encoding

05

Indefinite length form (0x80) now rejected

06

Test cases demonstrate prior behavior: short body returned zero padding, oversized length returned megabytes of zeros

Risk score

Why this scored 56/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 7/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.